Fix Baton Pass not working

This commit is contained in:
Flashfyre 2024-04-25 20:52:52 -04:00
parent f99afa228f
commit 728512cf7d
3 changed files with 4 additions and 5 deletions

View File

@ -1418,7 +1418,7 @@ export default class BattleScene extends SceneBase {
playBgm(bgmName?: string, fadeOut?: boolean): void { playBgm(bgmName?: string, fadeOut?: boolean): void {
if (bgmName === undefined) 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 && bgmName === this.bgm.key) {
if (!this.bgm.isPlaying) { if (!this.bgm.isPlaying) {
this.bgm.play({ this.bgm.play({

View File

@ -2836,10 +2836,8 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
if (switchOutTarget.hp) { if (switchOutTarget.hp) {
applyPreSwitchOutAbAttrs(PreSwitchOutAbAttr, switchOutTarget); applyPreSwitchOutAbAttrs(PreSwitchOutAbAttr, switchOutTarget);
(switchOutTarget as PlayerPokemon).switchOut(this.batonPass, true).then(() => resolve(true)); (switchOutTarget as PlayerPokemon).switchOut(this.batonPass, true).then(() => resolve(true));
} } else
else {
resolve(false); resolve(false);
}
return; return;
} }
else if (user.scene.currentBattle.battleType) { else if (user.scene.currentBattle.battleType) {

View File

@ -2316,6 +2316,7 @@ export class PlayerPokemon extends Pokemon {
switchOut(batonPass: boolean, removeFromField: boolean = false): Promise<void> { switchOut(batonPass: boolean, removeFromField: boolean = false): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
this.resetTurnData(); this.resetTurnData();
if (!batonPass)
this.resetSummonData(); this.resetSummonData();
this.hideInfo(); this.hideInfo();
this.setVisible(false); this.setVisible(false);