So, here is how the algorithm is supposed to work:
A status effect, once applied, has two values, potency (P) and duration (D). An effect can be expressed like this: poison(0.5,1.0) for a poison with P=0.5 that lasts for 1 second.
"Potency" is interpreted in different ways depending on the effect. For chill, it slows enemies down. For poison, it's a multiplier against the associated attack damage (an attack that deals 10 damage, with poison(0.1,5), will deal 1 additional damage every second for five seconds). For bleed, it's how much extra damage they take. So bleed (1.05,5.0) means +5% damage from all incoming attacks for 5 seconds.
So, let's say Slak hits an enemy with bleed(1.05,5) and then Conan (generic berserker) hits an enemy with bleed (1.10,3). How are these combined?
Well, first we convert both values to (potency)x(duration):
Slak: 1.05 x 5 = 5.25 PD
Conan: 1.10 x 3 = 3.30 PD
Then we sum the PD values:
5.25 + 3.30 = 8.55 PD
Then, we match the highest potency of the two effects and convert the PD back into potency and duration:
Potency = 1.10
Duration = (8.55) / 1.10 = 7.77
So Slak's weaker bleed was converted into extra duration for Conan's stronger bleed. I decided to favor potency rather than duration because if we matched the longest duration then status effects could dilute one another - you'd still get the same DOT, but it would lead to weird situations where a "weaker" slow would cause the enemy to actually speed up.
At any rate, something is clearly broken as status effects are cancelling each other, diluting, or otherwise not stacking as intended. Anyone got any cases for me where the behavior is weird and not what it should be? I can figure out the code problem once I have some solid bugs to look at. I'm discussing this here rather than just in the bug forum because I'm wondering if there's some hidden "gotcha" in my algorithm I'm not considering and it seems like a pretty fundamental gameplay issue.
Basically, my goals for status effects are this:
- Players should never have to worry about status effects interacting (other than obvious intentional stuff like fire/ice)
- Should always help the player, or at least not hurt the player
- Shouldn't give a "strange" result even if the mathematics is "right" (ie, an additional slow causing an enemy to speed up)
- Shoudn't lead to easy exploits through exponential stacking
