From f331d2e75b9734c90f480ccebfa25b79d5a8fa29 Mon Sep 17 00:00:00 2001 From: pheonix99 Date: Sun, 20 Mar 2022 14:50:18 -0400 Subject: [PATCH] Armor fix, killed sfx spam on heroism aura, fixed (I think) destructive dispel behaviour --- LevelableAivu/Config/Blueprints.json | 3 +- LevelableAivu/Config/ModSettings.cs | 2 +- LevelableAivu/Config/Settings.json | 4 -- LevelableAivu/CreateHavocDragonClass.cs | 34 +++++++++- LevelableAivu/FinishingTouches.cs | 28 +++++++- LevelableAivu/Info.json | 2 +- LevelableAivu/LevelableAivu.csproj | 2 +- LevelableAivu/ModifyEquipmentRestrictions.cs | 40 ------------ ...quipmentRestrictionsHasAnyClassFromList.cs | 65 +++++++++++++++++++ Readme.md | 7 +- 10 files changed, 130 insertions(+), 57 deletions(-) delete mode 100644 LevelableAivu/ModifyEquipmentRestrictions.cs create mode 100644 LevelableAivu/ModifyEquipmentRestrictionsHasAnyClassFromList.cs diff --git a/LevelableAivu/Config/Blueprints.json b/LevelableAivu/Config/Blueprints.json index 2e6052e..851ddd4 100644 --- a/LevelableAivu/Config/Blueprints.json +++ b/LevelableAivu/Config/Blueprints.json @@ -13,7 +13,8 @@ "HavocDragonClass20To40": "72e605ac-012e-43cf-9c75-3c69235c2d99", "HavocDragonProgress": "b3fba1ee-c6e9-4d11-8b5c-f94d1290df9c", "HavocDragonProgress2": "3fcbce70-bc95-444f-b514-9be661e003a7", - "HavocDragonSpellList": "5972da2e-e772-4377-b85f-c91363c4b6c8" + "HavocDragonSpellList": "5972da2e-e772-4377-b85f-c91363c4b6c8", + "AivuHeroismBuff": "d21b3d90-feb2-450d-87f1-62d4f57decd8" }, "AutoGenerated": {}, "UnusedGUIDs": {} diff --git a/LevelableAivu/Config/ModSettings.cs b/LevelableAivu/Config/ModSettings.cs index 99613cd..20944cc 100644 --- a/LevelableAivu/Config/ModSettings.cs +++ b/LevelableAivu/Config/ModSettings.cs @@ -43,7 +43,7 @@ public static void LoadAllSettings() { LoadSettings("Settings.json", ref Settings); LoadSettings("Blueprints.json", ref Blueprints); - LoadLocalization(); + LoadLocalization(); } public static void LoadLocalization() diff --git a/LevelableAivu/Config/Settings.json b/LevelableAivu/Config/Settings.json index f7a4981..52b7fd1 100644 --- a/LevelableAivu/Config/Settings.json +++ b/LevelableAivu/Config/Settings.json @@ -7,10 +7,6 @@ "Enabled": true, "Description": "Give Aivu Bard Spell Access Per Tabletop Havoc Dragons" - }, - "BardingForAivu": { - "Enabled": true, - "Description": "Give Aivu Access To Barding Proficiency" } } diff --git a/LevelableAivu/CreateHavocDragonClass.cs b/LevelableAivu/CreateHavocDragonClass.cs index 615649a..8bef1c6 100644 --- a/LevelableAivu/CreateHavocDragonClass.cs +++ b/LevelableAivu/CreateHavocDragonClass.cs @@ -19,6 +19,7 @@ using Kingmaker.UnitLogic.Abilities; using Kingmaker.UnitLogic.Abilities.Blueprints; using Kingmaker.UnitLogic.Abilities.Components; +using Kingmaker.UnitLogic.Abilities.Components.AreaEffects; using Kingmaker.UnitLogic.ActivatableAbilities; using Kingmaker.UnitLogic.Buffs.Blueprints; using Kingmaker.UnitLogic.FactLogic; @@ -61,9 +62,35 @@ static void Postfix() BuildHavocDragonClasses(); RemoveUnneededElements(); AddFlagsToAivu(); + FixHeroismAuraSFX(); } + private static void FixHeroismAuraSFX() + { + + var auraSource = Resources.GetBlueprint("17831f3fa25cf52458a34b0acc034b40"); + var aoe = Resources.GetBlueprint("ce6652b6fb8d1504181a9f3e2aa520e3"); + var baseHeroism = Resources.GetBlueprint("87ab2fed7feaaff47b62a3320a57ad8d"); + auraSource.FxOnStart = auraSource.FxOnRemove; + var knockoff = Helpers.CreateBlueprint("AivuHeroismBuff", x=> { + x.m_Flags = baseHeroism.m_Flags; + x.m_DisplayName = baseHeroism.m_DisplayName; + x.m_Description = baseHeroism.m_Description; + x.m_DescriptionShort = baseHeroism.m_DescriptionShort; + x.m_Icon = baseHeroism.m_Icon; + x.Components = baseHeroism.Components; + + }); + var applier = aoe.Components.OfType().FirstOrDefault(); + + if (applier != null) + { + + applier.m_Buff = knockoff.ToReference(); + } + } + private static void AddFlagsToAivu() { BlueprintUnit AivuUnitLoaded = Resources.GetBlueprint("32a037e97c3d5c54b85da8f639616c57"); @@ -71,8 +98,8 @@ private static void AddFlagsToAivu() AivuUnitLoaded.m_AddFacts = AivuUnitLoaded.m_AddFacts.AddToArray(AivuUsesMythixXPNew.ToReference()); - - AivuUnitLoaded.RemoveComponents(); + + AivuUnitLoaded.RemoveComponents(x=>x.m_SlotType == LockEquipmentSlot.SlotType.Armor); @@ -453,7 +480,8 @@ void AddToClasslLevelEntry(BlueprintProgression progression, int level, Blueprin AddToClasslLevelEntry(HavocDragonProgressionAdded, 17, AivuDragonfear); AddToClasslLevelEntry(HavocDragonProgressionAdded, 18, AzataDragonDR1); //AddToClasslLevelEntry(HavocDragonT2ProgressionAdded, 6, AivuSizeUpToLarge); - AddToClasslLevelEntry(HavocDragonT2ProgressionAdded, 7, HeroicAura); + AddToClasslLevelEntry(HavocDragonProgressionAdded, 6, HeroicAura); + // AddToClasslLevelEntry(HavocDragonT2ProgressionAdded, 7, HeroicAura); AddToClasslLevelEntry(HavocDragonT2ProgressionAdded, 8, AzataDragonDR2); diff --git a/LevelableAivu/FinishingTouches.cs b/LevelableAivu/FinishingTouches.cs index b0e1cca..1db122f 100644 --- a/LevelableAivu/FinishingTouches.cs +++ b/LevelableAivu/FinishingTouches.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using Kingmaker.Assets.UnitLogic.Mechanics.Properties; using Kingmaker.Blueprints; using Kingmaker.Blueprints.Classes; using Kingmaker.Blueprints.Classes.Prerequisites; @@ -9,6 +10,8 @@ using Kingmaker.UI.MVVM._VM.CharGen; using Kingmaker.UnitLogic.Abilities.Blueprints; using Kingmaker.UnitLogic.Class.LevelUp; +using Kingmaker.UnitLogic.Mechanics.Properties; +using Kingmaker.Utility; using LevelableAivu.Config; using System; using System.Collections.Generic; @@ -34,12 +37,32 @@ static void Postfix() { AlterSpellBook(); AlterCompanionClasses(); - //AlterBarding(); + AlterBarding(); + FixDestructiveDispel(); } + } + + private static void FixDestructiveDispel() + { + BlueprintCharacterClass HavocDragonAdded = Resources.GetModBlueprint("HavocDragonClass"); + BlueprintCharacterClass HavocDragon2Added = Resources.GetModBlueprint("HavocDragonClass20To40"); + var dispelProp = Resources.GetBlueprint("13e4f1dd08954723b173335a54b48746"); + var attributeProp = dispelProp.Components.OfType().FirstOrDefault(); + if (attributeProp != null) + { + attributeProp.m_Classes = attributeProp.m_Classes.AddItem(HavocDragonAdded.ToReference()).ToArray(); + } + var levelProp = dispelProp.Components.OfType().FirstOrDefault(); + if (levelProp != null) + { + levelProp.m_Class = levelProp.m_Class.AddItem(HavocDragonAdded.ToReference()).ToArray(); + levelProp.m_Class = levelProp.m_Class.AddItem(HavocDragon2Added.ToReference()).ToArray(); + } + } private static void AlterCompanionClasses() @@ -117,8 +140,7 @@ static void AlterSpellBook() static void AlterBarding() { - if (ModSettings.Settings.settings.IsDisabled("BardingForAivu")) - return; + BlueprintCharacterClass HavocDragonAdded = Resources.GetModBlueprint("HavocDragonClass"); diff --git a/LevelableAivu/Info.json b/LevelableAivu/Info.json index 1ed4f48..d630378 100644 --- a/LevelableAivu/Info.json +++ b/LevelableAivu/Info.json @@ -2,7 +2,7 @@ "Id": "LevelableAivu", "DisplayName": "Levelable Aivu", "Author": "pheonix99", - "Version": "1.1.0", + "Version": "1.2.0", "ManagerVersion": "0.21.3", "Requirements": [], "AssemblyName": "LevelableAivu.dll", diff --git a/LevelableAivu/LevelableAivu.csproj b/LevelableAivu/LevelableAivu.csproj index 7fd53a1..a048883 100644 --- a/LevelableAivu/LevelableAivu.csproj +++ b/LevelableAivu/LevelableAivu.csproj @@ -114,7 +114,7 @@ - + diff --git a/LevelableAivu/ModifyEquipmentRestrictions.cs b/LevelableAivu/ModifyEquipmentRestrictions.cs deleted file mode 100644 index 7c0c1a0..0000000 --- a/LevelableAivu/ModifyEquipmentRestrictions.cs +++ /dev/null @@ -1,40 +0,0 @@ -using HarmonyLib; -using Kingmaker.Blueprints; -using Kingmaker.Blueprints.Classes; -using Kingmaker.Blueprints.Items.Armors; -using Kingmaker.Blueprints.Items.Components; -using Kingmaker.Blueprints.Items.Equipment; -using Kingmaker.UnitLogic; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace LevelableAivu -{ - - [HarmonyPatch(typeof(EquipmentRestrictionClass), "CanBeEquippedBy", new Type[] { typeof(UnitDescriptor) })] - static class ModifyEquipmentRestrictions - { - - - static void Postfix(ref bool __result, EquipmentRestrictionClass __instance, UnitDescriptor unit) - { - BlueprintCharacterClass companion = Helpers.GetBlueprint("26b10d4340839004f960f9816f6109fe"); - BlueprintFeature AivuUsesMythicXPNow = Resources.GetModBlueprint("AivuUsesMythicXP"); - if (__instance.OwnerBlueprint is BlueprintItemEquipment f) - { - if (unit.HasFact(AivuUsesMythicXPNow))//This is Aivu - { - - if (__instance.Class.ToReference().Equals(companion.ToReference())) - { - __result = !__instance.Not; - } - } - } - - } - } -} diff --git a/LevelableAivu/ModifyEquipmentRestrictionsHasAnyClassFromList.cs b/LevelableAivu/ModifyEquipmentRestrictionsHasAnyClassFromList.cs new file mode 100644 index 0000000..e21bd5b --- /dev/null +++ b/LevelableAivu/ModifyEquipmentRestrictionsHasAnyClassFromList.cs @@ -0,0 +1,65 @@ +using HarmonyLib; +using Kingmaker.Blueprints; +using Kingmaker.Blueprints.Classes; +using Kingmaker.Blueprints.Items.Armors; +using Kingmaker.Blueprints.Items.Components; +using Kingmaker.Blueprints.Items.Equipment; +using Kingmaker.UnitLogic; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LevelableAivu +{ + [HarmonyPatch(typeof(EquipmentRestrictionClass), "CanBeEquippedBy", new Type[] { typeof(UnitDescriptor) })] + static class ModifyEquipmentRestrictions + { + static void Postfix(ref bool __result, EquipmentRestrictionClass __instance, UnitDescriptor unit) + { + BlueprintCharacterClass companion = Helpers.GetBlueprint("01a754e7c1b7c5946ba895a5ff0faffc"); + BlueprintFeature AivuUsesMythicXPNow = Resources.GetModBlueprint("AivuUsesMythicXP"); + if (__instance.OwnerBlueprint is BlueprintItemEquipment or BlueprintItemArmor) + { + if (unit.HasFact(AivuUsesMythicXPNow))//This is Aivuz + { + + if (__instance.Class.ToReference().Equals(companion.ToReference())) + { + __result = !__instance.Not; + } + } + } + + } + } + + + + + [HarmonyPatch(typeof(EquipmentRestrictionHasAnyClassFromList), "CanBeEquippedBy", new Type[] { typeof(UnitDescriptor) })] + static class ModifyEquipmentRestrictionsHasAnyClassFromList + { + + + static void Postfix(ref bool __result, EquipmentRestrictionHasAnyClassFromList __instance, UnitDescriptor unit) + { + var dragon = Helpers.GetBlueprint("01a754e7c1b7c5946ba895a5ff0faffc").ToReference (); + + BlueprintFeature AivuUsesMythicXPNow = Resources.GetModBlueprint("AivuUsesMythicXP"); + if (__instance.OwnerBlueprint is BlueprintItemEquipment or BlueprintItemArmor) + { + if (unit.HasFact(AivuUsesMythicXPNow))//This is Aivu + { + + if (__instance.Classes.Any(x=>x.ToReference().Equals(dragon))) + { + __result = !__instance.Not; + } + } + } + + } + } +} diff --git a/Readme.md b/Readme.md index 89f02a1..913f840 100644 --- a/Readme.md +++ b/Readme.md @@ -3,15 +3,15 @@ What it does: You can now pick what feats and spells Aivu takes on levelup. Aivu can now equip animal companion specific items if other requirements are met. - +Fixes the SFX spam on the heroism aura. Optional Components: Aivu's spell list includes the bard list per TT havoc dragons. Installation and Compatability considerations: -You will need to respec immediately if you are already an Azata - ideally respec, save before re-picking Azata, install, then pick Azata. -I have made no attempt to account for an existing Aivu on install. +You will need to respec to make use of this mod if you are already an Azata. +An existing Aivu will not benefit from the mod's features and may encounter issues. Any mod that alters any portion of Aivu's existing progression will be non-functional and may break things - I deep-sixed all of that in the process of making this. New items and spells should work just fine. @@ -22,6 +22,7 @@ Aivu was already really powerful, being essentially party member number seven. B Known Display issues: The spell access line in the progression shows level 7/8/9 access starting at level 15. Works fine in practice, ignore. +There may be spurrious heroism buff icons in on the character selection box at the bottom - some kind of side effect of the heroism fx fix. Permissions: Feel free to borrow the code and integrate into your own mod, just give me a shoutout.