Ability-ignoring effects no longer ignore the source's Abilities

This commit is contained in:
innerthunder 2024-08-14 22:15:10 -07:00
parent 4e74007af6
commit 2884c8b912
3 changed files with 10 additions and 3 deletions

View File

@ -30,6 +30,7 @@ export class Arena {
public tags: ArenaTag[]; public tags: ArenaTag[];
public bgm: string; public bgm: string;
public ignoreAbilities: boolean; public ignoreAbilities: boolean;
public ignoreAbilitySource: BattlerIndex | null;
private lastTimeOfDay: TimeOfDay; 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; this.ignoreAbilities = ignoreAbilities;
if (ignoreAbilities) {
this.ignoreAbilitySource = ignoreAbilitySource;
} else {
this.ignoreAbilitySource = null;
}
} }
applyTagsForSide(tagType: ArenaTagType | Constructor<ArenaTag>, side: ArenaTagSide, ...args: unknown[]): void { applyTagsForSide(tagType: ArenaTagType | Constructor<ArenaTag>, side: ArenaTagSide, ...args: unknown[]): void {

View File

@ -1110,7 +1110,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (this.isFusion() && ability.hasAttr(NoFusionAbilityAbAttr)) { if (this.isFusion() && ability.hasAttr(NoFusionAbilityAbAttr)) {
return false; 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; return false;
} }
if (this.summonData?.abilitySuppressed && !ability.hasAttr(UnsuppressableAbilityAbAttr)) { if (this.summonData?.abilitySuppressed && !ability.hasAttr(UnsuppressableAbilityAbAttr)) {

View File

@ -2720,7 +2720,7 @@ export class MovePhase extends BattlePhase {
if (!this.followUp) { if (!this.followUp) {
if (this.move.getMove().checkFlag(MoveFlags.IGNORE_ABILITIES, this.pokemon, null)) { if (this.move.getMove().checkFlag(MoveFlags.IGNORE_ABILITIES, this.pokemon, null)) {
this.scene.arena.setIgnoreAbilities(); this.scene.arena.setIgnoreAbilities(true, this.pokemon.getBattlerIndex());
} }
} else { } else {
this.pokemon.turnData.hitsLeft = 0; // TODO: is `0` correct? this.pokemon.turnData.hitsLeft = 0; // TODO: is `0` correct?