fix ID lookup for pre-validation
This commit is contained in:
		
							
								
								
									
										7
									
								
								calc.js
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								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, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user