[Hotfix] Fix Pokemon info not fully appearing after switch-out (#3596)

* Add hideInfo param to leaveField

* Update docs for leaveField
This commit is contained in:
innerthunder 2024-08-17 15:25:03 -07:00 committed by GitHub
parent b59cb128bf
commit 2b853bae25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -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). * 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 * @param clearEffects Indicates if effects should be cleared (true) or passed
* to the next pokemon, such as during a baton pass (false) * 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(); this.resetTurnData();
if (clearEffects) { if (clearEffects) {
this.resetSummonData(); this.resetSummonData();
this.resetBattleData(); this.resetBattleData();
} }
if (hideInfo) {
this.hideInfo(); this.hideInfo();
}
this.setVisible(false); this.setVisible(false);
this.scene.field.remove(this); this.scene.field.remove(this);
this.scene.triggerPokemonFormChange(this, SpeciesFormChangeActiveTrigger, true); this.scene.triggerPokemonFormChange(this, SpeciesFormChangeActiveTrigger, true);

View File

@ -1635,7 +1635,7 @@ export class SwitchSummonPhase extends SummonPhase {
}) })
); );
this.scene.playSound("pb_rel"); 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"); pokemon.tint(getPokeballTintColor(pokemon.pokeball), 1, 250, "Sine.easeIn");
this.scene.tweens.add({ this.scene.tweens.add({
targets: pokemon, targets: pokemon,
@ -1643,9 +1643,7 @@ export class SwitchSummonPhase extends SummonPhase {
ease: "Sine.easeIn", ease: "Sine.easeIn",
scale: 0.5, scale: 0.5,
onComplete: () => { onComplete: () => {
// 300ms delay on leaveField is necessary to avoid calling hideInfo() twice pokemon.leaveField(!this.batonPass, false);
// and double-animating the stats panel slideout
this.scene.time.delayedCall(300, () => pokemon.leaveField(!this.batonPass));
this.scene.time.delayedCall(750, () => this.switchAndSummon()); this.scene.time.delayedCall(750, () => this.switchAndSummon());
} }
}); });