mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-17 02:27:20 +02:00
21 lines
654 B
TypeScript
21 lines
654 B
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { BattlePhase } from "./battle-phase";
|
|
|
|
export class NewBattlePhase extends BattlePhase {
|
|
public readonly phaseName = "NewBattlePhase";
|
|
start() {
|
|
super.start();
|
|
|
|
// cull any extra `NewBattle` phases from the queue.
|
|
globalScene.phaseManager.phaseQueue = globalScene.phaseManager.phaseQueue.filter(
|
|
phase => !phase.is("NewBattlePhase"),
|
|
);
|
|
// `phaseQueuePrepend` is private, so we have to use this inefficient loop.
|
|
while (globalScene.phaseManager.tryRemoveUnshiftedPhase(phase => phase.is("NewBattlePhase"))) {}
|
|
|
|
globalScene.newBattle();
|
|
|
|
this.end();
|
|
}
|
|
}
|