mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +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? */
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user