risk-of-thunder / R2API

A modding API for Risk of Rain 2
https://thunderstore.io/package/tristanmcpherson/R2API/
MIT License
134 stars 55 forks source link

attackSpeedReductionMultAdd for RecalculateStatsAPI #462

Closed Priscillalala closed 1 year ago

Priscillalala commented 1 year ago

Try saying that five times fast..Implements #406. An attack speed reduction value exists in vanilla exclusively for Light Flux Pauldron. Works the same as moveSpeedReductionMultAdd where ATTACK_SPEED ~ (BASE_ATTACK_SPEED + baseAttackSpeedAdd) * (ATTACK_SPEED_MULT + attackSpeedMultAdd) / (ATTACK_SPEED_REDUCTION_MULT + attackSpeedReductionMultAdd). Seems to perform as expected through basic testing.

Priscillalala commented 1 year ago

Do we really need to try and enforce this? Any division by zero would likely be a result of user error, nobody should be subtracting from this value. We would then probably want to enforce this on move speed reduction as well, and need to refactor that IL hook

yekoc commented 1 year ago

There is no indication in the public api or documentation that the user can cause it to throw a DivideByZeroException, and since we can't do unsigned floats I'd recommend sticking something in there just in case. Thus,something similar is also needed for the movement hook,indeed.