magey / wotlk-warrior

4 stars 0 forks source link

Avoidance DR is working incorrectly #17

Open magey opened 2 years ago

magey commented 2 years ago

WotLK introduced diminishing returns on the parry, dodge, and miss avoidance stats. The specifics of how these diminishing returns work and what is the formula to calculate them was the subject of a big research effort on EJ by Whitetooth that's documented here.

  • DR for Dodge, Parry, Missed are calculated separately.
  • Base avoidances are not affected by DR. (e.g. Dodge from base Agility, 5% base Parry, 5% base Missed)
  • Death Knight's Parry Rating from base Strength is affected by DR.
  • Direct percentage gains from talents and spells are not affected by DR. (e.g. 5% Dodge from talents, 4% Parry to weapon, 25 Defense to weapon)
  • $\large c$ and $\large k$ values depend on class but does not change with level.

The DR formula:

$\Huge\frac{1}{x'} = \frac{1}{c} + \frac{k}{x}$

$\large x'$ is the diminished stat before converting to IEEE754 $\large x$ is the stat before diminishing returns $\large c$ is the cap of the stat, and changes with class $\large k$ is is a value that changes with class

He then gives a nice table that summarizes the $\large k$ , $\large C_p$ , $\large C_d$ , and $\large C_m$ values for all classes.


We[^contributors] went to test avoidance DR on the beta (build 44644) to see how accurate Whitetooth's formula and coefficients are, and to find any quirks in DR behavior. We used the exact same race / class / gear/ talent combination and attacked the same target on all the collected logs so that we can easily combine the data.

We used a level 70 Orc DK template and were attacked by a level 57 Servant of Razelikh. Due to the natural weapon skill / defense difference we had an additional (70*5 - 57*5) * 0.04% = 2.6% to parry, dodge, and chance to be missed that is not diminished by the DR formula. Fully geared the character had:

The breakdown and summary of these stats in table form (note that only the Bonus column is subject to diminishing return):

Base Level Bonus Total
Miss 5.00% 2.60% 5.88% 13.48%
Dodge 5.94% 2.60% 10.05% 18.59%
Parry 5.00% 2.60% 9.92% 17.52%

This is verified by the character sheet (note these screenshots naturally do not include the 2.60% from level difference):

image

Calculating the diminished values of these stats with Whitetooth's formula:[^precision]

$\large k = 0.956$ $\large C_m = 16$ $\large C_d = 88.129021$ $\large C_p = 47.003525$

$\Huge Miss_{DR} = \frac{1}{16} + \frac{0.956}{5.88\%} = \frac{1}{0.225085} = 4.442765\%$

$\Huge Dodge_{DR} = \frac{1}{88.129021} + \frac{0.956}{10.05\%} = \frac{1}{0.106471} = 9.392196\%$

$\Huge Parry_{DR} = \frac{1}{47.003525} + \frac{0.956}{9.92\%} = \frac{1}{0.117646} = 8.500079\%$

Using these diminished values in place of the raw bonus values from the table above, our expected avoidance values from the test are:

And finally our test results from combined logs of 17572 incoming attacks:

Outcome Chance 95% CI Count
Miss 13.52% ±0.51% 2375
Dodge 18.35% ±0.57% 3225
Parry 17.69% ±0.56% 3108
Hit 50.44% ±0.74% 8864

As this table demonstrates, avoidance DR simply isn't working at all; our measured values are within error margin of our raw total values and nowhere near the diminished values.

[^contributors]: Thanks to Char, deance, and Kilo for helping collect data for this test [^precision]: Rounded to 6 decimal digits for easy reading

magey commented 2 years ago

Testing on build 44930 it looks like avoidance DR has been implemented but now this mechanism has other critical bugs.

First let's cover what works correctly. If you only have defense rating from gear and no parry/dodge rating at all (so this can't be tested on a DK) then the character sheet total avoidance stats shown under the 'Defenses' tab and the values returned from APIs like GetParryChance() and GetDodgeChance() give the diminished values for dodge/parry, and the values are correct and match Whitetooth's formula. Indeed, this is how it worked in original WotLK and is how they collected all the data points back then to estimate the formula by using regression analysis.

Once you add parry/dodge rating into the mix things go horribly wrong, though. Let's take parry rating as an example, although dodge rating has the same problem. I ran a little experiment on my warrior that has 10% naked parry chance (5% base + 5% from Deflection); starting with a naked character, I incrementally equipped more and more gear with defense bonuses and documented the expected vs. in-game total parry chance. For the last 3 pieces of gear I equipped gear with parry rating on it as well. The experiment is summarized below, where the Total expected column is calculated as 10% + TotalBonusDR and Total bonus (DR) is calculated per the formula above:

