Use global scene

This commit is contained in:
Madmadness65 2025-02-07 13:33:51 -06:00
parent b15a49a6ea
commit f02cdc2771
5 changed files with 12 additions and 12 deletions

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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;
}