From c239aadfaf53062696e1a18613849f27e7ab6e2c Mon Sep 17 00:00:00 2001 From: xeals Date: Thu, 27 Apr 2023 11:17:22 +1000 Subject: [PATCH] fix ID lookup for pre-validation --- calc.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/calc.js b/calc.js index 26dd802..87332d2 100644 --- a/calc.js +++ b/calc.js @@ -1,5 +1,6 @@ import { calculate, + toID, Field, Generations, Move, @@ -266,11 +267,11 @@ function parseAndCalculate(line) { } // Pre-checking before the calculator throws unreadable errors. - if (!gen.species.get(attacker.toLowerCase())) + if (!gen.species.get(toID(attacker))) throw Error(`No species named ${attacker}`); - if (!gen.species.get(defender.toLowerCase())) + if (!gen.species.get(toID(defender))) throw Error(`No species named ${defender}`); - if (!gen.moves.get(move.toLowerCase())) throw Error(`No move named ${move}`); + if (!gen.moves.get(toID(move))) throw Error(`No move named ${move}`); return calculate( gen,