ka-dyn / ExpandedContent

Seeking to expand and add to content in Pathfinder: Wrath of the Righteous
MIT License
41 stars 19 forks source link

Rage Stance Scaling #158

Closed Enkimdu closed 3 months ago

Enkimdu commented 3 months ago

I noticed lethal stance, and possibly other stances, scale with every class level. These include mythic levels and classes that have nothing to do with rage progression such as witch etc. For example a character with 4 Skald, 3 Warpriest, 2 mythic levels will provide 1 + (4 + 3 + 2)/2 == 3 AB instead of 2 with lethal stance.

I have been able to narrow it down to this function:

[HarmonyPatch(typeof(SummClassLevelGetter), nameof(SummClassLevelGetter.GetBaseValue))]
        static class SummClassGetterArchetypeFix {
            static void Postfix(SummClassLevelGetter __instance, UnitEntityData unit, ref int __result) {
                int num = 0;
                var archetypes = new BlueprintArchetypeReference[0];
                archetypes = archetypes.AppendToArray(__instance.m_Archetypes);
                archetypes = archetypes.AppendToArray(__instance.Archetype);
                foreach (ClassData data in unit.Descriptor.Progression.Classes) {//For each class you have
                    if (archetypes.Length > 0) {
                        if (archetypes.Any(archetype => data.CharacterClass.Archetypes.HasReference(archetype))) {//Is the choosen archetype in the BlueprintArchetypeReference list?
                            if (archetypes.Any(archetype => data.Archetypes.Contains(archetype))) {//If archetype matches add level, if not then ignore
                                num += data.Level;
                            } 
                        } else {
                            num += data.Level;
                        }
                    } else {
                        num += data.Level;
                    }
                }
                __result = num;
            }
        }

After deleting this part, lethal stance works as expected.

bittercranberry commented 3 months ago

ExpandedContent.zip I can't test it myself at the moment, could you try this for me please?

Enkimdu commented 3 months ago

I tested with all stances and they seem to be working as intended.

bittercranberry commented 3 months ago

Nice, I will release that in a update over the weekend after I have time to test it myself. Thanks for reporting this, I think I missed it in testing as I was to focused on getting the archetype stuff to work.

Will close ticket on the next update.