Remove arena tags before a trainer battle or new biome
parent
c27db5603a
commit
01a5fe18dd
|
@ -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 {
|
preloadBgm(): void {
|
||||||
this.scene.loadBgm(this.bgm);
|
this.scene.loadBgm(this.bgm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -694,11 +694,12 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
|
|
||||||
if (!waveIndex) {
|
if (!waveIndex) {
|
||||||
const isNewBiome = !lastBattle || !(lastBattle.waveIndex % 10);
|
const isNewBiome = !lastBattle || !(lastBattle.waveIndex % 10);
|
||||||
const showTrainer = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER;
|
const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER;
|
||||||
if (lastBattle) {
|
if (lastBattle) {
|
||||||
this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy());
|
this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy());
|
||||||
this.trySpreadPokerus();
|
this.trySpreadPokerus();
|
||||||
if (showTrainer) {
|
if (resetArenaState) {
|
||||||
|
this.arena.removeAllTags();
|
||||||
playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p)));
|
playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p)));
|
||||||
this.unshiftPhase(new ShowTrainerPhase(this));
|
this.unshiftPhase(new ShowTrainerPhase(this));
|
||||||
for (let pokemon of this.getParty()) {
|
for (let pokemon of this.getParty()) {
|
||||||
|
|
Loading…
Reference in New Issue