Improve EHP overkill approximation, especially for MoM #7568
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the problem being solved:
I was seeing strange breakpoints in my EHP. Normally, increasing my spell block chance by 1% would increase my EHP by <1%, but at certain breakpoints, a 1% spell block increase would cause an 8.8% EHP increase.
Checking the breakdown, I saw that my "mitigated hits" went from 5.99 to 6.52 at this spurious breakpoint.
Examining the function
numberOfHitsToDie
, specifically the part that adds back overkill as a fractional number of hits, I found the reason for this. The correction it performs is:where
poolTable.Life
is the negative amount of life after the overkill, anddamageTotal
is the total damage of the last hit.However, my character has 50% MoM and significantly more mana than life. Therefore, on the overkill hit, 50% of the damage goes to mana. Now supposing I have almost 0 life right before the overkill hit,
poolTable.Life / damageTotal
would be roughly-0.50
, which is not correct. The intended correction should be closer to-1
.So with my 50% MoM setup, under the current calculation, the # of mitigated hits will never be able to have a fractional part between 0 and 0.5, which is clearly wrong. I will keep seeing these spurious breakpoints - the # of mitigated hits will jump from 5.99 to 6.5, then increase smoothly to 6.99 before it jumps to 7.5, etc.
My PR changes this correction to instead be:
This is still an approximation and not fully accurate, but it should be a lot better than the previous calculation.
Steps taken to verify a working solution:
Link to a build that showcases this PR:
https://pobb.in/lHDoriHjsnvz
In custom modifiers I have: +5% chance to block spell damage
Before the fix, changing this to +6% triggers the spurious breakpoint (mitigated hits 5.99 -> 6.52, EHP 88085 -> 95910)
Before screenshot:
With

+5% chance to block spell damage
:With

+6% chance to block spell damage
:After screenshot:
With

+5% chance to block spell damage
:With

+6% chance to block spell damage
: