Hello everyone!
I want to replace certain armor-based AttributeModifiers with health-based ones (specifically, HEALTH_MULT). Note: health_mult increases both active health and max health. It's very similar to armor bonuses in how it works.
For stances and formations, it works perfectly.
So, I change:
ModifierList FighterHordeStanceHoldGround Modifier = ARMOR 25% Modifier = DAMAGE_MULT 85% Modifier = VISION -90% End
To:
ModifierList FighterHordeStanceHoldGround Modifier = HEALTH_MULT 133% Modifier = DAMAGE_MULT 85% Modifier = VISION -90% End
OK, so far so good. I can toggle between difference stances/formations and the unit's health increases and decreases correctly.
However, if I do the same to buffs/leaderships such as Rallying Call, despite the health value being correctly adjusted upward, it doesn't reset after the buff wears off.
E.g. if my units move in and out the range of a Hero (or other leadership source) their health keeps increasing and increasing. Similarly, if I cast rallying call, wait till it wears off and cast it again, the target units' health will increase twice.
Because of that, I know the AttributeModifier wears off correctly. You can't have the same modifier active twice on one unit (example: you have to make unique AttrModifiers for each level-up, otherwise they won't stack). So somehow the modifier wears off, but the health isn't updated. That means I need to force units to periodically recalculate their health based on their base health and all active modifiers.
Perhaps anybody has encountered something similar.
Also noteworthy: re-spawned units will have correct health values. So, a horde with abnormally high health values due to multiple rallying call usages will respawn new units with normal health. So I have a horde mixed with units with different max health vals.
For anyone curious as to why I'm doing this:
Applying multiple armor bonuses on top of each other (stacking) results in insane bonuses.
E.g. if you have 3 modifiers active on 1 unit: 33%, 33% and 50%, the game somehow ends up adding them all together, resulting in 83%. This is capped at 75%. Consequently, this is subtracted from 100, resulting in 25% damage taken. That's equivalent to 400% armor....
I made a video to illustrate this: