smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.74k stars 2.77k forks source link

Fix statcalc bug #10354

Closed titchcat closed 3 months ago

titchcat commented 3 months ago

Bug reported by Mathy here: https://www.smogon.com/forums/threads/statcalc-detecting-level-nan.3743957/

DaWoblefet commented 3 months ago

Ugh, I botched a rebase trying to fix the syntax error so I could merge. I'll get this fixed.

EDIT: doesn't look like I can because it was your master branch. If you can re-submit, that would be awesome. I apologize for making you do extra work. Here's the corrected code (you were just missing a closing bracket)


if (isNaN(level)) {
    return this.sendReplyBox('Invalid value for level: ' + Utils.escapeHTML(arg));
}
if (level < 1 || level > 9999) {
    return this.sendReplyBox('Level should be between 1 and 9999.');
}