Fix softlock with double battle fainting

This commit is contained in:
Flashfyre 2024-04-06 01:36:20 -04:00
parent 7fc4dbce85
commit 1bf2a725c9

View File

@ -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;