User:BryghtShadow/delay

This template is used to calculate the hidden attack delay from visible attack speed values and visible increase per level percentage.

Calculations

 * Note that all calculations rely on the formula provided at attack speed: as_base = 0.625 / (1 + attack_delay )

To calculate attack speed at a particular level:
 * as_base = 0.625 / (1 + attack_delay ) * (1 + as_lvl / 100 * ( lvl - 1))

To calculate attack delay at a particular level:
 * attack_delay = 0.625 / as_base * (1 + as_lvl / 100 * ( lvl - 1))) - 1

Discrepancy
Displayed attack_speed values are rounded to 3 decimal places, and attack_delay value obtained from a single level becomes erroneous. As an example, Ahri's values (V3.7) are:
 * as_base1 = 0.668
 * as_lvl = 2
 * attack_delay via as_base1 = (0.625 / 0.668 - 1) =


 * Note:
 * Expected column holds values we expected to calculate; actual column holds values we actually calculated.
 * Expected values above were obtained from in-game, but there is always the possibility of human error during data input.

Increasing accuracy
To increase the accuracy of calculations for attack_speed, we look for a more accurate attack_delay value. To do this, we find the arithmetic mean of attack_delay at all 18 levels.

This results in calculation of as opposed to the value calculated earlier
 * attack_delay =
 * attack_delay using as_base1 = (0.625 / 0.668 - 1) =

To see just how accurate it is, we compare it to the expected values at each level.

Using live data
Values shown here rely on live data used on the wiki.

Result:

Conversion between as_base and attack_delay
 Let X be the level, such that 1 <= X <= 18; S be the speed at level X;   D be the hidden "attack_delay" constant; P be the speed increase per level constant, shown as (+P% per level) ---

S          = (0.625 / (1 + D) * (1 + P / 100 * (X - 1))    ) S * (1 + D) = (0.625          * (1 + P / 100 * (X - 1))    ) 1 + D = (0.625           * (1 + P / 100 * (X - 1)) / S)         D  = (0.625           * (1 + P / 100 * (X - 1)) / S) - 1