Skip to content

Commit

Permalink
Armor fix, killed sfx spam on heroism aura, fixed (I think) destructi…
Browse files Browse the repository at this point in the history
…ve dispel behaviour
  • Loading branch information
pheonix99 committed Mar 20, 2022
1 parent bc59a93 commit f331d2e
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 57 deletions.
3 changes: 2 additions & 1 deletion LevelableAivu/Config/Blueprints.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}
Expand Down
2 changes: 1 addition & 1 deletion LevelableAivu/Config/ModSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void LoadAllSettings()
{
LoadSettings("Settings.json", ref Settings);
LoadSettings("Blueprints.json", ref Blueprints);
LoadLocalization();
LoadLocalization();
}

public static void LoadLocalization()
Expand Down
4 changes: 0 additions & 4 deletions LevelableAivu/Config/Settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

}
Expand Down
34 changes: 31 additions & 3 deletions LevelableAivu/CreateHavocDragonClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -61,18 +62,44 @@ static void Postfix()
BuildHavocDragonClasses();
RemoveUnneededElements();
AddFlagsToAivu();
FixHeroismAuraSFX();

}

private static void FixHeroismAuraSFX()
{

var auraSource = Resources.GetBlueprint<BlueprintBuff>("17831f3fa25cf52458a34b0acc034b40");
var aoe = Resources.GetBlueprint<BlueprintAbilityAreaEffect>("ce6652b6fb8d1504181a9f3e2aa520e3");
var baseHeroism = Resources.GetBlueprint<BlueprintBuff>("87ab2fed7feaaff47b62a3320a57ad8d");
auraSource.FxOnStart = auraSource.FxOnRemove;
var knockoff = Helpers.CreateBlueprint<BlueprintBuff>("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<AbilityAreaEffectBuff>().FirstOrDefault();

if (applier != null)
{

applier.m_Buff = knockoff.ToReference<BlueprintBuffReference>();
}
}

private static void AddFlagsToAivu()
{
BlueprintUnit AivuUnitLoaded = Resources.GetBlueprint<BlueprintUnit>("32a037e97c3d5c54b85da8f639616c57");



AivuUnitLoaded.m_AddFacts = AivuUnitLoaded.m_AddFacts.AddToArray(AivuUsesMythixXPNew.ToReference<BlueprintUnitFactReference>());

AivuUnitLoaded.RemoveComponents<LockEquipmentSlot>();
AivuUnitLoaded.RemoveComponents<LockEquipmentSlot>(x=>x.m_SlotType == LockEquipmentSlot.SlotType.Armor);



Expand Down Expand Up @@ -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);


Expand Down
28 changes: 25 additions & 3 deletions LevelableAivu/FinishingTouches.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using HarmonyLib;
using Kingmaker.Assets.UnitLogic.Mechanics.Properties;
using Kingmaker.Blueprints;
using Kingmaker.Blueprints.Classes;
using Kingmaker.Blueprints.Classes.Prerequisites;
Expand All @@ -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;
Expand All @@ -34,12 +37,32 @@ static void Postfix()
{
AlterSpellBook();
AlterCompanionClasses();
//AlterBarding();
AlterBarding();
FixDestructiveDispel();
}




}

private static void FixDestructiveDispel()
{
BlueprintCharacterClass HavocDragonAdded = Resources.GetModBlueprint<BlueprintCharacterClass>("HavocDragonClass");
BlueprintCharacterClass HavocDragon2Added = Resources.GetModBlueprint<BlueprintCharacterClass>("HavocDragonClass20To40");
var dispelProp = Resources.GetBlueprint<BlueprintUnitProperty>("13e4f1dd08954723b173335a54b48746");
var attributeProp = dispelProp.Components.OfType<MaxCastingAttributeGetter>().FirstOrDefault();
if (attributeProp != null)
{
attributeProp.m_Classes = attributeProp.m_Classes.AddItem(HavocDragonAdded.ToReference<BlueprintCharacterClassReference>()).ToArray();
}
var levelProp = dispelProp.Components.OfType<SummClassLevelGetter>().FirstOrDefault();
if (levelProp != null)
{
levelProp.m_Class = levelProp.m_Class.AddItem(HavocDragonAdded.ToReference<BlueprintCharacterClassReference>()).ToArray();
levelProp.m_Class = levelProp.m_Class.AddItem(HavocDragon2Added.ToReference<BlueprintCharacterClassReference>()).ToArray();
}

}

private static void AlterCompanionClasses()
Expand Down Expand Up @@ -117,8 +140,7 @@ static void AlterSpellBook()

static void AlterBarding()
{
if (ModSettings.Settings.settings.IsDisabled("BardingForAivu"))
return;


BlueprintCharacterClass HavocDragonAdded = Resources.GetModBlueprint<BlueprintCharacterClass>("HavocDragonClass");

Expand Down
2 changes: 1 addition & 1 deletion LevelableAivu/Info.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion LevelableAivu/LevelableAivu.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<Compile Include="ExtensionMethods.cs" />
<Compile Include="Helpers.cs" />
<Compile Include="Main.cs" />
<Compile Include="ModifyEquipmentRestrictions.cs" />
<Compile Include="ModifyEquipmentRestrictionsHasAnyClassFromList.cs" />
<Compile Include="PatchTryLevelUpPet.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources.cs" />
Expand Down
40 changes: 0 additions & 40 deletions LevelableAivu/ModifyEquipmentRestrictions.cs

This file was deleted.

65 changes: 65 additions & 0 deletions LevelableAivu/ModifyEquipmentRestrictionsHasAnyClassFromList.cs
Original file line number Diff line number Diff line change
@@ -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<BlueprintCharacterClass>("01a754e7c1b7c5946ba895a5ff0faffc");
BlueprintFeature AivuUsesMythicXPNow = Resources.GetModBlueprint<BlueprintFeature>("AivuUsesMythicXP");
if (__instance.OwnerBlueprint is BlueprintItemEquipment or BlueprintItemArmor)
{
if (unit.HasFact(AivuUsesMythicXPNow))//This is Aivuz
{

if (__instance.Class.ToReference<BlueprintCharacterClassReference>().Equals(companion.ToReference<BlueprintCharacterClassReference>()))
{
__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<BlueprintCharacterClass>("01a754e7c1b7c5946ba895a5ff0faffc").ToReference<BlueprintCharacterClassReference> ();

BlueprintFeature AivuUsesMythicXPNow = Resources.GetModBlueprint<BlueprintFeature>("AivuUsesMythicXP");
if (__instance.OwnerBlueprint is BlueprintItemEquipment or BlueprintItemArmor)
{
if (unit.HasFact(AivuUsesMythicXPNow))//This is Aivu
{

if (__instance.Classes.Any(x=>x.ToReference<BlueprintCharacterClassReference>().Equals(dragon)))
{
__result = !__instance.Not;
}
}
}

}
}
}
7 changes: 4 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.

0 comments on commit f331d2e

Please sign in to comment.