From 5d6181926a49e995d071f0b314971ca0662416a6 Mon Sep 17 00:00:00 2001 From: Benjamin Odom Date: Fri, 3 May 2024 21:09:08 -0500 Subject: [PATCH] Removed Hardcoded Values Realized there was an enum for the -1 value which should help clear up confusion if someone has to mess with this code later --- src/field/pokemon.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 05340344a..adbe8a8d8 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2737,8 +2737,8 @@ export class EnemyPokemon extends Pokemon { let targetScores: integer[] = []; for (let mt of moveTargets[move.id]) { - // Prevent a target score from being calculated when there isn't a target - if (mt === -1) + // Prevent a target score from being calculated when the target is whoever attacks the user + if (mt === BattlerIndex.ATTACKER) break; const target = this.scene.getField()[mt]; @@ -2812,10 +2812,10 @@ export class EnemyPokemon extends Pokemon { }); if (!sortedBenefitScores.length) { - // Set target to -1 when using a counter move + // Set target to BattlerIndex.ATTACKER when using a counter move // This is the same as when the player does so if (!!move.findAttr(attr => attr instanceof CounterDamageAttr)) - return [-1]; + return [BattlerIndex.ATTACKER]; return []; }