Fix softlock with double battle fainting

pull/45/head
Flashfyre 2024-04-06 01:36:20 -04:00
parent 7fc4dbce85
commit 1bf2a725c9
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,6 @@
import Phaser from 'phaser'; import Phaser from 'phaser';
import UI, { Mode } from './ui/ui'; 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 Pokemon, { PlayerPokemon, EnemyPokemon } from './field/pokemon';
import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies } from './data/pokemon-species'; import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies } from './data/pokemon-species';
import * as Utils from './utils'; import * as Utils from './utils';
@ -710,6 +710,9 @@ export default class BattleScene extends SceneBase {
const lastBattle = this.currentBattle; const lastBattle = this.currentBattle;
if (lastBattle?.double && !newDouble)
this.tryRemovePhase(p => p instanceof SwitchPhase);
const maxExpLevel = this.getMaxExpLevel(); const maxExpLevel = this.getMaxExpLevel();
this.lastEnemyTrainer = lastBattle?.trainer ?? null; this.lastEnemyTrainer = lastBattle?.trainer ?? null;