From 2b853bae2588daa6d1bf52b11fb665d38b521663 Mon Sep 17 00:00:00 2001 From: innerthunder <168692175+innerthunder@users.noreply.github.com> Date: Sat, 17 Aug 2024 15:25:03 -0700 Subject: [PATCH] [Hotfix] Fix Pokemon info not fully appearing after switch-out (#3596) * Add hideInfo param to leaveField * Update docs for leaveField --- src/field/pokemon.ts | 8 ++++++-- src/phases.ts | 6 ++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 4ab0b482916..b19fe7ce678 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3223,14 +3223,18 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { * Causes a Pokemon to leave the field (such as in preparation for a switch out/escape). * @param clearEffects Indicates if effects should be cleared (true) or passed * to the next pokemon, such as during a baton pass (false) + * @param hideInfo Indicates if this should also play the animation to hide the Pokemon's + * info container. */ - leaveField(clearEffects: boolean = true) { + leaveField(clearEffects: boolean = true, hideInfo: boolean = true) { this.resetTurnData(); if (clearEffects) { this.resetSummonData(); this.resetBattleData(); } - this.hideInfo(); + if (hideInfo) { + this.hideInfo(); + } this.setVisible(false); this.scene.field.remove(this); this.scene.triggerPokemonFormChange(this, SpeciesFormChangeActiveTrigger, true); diff --git a/src/phases.ts b/src/phases.ts index da3096b0d2d..b881f0de819 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -1635,7 +1635,7 @@ export class SwitchSummonPhase extends SummonPhase { }) ); this.scene.playSound("pb_rel"); - pokemon.hideInfo(); // this is also done by pokemon.leaveField(), but needs to go earlier for animation purposes + pokemon.hideInfo(); pokemon.tint(getPokeballTintColor(pokemon.pokeball), 1, 250, "Sine.easeIn"); this.scene.tweens.add({ targets: pokemon, @@ -1643,9 +1643,7 @@ export class SwitchSummonPhase extends SummonPhase { ease: "Sine.easeIn", scale: 0.5, onComplete: () => { - // 300ms delay on leaveField is necessary to avoid calling hideInfo() twice - // and double-animating the stats panel slideout - this.scene.time.delayedCall(300, () => pokemon.leaveField(!this.batonPass)); + pokemon.leaveField(!this.batonPass, false); this.scene.time.delayedCall(750, () => this.switchAndSummon()); } });