From 88d38f7891d36d1b322da52b7c8c0a0bb2459e4d Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Mon, 12 May 2025 18:16:23 -0500 Subject: [PATCH] Queue faint phases only after all other phases --- src/phases/move-effect-phase.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index d067807486d..eff94a64794 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -98,6 +98,8 @@ export class MoveEffectPhase extends PokemonPhase { /** Is this the last strike of a move? */ private lastHit: boolean; + private faintPhases: FaintPhase[] = []; + /** Phases queued during moves */ private queuedPhases: Phase[] = []; @@ -243,6 +245,11 @@ export class MoveEffectPhase extends PokemonPhase { 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 { @@ -900,7 +907,7 @@ export class MoveEffectPhase extends PokemonPhase { // set splice index here, so future scene queues happen before FaintedPhase globalScene.setPhaseQueueSplice(); - globalScene.unshiftPhase(new FaintPhase(target.getBattlerIndex(), false, user)); + this.faintPhases.push(new FaintPhase(target.getBattlerIndex(), false, user)); target.destroySubstitute(); target.lapseTag(BattlerTagType.COMMANDED);