mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 16:02:20 +02:00
Queue faint phases only after all other phases
This commit is contained in:
parent
9b1a222935
commit
88d38f7891
@ -98,6 +98,8 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
/** Is this the last strike of a move? */
|
/** Is this the last strike of a move? */
|
||||||
private lastHit: boolean;
|
private lastHit: boolean;
|
||||||
|
|
||||||
|
private faintPhases: FaintPhase[] = [];
|
||||||
|
|
||||||
/** Phases queued during moves */
|
/** Phases queued during moves */
|
||||||
private queuedPhases: Phase[] = [];
|
private queuedPhases: Phase[] = [];
|
||||||
|
|
||||||
@ -243,6 +245,11 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
throw new Error("Unexpected hit check result");
|
throw new Error("Unexpected hit check result");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Append the faint phases after resolving all move effects so that the faint phase happens after any message phases
|
||||||
|
if (this.faintPhases.length) {
|
||||||
|
globalScene.unshiftPhase(...this.faintPhases);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override start(): void {
|
public override start(): void {
|
||||||
@ -900,7 +907,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
// set splice index here, so future scene queues happen before FaintedPhase
|
// set splice index here, so future scene queues happen before FaintedPhase
|
||||||
globalScene.setPhaseQueueSplice();
|
globalScene.setPhaseQueueSplice();
|
||||||
|
|
||||||
globalScene.unshiftPhase(new FaintPhase(target.getBattlerIndex(), false, user));
|
this.faintPhases.push(new FaintPhase(target.getBattlerIndex(), false, user));
|
||||||
|
|
||||||
target.destroySubstitute();
|
target.destroySubstitute();
|
||||||
target.lapseTag(BattlerTagType.COMMANDED);
|
target.lapseTag(BattlerTagType.COMMANDED);
|
||||||
|
Loading…
Reference in New Issue
Block a user