Skip to content

Commit

Permalink
[Balance] Ability-ignoring effects no longer ignore the source's own …
Browse files Browse the repository at this point in the history
…Abilities (pagefaultgames#3556)

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

* Update src/field/arena.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* RIP `phases.ts`

* `ignoreAbilitySource` --> `ignoringEffectSource`

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 23, 2024
1 parent b9b2491 commit f2fe430
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/field/arena.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class Arena {
public tags: ArenaTag[];
public bgm: string;
public ignoreAbilities: boolean;
public ignoringEffectSource: BattlerIndex | null;

private lastTimeOfDay: TimeOfDay;

Expand Down Expand Up @@ -569,8 +570,9 @@ export class Arena {
}
}

setIgnoreAbilities(ignoreAbilities: boolean = true): void {
setIgnoreAbilities(ignoreAbilities: boolean, ignoringEffectSource: BattlerIndex | null = null): void {
this.ignoreAbilities = ignoreAbilities;
this.ignoringEffectSource = ignoreAbilities ? ignoringEffectSource : null;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/field/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,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.ignoringEffectSource !== this.getBattlerIndex() && ability.isIgnorable) {
return false;
}
if (this.summonData?.abilitySuppressed && !ability.hasAttr(UnsuppressableAbilityAbAttr)) {
Expand Down
2 changes: 1 addition & 1 deletion src/phases/move-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,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?
Expand Down

0 comments on commit f2fe430

Please sign in to comment.