[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).
* @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);

View File

@ -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());
}
});