fix double battle crash in challenge mode with a single eligible pokemon

This commit is contained in:
ImperialSympathizer 2024-10-17 15:13:39 -04:00
parent 5fb160c5d6
commit e4c9e3f9f7
2 changed files with 2 additions and 2 deletions

View File

@ -325,7 +325,7 @@ export default class MysteryEncounter implements IMysteryEncounter {
if (activeMon.length > 0) { if (activeMon.length > 0) {
this.primaryPokemon = activeMon[0]; this.primaryPokemon = activeMon[0];
} else { } else {
this.primaryPokemon = scene.getParty().filter(p => !p.isFainted())[0]; this.primaryPokemon = scene.getParty().filter(p => p.isAllowedInBattle())[0];
} }
return true; return true;
} }

View File

@ -402,7 +402,7 @@ export class MysteryEncounterBattlePhase extends Phase {
} }
} }
const availablePartyMembers = scene.getParty().filter(p => !p.isFainted()); const availablePartyMembers = scene.getParty().filter(p => p.isAllowedInBattle());
if (!availablePartyMembers[0].isOnField()) { if (!availablePartyMembers[0].isOnField()) {
scene.pushPhase(new SummonPhase(scene, 0)); scene.pushPhase(new SummonPhase(scene, 0));