Rating Rating Bonus Defense Total bonus Total bonus (DR) Total expected Total actual Base + BonusDR + RatingBonus
0 0.00% 400 0.00% 0.00% 10.00% 10.00% 10.00%
0 0.00% 411 0.44% 0.46% 10.46% 10.46% 10.46%
0 0.00% 421 0.84% 0.86% 10.86% 10.86% 10.86%
0 0.00% 437 1.48% 1.50% 11.50% 11.50% 11.50%
0 0.00% 445 1.80% 1.81% 11.81% 11.81% 11.81%
0 0.00% 451 2.04% 2.04% 12.04% 12.04% 12.04%
0 0.00% 458 2.32% 2.31% 12.31% 12.31% 12.31%
0 0.00% 470 2.80% 2.76% 12.76% 12.76% 12.76%
0 0.00% 479 3.16% 3.09% 13.09% 13.09% 13.09%
0 0.00% 484 3.36% 3.27% 13.27% 13.27% 13.27%
0 0.00% 491 3.64% 3.52% 13.52% 13.52% 13.52%
0 0.00% 497 3.88% 3.74% 13.74% 13.74% 13.74%
0 0.00% 501 4.04% 3.88% 13.88% 13.88% 13.88%
40 0.88% 509 5.24% 4.91% 14.91% 15.80% 15.79%
96 2.12% 519 6.88% 6.24% 16.24% 18.36% 18.36%
145 3.20% 525 8.20% 7.25% 17.25% 20.46% 20.45%

As can be seen in the table, the numbers match up exactly until we start adding parry rating. Once we do that, the total value given in-game by the character sheet and the APIs seems to be 10% + TotalBonusDR + RatingBonus, meaning we are gaining parry from rating twice - once correctly using the total diminished value of total parry from defense and rating, and once again using the un-diminished value of parry from rating only.

I also performed a test for dodge rating and the results were similar.

magey commented 2 years ago

Char ran a test to measure the actual avoidance values experienced in combat. He used a level 80 Orc DK template and was attacked by level 57 Servants of Razelikh. Due to the natural weapon skill / defense difference he had an additional (80*5 - 57*5) * 0.04% = 4.6% to parry, dodge, and chance to be missed that is not diminished by the DR formula. Fully geared the character had:

Summarized, with Total (DR) being the expected diminished value calculated using Whitetooth's formula:

Base Level Bonus Total Total (DR)
Miss 5.00% 4.60% 4.96% 14.56% ~13.52%
Dodge 4.95% 4.60% 8.45% 18.00% ~17.58%
Parry 5.00% 4.60% 9.92% 17.52% ~19.78%

Note that these values are the theoretically correct values assuming the beta has no bugs - the actual character sheet and API values reported in-game for dodge and parry were incorrect as per the post above this one. The game reported 16.48% dodge and 22.65% parry respectively, which would make the diminished totals with the level difference added 21.08% dodge and 27.25% parry.

And the results of the test logging 18775 incoming attacks:

Outcome Chance 95% CI Count
Miss 13.67% ±0.49% 2566
Dodge 20.90% ±0.58% 3924
Parry 19.87% ±0.57% 3731
Hit 45.56% ±0.71% 8554

Looking at these results, we can see that the values measured for miss and parry actually behave correctly and match our expected values, even though the game reports incorrect values for parry. With dodge, the story is different; the value measured actually matches the incorrect value reported by the game - 20.90% ±0.58% measured vs. 21.08% as calculated above.

In summary, it looks like parry is only bugged on the client but dodge is bugged both on the client and the server.

magey commented 2 years ago

Character sheet values and tooltips appear to be fixed in build 45327 so Char and I ran some more tests. The setup was as follows:

Summarized, with Total (DR) being the expected diminished value calculated using Whitetooth's formula:

Base Level Bonus Total Total (DR)
Miss 5.00% 4.60% 4.32% 13.92% ~13.12%
Dodge 4.95% 4.60% 6.97% 16.52% ~16.28%
Parry 5.00% 4.60% 11.57% 21.17% ~19.22%

And the results of the test logging 23003 incoming attacks:

Outcome Chance 95% CI Count
Miss 13.27% ±0.44% 3053
Dodge 18.72% ±0.50% 4306
Parry 19.01% ±0.51% 4373
Hit 49.00% ±0.65% 11271

In conclusion, it looks like dodge DR is still bugged and the value we measured here (18.72% ±0.50%) is the same wrong value from before, where we are gaining our undiminished bonus from dodge rating in addition to the total DR'd dodge - 16.28% + 2.65% = 18.93%.

CharWS commented 1 year ago

Will do a retest after next reset but should hopefully be fixed https://us.forums.blizzard.com/en/wow/t/dodge-bugfix-and-algalon-tuning/1558852