Fix Baton Pass not working

pull/301/head
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 {
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({

View File

@ -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) {

View File

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