From 728512cf7de85a474b35603b37e31a104bf9a838 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 25 Apr 2024 20:52:52 -0400 Subject: [PATCH] Fix Baton Pass not working --- src/battle-scene.ts | 2 +- src/data/move.ts | 4 +--- src/field/pokemon.ts | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 3c869aaba..532ff22b6 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1418,7 +1418,7 @@ export default class BattleScene extends SceneBase { playBgm(bgmName?: string, fadeOut?: boolean): void { if (bgmName === undefined) - bgmName = this.currentBattle.getBgmOverride(this) || this.arena.bgm; + bgmName = this.currentBattle?.getBgmOverride(this) || this.arena?.bgm; if (this.bgm && bgmName === this.bgm.key) { if (!this.bgm.isPlaying) { this.bgm.play({ diff --git a/src/data/move.ts b/src/data/move.ts index 4b80908ea..4b8e2b6d9 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -2836,10 +2836,8 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { if (switchOutTarget.hp) { applyPreSwitchOutAbAttrs(PreSwitchOutAbAttr, switchOutTarget); (switchOutTarget as PlayerPokemon).switchOut(this.batonPass, true).then(() => resolve(true)); - } - else { + } else resolve(false); - } return; } else if (user.scene.currentBattle.battleType) { diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 97b228a24..3bbc2a74d 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2316,7 +2316,8 @@ export class PlayerPokemon extends Pokemon { switchOut(batonPass: boolean, removeFromField: boolean = false): Promise { return new Promise(resolve => { this.resetTurnData(); - this.resetSummonData(); + if (!batonPass) + this.resetSummonData(); this.hideInfo(); this.setVisible(false);