Fix move order persisting through tests

This commit is contained in:
Dean 2025-06-15 11:24:00 -07:00
parent 70edead47e
commit 1441cf9171
2 changed files with 12 additions and 4 deletions

View File

@ -55,15 +55,18 @@ export class DynamicQueueManager {
} }
public setMoveTimingModifier(condition: PhaseConditionFunc, modifier: MovePhaseTimingModifier) { public setMoveTimingModifier(condition: PhaseConditionFunc, modifier: MovePhaseTimingModifier) {
const movePhaseQueue: MovePhasePriorityQueue = this.dynamicPhaseMap.get("MovePhase") as MovePhasePriorityQueue; this.getMovePhaseQueue().setTimingModifier(condition, modifier);
movePhaseQueue.setTimingModifier(condition, modifier);
} }
public setMoveForPhase(condition: PhaseConditionFunc, move: PokemonMove) { public setMoveForPhase(condition: PhaseConditionFunc, move: PokemonMove) {
(this.dynamicPhaseMap.get("MovePhase") as MovePhasePriorityQueue).setMoveForPhase(condition, move); this.getMovePhaseQueue().setMoveForPhase(condition, move);
} }
public setMoveOrder(order: BattlerIndex[]) { public setMoveOrder(order: BattlerIndex[]) {
(this.dynamicPhaseMap.get("MovePhase") as MovePhasePriorityQueue).setMoveOrder(order); this.getMovePhaseQueue().setMoveOrder(order);
}
private getMovePhaseQueue(): MovePhasePriorityQueue {
return this.dynamicPhaseMap.get("MovePhase") as MovePhasePriorityQueue;
} }
} }

View File

@ -30,6 +30,11 @@ export class MovePhasePriorityQueue extends PokemonPhasePriorityQueue<MovePhase>
this.setOrder = order; this.setOrder = order;
} }
public override clear(): void {
this.setOrder = undefined;
super.clear();
}
private sortPostSpeed(): void { private sortPostSpeed(): void {
this.queue.sort((a: MovePhase, b: MovePhase) => { this.queue.sort((a: MovePhase, b: MovePhase) => {
const priority = [a, b].map(movePhase => { const priority = [a, b].map(movePhase => {