From a27ccbf9c00ed470ec89037f4c4ddf479c7ea153 Mon Sep 17 00:00:00 2001 From: Dean Date: Thu, 16 Jan 2025 11:26:43 -0800 Subject: [PATCH] Use globalScene --- src/data/move.ts | 16 ++++++++-------- src/phases/move-phase.ts | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 41cd414d868..9e2a9a5572f 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -7938,21 +7938,21 @@ export class ForceLastAttr extends MoveEffectAttr { * @returns true */ override apply(user: Pokemon, target: Pokemon, _move: Move, _args: any[]): boolean { - user.scene.queueMessage(i18next.t("moveTriggers:forceLast", { targetPokemonName: getPokemonNameWithAffix(target) })); + globalScene.queueMessage(i18next.t("moveTriggers:forceLast", { targetPokemonName: getPokemonNameWithAffix(target) })); - const targetMovePhase = target.scene.findPhase((phase) => phase.pokemon === target); - if (targetMovePhase && !targetMovePhase.isForcedLast() && target.scene.tryRemovePhase((phase: MovePhase) => phase.pokemon === target)) { + const targetMovePhase = globalScene.findPhase((phase) => phase.pokemon === target); + if (targetMovePhase && !targetMovePhase.isForcedLast() && globalScene.tryRemovePhase((phase: MovePhase) => phase.pokemon === target)) { // Finding the phase to insert the move in front of - // Either the end of the turn or in front of another, slower move which has also been forced last - const prependPhase = target.scene.findPhase((phase) => + const prependPhase = globalScene.findPhase((phase) => [ MovePhase, MoveEndPhase ].every(cls => !(phase instanceof cls)) - || (phase instanceof MovePhase) && phaseForcedSlower(phase, target, !!target.scene.arena.getTag(ArenaTagType.TRICK_ROOM)) + || (phase instanceof MovePhase) && phaseForcedSlower(phase, target, !!globalScene.arena.getTag(ArenaTagType.TRICK_ROOM)) ); if (prependPhase) { - target.scene.phaseQueue.splice( - target.scene.phaseQueue.indexOf(prependPhase), + globalScene.phaseQueue.splice( + globalScene.phaseQueue.indexOf(prependPhase), 0, - new MovePhase(target.scene, target, [ ...targetMovePhase.targets ], targetMovePhase.move, false, false, true) + new MovePhase(target, [ ...targetMovePhase.targets ], targetMovePhase.move, false, false, true) ); } } diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index 49d7e948d03..f4d32d8ea06 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -89,7 +89,7 @@ export class MovePhase extends BattlePhase { * Follow-ups bypass a few failure conditions, including flinches, sleep/paralysis/freeze and volatile status checks, etc. */ - constructor(pokemon: Pokemon, targets: BattlerIndex[], move: PokemonMove, followUp: boolean = false, ignorePp: boolean = false) { + constructor(pokemon: Pokemon, targets: BattlerIndex[], move: PokemonMove, followUp: boolean = false, ignorePp: boolean = false, forcedLast: boolean = false) { super(); this.pokemon = pokemon;