smogon / damage-calc

Pokemon games damage calculator
https://calc.pokemonshowdown.com
MIT License
397 stars 367 forks source link

IVs of 0 are read as 31 by correctHiddenPower #663

Open ctl2 opened 4 weeks ago

ctl2 commented 4 weeks ago

This line doesn't differentiate between IV values of 0 and undefined https://github.com/smogon/damage-calc/blob/81f2e785da80b10d190c55cf6b3f94bcd0a4855e/src/js/shared_controls.js#L963

This is an issue for any pre gen 7 set with hidden power in its moveset & 1 or more IVs of 0. The gen 5 Bronzong (OU Tank) set should have a speed IV of 0, but gets assigned 31 instead (which has a big effect on its gyro ball damage).

Can be fixed by changing the line's || to ??.

ctl2 commented 4 weeks ago

also, nbd but I think the for loop's condition should be < rather than <= https://github.com/smogon/damage-calc/blob/81f2e785da80b10d190c55cf6b3f94bcd0a4855e/src/js/shared_controls.js#L961