From 6e5ca28a6369e9fe5baf5bae38d7da9013e95794 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Sun, 2 Feb 2025 18:09:51 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/data/ability.ts | 1 - src/field/pokemon.ts | 11 ++++++++--- src/test/utils/helpers/overridesHelper.ts | 18 ++++++++++++++---- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 40ab5967464..1ebce583738 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2701,7 +2701,6 @@ export class PreLeaveFieldAbAttr extends AbAttr { } } - /** * Clears Desolate Land/Primordial Sea/Delta Stream upon the Pokemon switching out. */ diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index a57a29544df..709e95a0443 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1422,11 +1422,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { */ public hasPassive(): boolean { // returns override if valid for current case - if ((Overrides.HAS_PASSIVE_ABILITY_OVERRIDE === false && this.isPlayer()) || (Overrides.OPP_HAS_PASSIVE_ABILITY_OVERRIDE === false && !this.isPlayer())) { + if ( + (Overrides.HAS_PASSIVE_ABILITY_OVERRIDE === false && this.isPlayer()) + || (Overrides.OPP_HAS_PASSIVE_ABILITY_OVERRIDE === false && !this.isPlayer()) + ) { return false; } - if (((Overrides.PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE || Overrides.HAS_PASSIVE_ABILITY_OVERRIDE) && this.isPlayer()) - || ((Overrides.OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE || Overrides.OPP_HAS_PASSIVE_ABILITY_OVERRIDE) && !this.isPlayer())) { + if ( + ((Overrides.PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE || Overrides.HAS_PASSIVE_ABILITY_OVERRIDE) && this.isPlayer()) + || ((Overrides.OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE || Overrides.OPP_HAS_PASSIVE_ABILITY_OVERRIDE) && !this.isPlayer()) + ) { return true; } diff --git a/src/test/utils/helpers/overridesHelper.ts b/src/test/utils/helpers/overridesHelper.ts index 08fc3b5950c..b4e9814275a 100644 --- a/src/test/utils/helpers/overridesHelper.ts +++ b/src/test/utils/helpers/overridesHelper.ts @@ -181,9 +181,14 @@ export class OverridesHelper extends GameManagerHelper { return this; } - public hasPassiveAbility(hasPassiveAbility: boolean): this { + public hasPassiveAbility(hasPassiveAbility: boolean | null): this { vi.spyOn(Overrides, "HAS_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(hasPassiveAbility); - this.log("Player Pokemon PASSIVE ability is active!"); + if (hasPassiveAbility === null) { + this.log("Player Pokemon PASSIVE ability no longer force enabled or disabled!"); + } + else { + this.log("Player Pokemon PASSIVE ability is force ${hasPassiveAbility ? "enabled" : "disabled"}!"); + } return this; } /** @@ -330,9 +335,14 @@ export class OverridesHelper extends GameManagerHelper { return this; } - public enemyHasPassiveAbility(hasPassiveAbility: boolean): this { + public enemyHasPassiveAbility(hasPassiveAbility: boolean | null): this { vi.spyOn(Overrides, "OPP_HAS_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(hasPassiveAbility); - this.log("Enemy Pokemon PASSIVE ability is active!"); + if (hasPassiveAbility === null) { + this.log("Enemy Pokemon PASSIVE ability no longer force enabled or disabled!"); + } + else { + this.log("Enemy Pokemon PASSIVE ability is force ${hasPassiveAbility ? "enabled" : "disabled"}!"); + } return this; }