From fda81ddac9b6643fd9d0ba932ff25042d25e484f Mon Sep 17 00:00:00 2001 From: Matthew Olker Date: Wed, 22 May 2024 11:30:00 -0400 Subject: [PATCH] fix comments --- src/phases.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index a04f31f4e83..542eac31bc8 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2052,11 +2052,11 @@ export class TurnStartPhase extends FieldPhase { case Command.RUN: let runningPokemon = pokemon; if (this.scene.currentBattle.double) { - const playerPokemon = field.filter(pokemon => pokemon.isPlayer()); - // use the faster stats if not - const fasterPokemon = playerPokemon[0].getStat(Stat.SPD) > playerPokemon[1].getStat(Stat.SPD) ? playerPokemon[0] : playerPokemon[1]; - // check if either active player pokemon has run away - const hasRunAway = playerPokemon.find(p => p.hasAbility(Abilities.RUN_AWAY)); + const playerActivePokemon = field.filter(pokemon => pokemon.isPlayer()); + // find which active pokemon has faster speed + const fasterPokemon = playerActivePokemon[0].getStat(Stat.SPD) > playerActivePokemon[1].getStat(Stat.SPD) ? playerActivePokemon[0] : playerActivePokemon[1]; + // check if either active pokemon has the ability "Run Away" + const hasRunAway = playerActivePokemon.find(p => p.hasAbility(Abilities.RUN_AWAY)); runningPokemon = hasRunAway !== undefined ? hasRunAway : fasterPokemon; } this.scene.unshiftPhase(new AttemptRunPhase(this.scene, runningPokemon.getFieldIndex()));