From 1bf2a725c996fd4378322d94936992355dced8ee Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sat, 6 Apr 2024 01:36:20 -0400 Subject: [PATCH] Fix softlock with double battle fainting --- src/battle-scene.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 52677b599..ac3687669 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1,6 +1,6 @@ import Phaser from 'phaser'; import UI, { Mode } from './ui/ui'; -import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, TurnInitPhase, ReturnPhase, LevelCapPhase, ShowTrainerPhase, LoginPhase, MovePhase, TitlePhase } from './phases'; +import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, TurnInitPhase, ReturnPhase, LevelCapPhase, ShowTrainerPhase, LoginPhase, MovePhase, TitlePhase, SwitchPhase } from './phases'; import Pokemon, { PlayerPokemon, EnemyPokemon } from './field/pokemon'; import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies } from './data/pokemon-species'; import * as Utils from './utils'; @@ -710,6 +710,9 @@ export default class BattleScene extends SceneBase { const lastBattle = this.currentBattle; + if (lastBattle?.double && !newDouble) + this.tryRemovePhase(p => p instanceof SwitchPhase); + const maxExpLevel = this.getMaxExpLevel(); this.lastEnemyTrainer = lastBattle?.trainer ?? null;