Remove arena tags before a trainer battle or new biome

pull/14/head
Flashfyre 2023-12-14 09:35:15 -05:00
parent c27db5603a
commit 01a5fe18dd
2 changed files with 10 additions and 2 deletions

View File

@ -353,6 +353,13 @@ export class Arena {
});
}
removeAllTags(): void {
for (let t of this.tags) {
t.onRemove(this);
this.tags.splice(this.tags.indexOf(t), 1);
}
}
preloadBgm(): void {
this.scene.loadBgm(this.bgm);
}

View File

@ -694,11 +694,12 @@ export default class BattleScene extends Phaser.Scene {
if (!waveIndex) {
const isNewBiome = !lastBattle || !(lastBattle.waveIndex % 10);
const showTrainer = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER;
const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER;
if (lastBattle) {
this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy());
this.trySpreadPokerus();
if (showTrainer) {
if (resetArenaState) {
this.arena.removeAllTags();
playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p)));
this.unshiftPhase(new ShowTrainerPhase(this));
for (let pokemon of this.getParty()) {