From 840ac9f53fa56230ea4f05bc0196a2939237032d Mon Sep 17 00:00:00 2001 From: Matthew Olker Date: Fri, 24 May 2024 21:16:27 -0400 Subject: [PATCH] fix single pokemon run away in double battle --- src/phases.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/phases.ts b/src/phases.ts index 84875921e00..231c9aacfa1 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2161,7 +2161,13 @@ export class TurnStartPhase extends FieldPhase { case Command.RUN: let runningPokemon = pokemon; if (this.scene.currentBattle.double) { - const playerActivePokemon = field.filter(pokemon => pokemon.isPlayer() && pokemon.isActive()); + const playerActivePokemon = field.filter(pokemon => { + if (!!pokemon) { + return pokemon.isPlayer() && pokemon.isActive(); + } else { + return; + } + }); // if only one pokemon is alive, use that one if (playerActivePokemon.length > 1) { // find which active pokemon has faster speed