Skip to content

Commit

Permalink
fix Domain Nature not getting a cantrip offered at level 4
Browse files Browse the repository at this point in the history
  • Loading branch information
ThyWoof committed May 27, 2024
1 parent 4132300 commit 8e2ffe9
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions SolastaUnfinishedBusiness/Subclasses/DomainNature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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") + ": ";
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -231,7 +253,7 @@ public DomainNature()

// MAIN

Subclass = CharacterSubclassDefinitionBuilder
_domainNature = CharacterSubclassDefinitionBuilder
.Create(Name)
.SetGuiPresentation(Category.Subclass, CharacterSubclassDefinitions.TraditionGreenmage)
.AddFeaturesAtLevel(1,
Expand All @@ -242,6 +264,8 @@ public DomainNature()
.AddFeaturesAtLevel(10, PowerClericDivineInterventionWizard)
.AddFeaturesAtLevel(17, featureSetMasterOfNature)
.AddToDB();

Subclass = _domainNature;
}

internal override CharacterClassDefinition Klass => CharacterClassDefinitions.Cleric;
Expand All @@ -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);
}
}

Expand Down

0 comments on commit 8e2ffe9

Please sign in to comment.