fix single pokemon run away in double battle

This commit is contained in:
Matthew Olker 2024-05-24 21:16:27 -04:00
parent 623c05a3df
commit 840ac9f53f
1 changed files with 7 additions and 1 deletions

View File

@ -2161,7 +2161,13 @@ export class TurnStartPhase extends FieldPhase {
case Command.RUN: case Command.RUN:
let runningPokemon = pokemon; let runningPokemon = pokemon;
if (this.scene.currentBattle.double) { 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 only one pokemon is alive, use that one
if (playerActivePokemon.length > 1) { if (playerActivePokemon.length > 1) {
// find which active pokemon has faster speed // find which active pokemon has faster speed