[P1] Fix crash when starting a challenge run after revisiting challenge select screen (#4603)

Ensure EncounterPhase initializes correctly at the start of the game
after revisting the challenge selection screen.

Fixes #4520
This commit is contained in:
Acelynn Zhang 2024-10-07 11:01:15 -05:00 committed by GitHub
parent a259ccfc34
commit f5fa478eb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -46,6 +46,7 @@ import { StarterContainer } from "#app/ui/starter-container";
import { DropDownColumn, FilterBar } from "#app/ui/filter-bar";
import { ScrollBar } from "#app/ui/scroll-bar";
import { SelectChallengePhase } from "#app/phases/select-challenge-phase";
import { EncounterPhase } from "#app/phases/encounter-phase";
import { TitlePhase } from "#app/phases/title-phase";
import { Abilities } from "#enums/abilities";
import { getPassiveCandyCount, getValueReductionCandyCounts, getSameSpeciesEggCandyCounts } from "#app/data/balance/starters";
@ -3468,6 +3469,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.scene.clearPhaseQueue();
if (this.scene.gameMode.isChallenge) {
this.scene.pushPhase(new SelectChallengePhase(this.scene));
this.scene.pushPhase(new EncounterPhase(this.scene, false));
} else {
this.scene.pushPhase(new TitlePhase(this.scene));
}