From 21e36130397f5b8dc11267505b49f98ebc52fb91 Mon Sep 17 00:00:00 2001 From: PrabbyDD Date: Thu, 7 Nov 2024 11:34:40 -0800 Subject: [PATCH] fixing edge cases --- src/overrides.ts | 2 +- src/phases/show-ability-phase.ts | 16 ++++++++-------- src/phases/stat-stage-change-phase.ts | 16 ++-------------- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/overrides.ts b/src/overrides.ts index 6760db79205..ba2cc0eb0ba 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -131,7 +131,7 @@ class DefaultOverrides { */ readonly OPP_FUSION_SPECIES_OVERRIDE: Species | integer = 0; readonly OPP_LEVEL_OVERRIDE: number = 0; - readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE; + readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.z; readonly OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE; readonly OPP_STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE; readonly OPP_GENDER_OVERRIDE: Gender | null = null; diff --git a/src/phases/show-ability-phase.ts b/src/phases/show-ability-phase.ts index 22745920699..a10a0699d11 100644 --- a/src/phases/show-ability-phase.ts +++ b/src/phases/show-ability-phase.ts @@ -17,17 +17,17 @@ export class ShowAbilityPhase extends PokemonPhase { const pokemon = this.getPokemon(); if (pokemon) { + + 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; + } else { + this.scene.currentBattle.lastPlayerInvolved = pokemon.getBattlerIndex() % 2; + } + this.scene.abilityBar.showAbility(pokemon, this.passive); if (pokemon?.battleData) { - - if (!pokemon.isPlayer()) { - /** If its an enemy pokemon, list it as last enemy to use ability or move */ - this.scene.currentBattle.lastEnemyInvolved = this.fieldIndex; - } else { - this.scene.currentBattle.lastPlayerInvolved = this.fieldIndex; - } - pokemon.battleData.abilityRevealed = true; } } diff --git a/src/phases/stat-stage-change-phase.ts b/src/phases/stat-stage-change-phase.ts index aa3dddefe6f..33396cada59 100644 --- a/src/phases/stat-stage-change-phase.ts +++ b/src/phases/stat-stage-change-phase.ts @@ -61,18 +61,9 @@ export class StatStageChangePhase extends PokemonPhase { // Gets the position of last enemy or player pokemon that used ability or move, primarily for double battles involving Mirror Armor if (pokemon.isPlayer()) { - if (this.scene.currentBattle.double && this.scene.getEnemyField().length === 2) { - opponentPokemon = this.scene.getEnemyField()[this.scene.currentBattle.lastEnemyInvolved]; - } else { - console.log("ENEMY POKEMANS", this.scene.getEnemyField()); - opponentPokemon = this.scene.getEnemyPokemon(); - } + opponentPokemon = this.scene.getEnemyField()[this.scene.currentBattle.lastEnemyInvolved]; } else { - if (this.scene.currentBattle.double && this.scene.getPlayerField().length === 2) { - opponentPokemon = this.scene.getPlayerField()[this.scene.currentBattle.lastPlayerInvolved]; - } else { - opponentPokemon = this.scene.getPlayerPokemon(); - } + opponentPokemon = this.scene.getPlayerField()[this.scene.currentBattle.lastPlayerInvolved]; } if (!pokemon.isActive(true)) { @@ -100,10 +91,7 @@ export class StatStageChangePhase extends PokemonPhase { // TODO: CODE INTERACTION WITH MAGIC BOUNCE AS WELL // TODO: CODE INTERACTION WITH STICKY WEB - // TODO: FIX INTERACTION WITH MEMENTO, SHOULD LOWER OPPONENT STATS THEN DIE /** Potential stat reflection due to Mirror Armor, does not apply to Octolock end of turn effect */ - console.log("I AM HEREE", opponentPokemon); - if (opponentPokemon !== undefined && !pokemon.findTag(t => t instanceof OctolockTag) && !this.comingFromMirrorArmorUser) { applyPreStatStageChangeAbAttrs(ReflectStatStageChangeAbAttr, pokemon, stat, cancelled, simulate, opponentPokemon, this.stages); }