From 8dc96c0070378777a5aea51c745f4f876015b96e Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 10 Apr 2024 20:57:22 -0400 Subject: [PATCH] Fix triggering summon ability on load --- src/phases.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index b8414e6b77f..8c983317239 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -326,9 +326,9 @@ export class TitlePhase extends Phase { if (this.loaded) { const availablePartyMembers = this.scene.getParty().filter(p => !p.isFainted()).length; - this.scene.pushPhase(new SummonPhase(this.scene, 0)); + this.scene.pushPhase(new SummonPhase(this.scene, 0, true, true)); if (this.scene.currentBattle.double && availablePartyMembers > 1) - this.scene.pushPhase(new SummonPhase(this.scene, 1)); + this.scene.pushPhase(new SummonPhase(this.scene, 1, true, true)); if (this.scene.currentBattle.waveIndex > 1 && this.scene.currentBattle.battleType !== BattleType.TRAINER) { this.scene.pushPhase(new CheckSwitchPhase(this.scene, 0, this.scene.currentBattle.double)); if (this.scene.currentBattle.double && availablePartyMembers > 1) @@ -1074,8 +1074,12 @@ export class SwitchBiomePhase extends BattlePhase { } export class SummonPhase extends PartyMemberPokemonPhase { - constructor(scene: BattleScene, fieldIndex: integer, player?: boolean) { - super(scene, fieldIndex, player !== undefined ? player : true); + private loaded: boolean; + + constructor(scene: BattleScene, fieldIndex: integer, player: boolean = true, loaded: boolean = false) { + super(scene, fieldIndex, player); + + this.loaded = loaded; } start() { @@ -1203,9 +1207,11 @@ export class SummonPhase extends PartyMemberPokemonPhase { pokemon.resetTurnData(); - this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger, true); + if (!this.loaded) { + this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger, true); - this.queuePostSummon(); + this.queuePostSummon(); + } } queuePostSummon(): void {