diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 077a2a804..b98ca6825 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -453,13 +453,13 @@ export class SelectBiomePhase extends BattlePhase { start() { super.start(); - this.scene.fadeOutBgm(2000, true); - const currentBiome = this.scene.arena.biomeType; const setNextBiome = (nextBiome: Biome) => { if (this.scene.gameMode === GameMode.CLASSIC) this.scene.unshiftPhase(new PartyHealPhase(this.scene, false)); + else + this.scene.fadeOutBgm(2000, true); this.scene.unshiftPhase(new SwitchBiomePhase(this.scene, nextBiome)); this.end(); }; diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 4e33e72c1..34dc3aaba 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -867,11 +867,11 @@ export default class BattleScene extends Phaser.Scene { playNewBgm(); }); if (fadeOut) { - this.fadeOutBgm(500, true); - this.time.delayedCall(750, () => { + const onBgmFaded = () => { if (loaded && (!this.bgm.isPlaying || this.bgm.pendingRemove)) playNewBgm(); - }); + }; + this.time.delayedCall(this.fadeOutBgm(500, true) ? 750 : 250, onBgmFaded); } if (!this.load.isLoading()) this.load.start(); @@ -887,7 +887,7 @@ export default class BattleScene extends Phaser.Scene { this.bgm.resume(); } - fadeOutBgm(duration?: integer, destroy?: boolean): void { + fadeOutBgm(duration?: integer, destroy?: boolean): boolean { if (!this.bgm) return; if (!duration) @@ -895,7 +895,12 @@ export default class BattleScene extends Phaser.Scene { if (destroy === undefined) destroy = true; const bgm = this.sound.get(this.bgm.key); - SoundFade.fadeOut(this, bgm, duration, destroy); + if (bgm) { + SoundFade.fadeOut(this, bgm, duration, destroy); + return true; + } + + return false; } playSound(soundName: string, config?: object) {