From 2884c8b9126f16a5db8bc27af575d413b327155c Mon Sep 17 00:00:00 2001 From: innerthunder Date: Wed, 14 Aug 2024 22:15:10 -0700 Subject: [PATCH] Ability-ignoring effects no longer ignore the source's Abilities --- src/field/arena.ts | 8 +++++++- src/field/pokemon.ts | 3 ++- src/phases.ts | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/field/arena.ts b/src/field/arena.ts index 923a0a4e286..b43a52a9f55 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -30,6 +30,7 @@ export class Arena { public tags: ArenaTag[]; public bgm: string; public ignoreAbilities: boolean; + public ignoreAbilitySource: BattlerIndex | null; private lastTimeOfDay: TimeOfDay; @@ -536,8 +537,13 @@ export class Arena { } } - setIgnoreAbilities(ignoreAbilities: boolean = true): void { + setIgnoreAbilities(ignoreAbilities: boolean, ignoreAbilitySource: BattlerIndex | null = null): void { this.ignoreAbilities = ignoreAbilities; + if (ignoreAbilities) { + this.ignoreAbilitySource = ignoreAbilitySource; + } else { + this.ignoreAbilitySource = null; + } } applyTagsForSide(tagType: ArenaTagType | Constructor, side: ArenaTagSide, ...args: unknown[]): void { diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 930ffeb700f..18224272fe0 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1110,7 +1110,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (this.isFusion() && ability.hasAttr(NoFusionAbilityAbAttr)) { return false; } - if (this.scene?.arena.ignoreAbilities && ability.isIgnorable) { + const arena = this.scene?.arena; + if (arena.ignoreAbilities && arena.ignoreAbilitySource !== this.getBattlerIndex() && ability.isIgnorable) { return false; } if (this.summonData?.abilitySuppressed && !ability.hasAttr(UnsuppressableAbilityAbAttr)) { diff --git a/src/phases.ts b/src/phases.ts index 2acb054c2ca..ea619524ce9 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2720,7 +2720,7 @@ export class MovePhase extends BattlePhase { if (!this.followUp) { if (this.move.getMove().checkFlag(MoveFlags.IGNORE_ABILITIES, this.pokemon, null)) { - this.scene.arena.setIgnoreAbilities(); + this.scene.arena.setIgnoreAbilities(true, this.pokemon.getBattlerIndex()); } } else { this.pokemon.turnData.hitsLeft = 0; // TODO: is `0` correct?