From 8e2ffe90943231fc01b2decd7cb4b68c1219a3d4 Mon Sep 17 00:00:00 2001 From: ThyWolf Date: Mon, 27 May 2024 10:41:22 -0700 Subject: [PATCH] fix Domain Nature not getting a cantrip offered at level 4 --- .../Subclasses/DomainNature.cs | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/SolastaUnfinishedBusiness/Subclasses/DomainNature.cs b/SolastaUnfinishedBusiness/Subclasses/DomainNature.cs index 6f3d1031b5..1df51d95b8 100644 --- a/SolastaUnfinishedBusiness/Subclasses/DomainNature.cs +++ b/SolastaUnfinishedBusiness/Subclasses/DomainNature.cs @@ -10,6 +10,7 @@ using SolastaUnfinishedBusiness.Builders.Features; using SolastaUnfinishedBusiness.CustomUI; using SolastaUnfinishedBusiness.Interfaces; +using SolastaUnfinishedBusiness.Models; using SolastaUnfinishedBusiness.Properties; using static RuleDefinitions; using static SolastaUnfinishedBusiness.Api.DatabaseHelper; @@ -33,6 +34,9 @@ public sealed class DomainNature : AbstractSubclass DamageTypeThunder ]; + private static FeatureDefinitionCastSpell _castSpellDomainNature; + private static CharacterSubclassDefinition _domainNature; + public DomainNature() { var divinePowerPrefix = Gui.Localize("Feature/&ClericChannelDivinityTitle") + ": "; @@ -52,6 +56,22 @@ public DomainNature() // LEVEL 01 - Acolyte of Nature + var spellListDomainNature = SpellListDefinitionBuilder + .Create($"SpellList{Name}") + .SetGuiPresentationNoContent(true) + .FinalizeSpells() + .AddToDB(); + + //explicitly re-use druid spell list, so custom cantrips selected for druid will show here + spellListDomainNature.SpellsByLevel[0].Spells = SpellListDefinitions.SpellListDruid.SpellsByLevel[0].Spells; + + _castSpellDomainNature = FeatureDefinitionCastSpellBuilder + .Create(FeatureDefinitionCastSpells.CastSpellElfHigh, $"CastSpell{Name}") + .SetGuiPresentationNoContent(true) + .SetSpellCastingAbility(AttributeDefinitions.Wisdom) + .SetSpellList(spellListDomainNature) + .AddToDB(); + var pointPoolCantrip = FeatureDefinitionPointPoolBuilder .Create($"PointPool{Name}Cantrip") .SetGuiPresentationNoContent(true) @@ -82,6 +102,8 @@ public DomainNature() .AddFeatureSet(proficiencyHeavyArmor) .AddToDB(); + // cannot add cast spell here as for whatever reason game tries to offer cleric cantrips + // custom added later on GrantCantrip var featureSetAcolyteOfNature = FeatureDefinitionFeatureSetBuilder .Create($"FeatureSet{Name}AcolyteOfNature") .SetGuiPresentation(Category.Feature) @@ -231,7 +253,7 @@ public DomainNature() // MAIN - Subclass = CharacterSubclassDefinitionBuilder + _domainNature = CharacterSubclassDefinitionBuilder .Create(Name) .SetGuiPresentation(Category.Subclass, CharacterSubclassDefinitions.TraditionGreenmage) .AddFeaturesAtLevel(1, @@ -242,6 +264,8 @@ public DomainNature() .AddFeaturesAtLevel(10, PowerClericDivineInterventionWizard) .AddFeaturesAtLevel(17, featureSetMasterOfNature) .AddToDB(); + + Subclass = _domainNature; } internal override CharacterClassDefinition Klass => CharacterClassDefinitions.Cleric; @@ -263,9 +287,16 @@ internal static void GrantCantrip(RulesetCharacterHero hero) return; } + var selectedClass = LevelUpContext. GetSelectedClass(hero); + var selectedSubclass = LevelUpContext.GetSelectedSubclass(hero); + var subclassTag = AttributeDefinitions.GetSubclassTag(selectedClass, 1, selectedSubclass); + + hero.ActiveFeatures[subclassTag].Add(_castSpellDomainNature); + hero.GrantSpellRepertoire(_castSpellDomainNature, null, _domainNature, null); + foreach (var cantrip in cantrips) { - hero.GrantCantrip(cantrip, FeatureDefinitionCastSpells.CastSpellCleric); + hero.GrantCantrip(cantrip, _castSpellDomainNature); } }