From f02cdc27718077539d1a35cb4dcdacf3fc1930de Mon Sep 17 00:00:00 2001 From: Madmadness65 Date: Fri, 7 Feb 2025 13:33:51 -0600 Subject: [PATCH] Use global scene --- src/data/ability.ts | 2 +- src/data/arena-tag.ts | 2 +- src/phases/move-effect-phase.ts | 4 ++-- src/phases/show-ability-phase.ts | 4 ++-- src/phases/stat-stage-change-phase.ts | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 8dccadb1fc3..21ec5667426 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2779,7 +2779,7 @@ export class ReflectStatStageChangeAbAttr extends PreStatStageChangeAbAttr { const stages = args[1]; this.reflectedStat = stat; if (!simulated) { - attacker.scene.unshiftPhase(new StatStageChangePhase(attacker.scene, attacker.getBattlerIndex(), false, [ stat ], stages, true, false, true, null, true)); + globalScene.unshiftPhase(new StatStageChangePhase(attacker.getBattlerIndex(), false, [ stat ], stages, true, false, true, null, true)); } cancelled.value = true; return true; diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index 8eb764add7e..2fa4593fd6c 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -910,7 +910,7 @@ class StickyWebTag extends ArenaTrapTag { if (!cancelled.value) { globalScene.queueMessage(i18next.t("arenaTag:stickyWebActivateTrap", { pokemonName: pokemon.getNameToRender() })); const stages = new NumberHolder(-1); - globalScene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), false, [ Stat.SPD ], stages.value, true, false, true, null, false, true)); + globalScene.unshiftPhase(new StatStageChangePhase(pokemon.getBattlerIndex(), false, [ Stat.SPD ], stages.value, true, false, true, null, false, true)); return true; } } diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index 6d455853f5a..be9a36940ea 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -97,9 +97,9 @@ export class MoveEffectPhase extends PokemonPhase { /** If an enemy used this move, set this as last enemy that used move or ability */ if (!user.isPlayer()) { - this.scene.currentBattle.lastEnemyInvolved = this.fieldIndex; + globalScene.currentBattle.lastEnemyInvolved = this.fieldIndex; } else { - this.scene.currentBattle.lastPlayerInvolved = this.fieldIndex; + globalScene.currentBattle.lastPlayerInvolved = this.fieldIndex; } const isDelayedAttack = this.move.getMove().hasAttr(DelayedAttackAttr); diff --git a/src/phases/show-ability-phase.ts b/src/phases/show-ability-phase.ts index 272fc079b9f..d759ad833a1 100644 --- a/src/phases/show-ability-phase.ts +++ b/src/phases/show-ability-phase.ts @@ -20,9 +20,9 @@ export class ShowAbilityPhase extends PokemonPhase { if (!pokemon.isPlayer()) { /** If its an enemy pokemon, list it as last enemy to use ability or move */ - this.scene.currentBattle.lastEnemyInvolved = pokemon.getBattlerIndex() % 2; + globalScene.currentBattle.lastEnemyInvolved = pokemon.getBattlerIndex() % 2; } else { - this.scene.currentBattle.lastPlayerInvolved = pokemon.getBattlerIndex() % 2; + globalScene.currentBattle.lastPlayerInvolved = pokemon.getBattlerIndex() % 2; } globalScene.abilityBar.showAbility(pokemon, this.passive); diff --git a/src/phases/stat-stage-change-phase.ts b/src/phases/stat-stage-change-phase.ts index 91aacdeb84b..753d1f7cede 100644 --- a/src/phases/stat-stage-change-phase.ts +++ b/src/phases/stat-stage-change-phase.ts @@ -60,13 +60,13 @@ export class StatStageChangePhase extends PokemonPhase { if (pokemon.isPlayer()) { /** If this SSCP is not from sticky web, then we find the opponent pokemon that last did something */ if (!this.comingFromStickyWeb) { - opponentPokemon = this.scene.getEnemyField()[this.scene.currentBattle.lastEnemyInvolved]; + opponentPokemon = globalScene.getEnemyField()[globalScene.currentBattle.lastEnemyInvolved]; } else { /** If this SSCP is from sticky web, then check if pokemon that last sucessfully used sticky web is on field */ - const stickyTagID = this.scene.arena.findTagsOnSide( + const stickyTagID = globalScene.arena.findTagsOnSide( (t: ArenaTag) => t.tagType === ArenaTagType.STICKY_WEB, ArenaTagSide.PLAYER)[0].sourceId; - this.scene.getEnemyField().forEach((e) => { + globalScene.getEnemyField().forEach((e) => { if (e.id === stickyTagID) { opponentPokemon = e; } @@ -74,12 +74,12 @@ export class StatStageChangePhase extends PokemonPhase { } } else { if (!this.comingFromStickyWeb) { - opponentPokemon = this.scene.getPlayerField()[this.scene.currentBattle.lastPlayerInvolved]; + opponentPokemon = globalScene.getPlayerField()[globalScene.currentBattle.lastPlayerInvolved]; } else { - const stickyTagID = this.scene.arena.findTagsOnSide( + const stickyTagID = globalScene.arena.findTagsOnSide( (t: ArenaTag) => t.tagType === ArenaTagType.STICKY_WEB, ArenaTagSide.ENEMY)[0].sourceId; - this.scene.getPlayerField().forEach((e) => { + globalScene.getPlayerField().forEach((e) => { if (e.id === stickyTagID) { opponentPokemon = e; }