From 6548b658431c7a6f1cee9054c93813750731f2f5 Mon Sep 17 00:00:00 2001 From: Luc Dube Date: Mon, 22 Apr 2024 15:28:21 -0400 Subject: [PATCH 1/3] fixed type immunity abilities not working against status moves --- src/data/ability.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index bfc608dc7..b7997e5fa 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -308,7 +308,11 @@ export class TypeImmunityAbAttr extends PreDefendAbAttr { } applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, cancelled: Utils.BooleanHolder, args: any[]): boolean { - if ((move.getMove() instanceof AttackMove || move.getMove().getAttrs(StatusMoveTypeImmunityAttr).find(attr => (attr as StatusMoveTypeImmunityAttr).immuneType === this.immuneType)) && move.getMove().type === this.immuneType) { + + const target = move.getMove().moveTarget; + const targetsField = target === MoveTarget.ENEMY_SIDE || target === MoveTarget.USER_SIDE || target === MoveTarget.BOTH_SIDES; // should not activate on moves like spikes or grassy terrain + + if (((move.getMove() instanceof Move && !targetsField) || move.getMove().getAttrs(StatusMoveTypeImmunityAttr).find(attr => (attr as StatusMoveTypeImmunityAttr).immuneType === this.immuneType)) && move.getMove().type === this.immuneType) { (args[0] as Utils.NumberHolder).value = 0; return true; } From 481d8e2796d7d8378dbf0add07b2d48defbf5a70 Mon Sep 17 00:00:00 2001 From: lucfd <83493765+lucfd@users.noreply.github.com> Date: Sun, 28 Apr 2024 23:49:26 -0400 Subject: [PATCH 2/3] removed redundant condition --- src/data/ability.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index b7997e5fa..9f4e2c5b0 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -312,7 +312,7 @@ export class TypeImmunityAbAttr extends PreDefendAbAttr { const target = move.getMove().moveTarget; const targetsField = target === MoveTarget.ENEMY_SIDE || target === MoveTarget.USER_SIDE || target === MoveTarget.BOTH_SIDES; // should not activate on moves like spikes or grassy terrain - if (((move.getMove() instanceof Move && !targetsField) || move.getMove().getAttrs(StatusMoveTypeImmunityAttr).find(attr => (attr as StatusMoveTypeImmunityAttr).immuneType === this.immuneType)) && move.getMove().type === this.immuneType) { + if ((!targetsField || move.getMove().getAttrs(StatusMoveTypeImmunityAttr).find(attr => (attr as StatusMoveTypeImmunityAttr).immuneType === this.immuneType)) && move.getMove().type === this.immuneType) { (args[0] as Utils.NumberHolder).value = 0; return true; } From c0ed5f86239f13daf4bb6a3ff602ed41c1cb0219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=20Dub=C3=A9?= Date: Mon, 13 May 2024 22:55:06 -0400 Subject: [PATCH 3/3] added tsdoc --- src/data/ability.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/data/ability.ts b/src/data/ability.ts index 9f4e2c5b0..ef676e781 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -296,6 +296,13 @@ export class PreDefendMovePowerToOneAbAttr extends ReceivedMoveDamageMultiplierA } } +/** + * Makes the user immune to moves of a specific type. Works regardless + * of move category. Does not affect moves that target the field (ex. spikes) + * @param immuneType The {@link Type} that the user is immune to + * @param condition N/A + * @returns if the ability successfully activates + */ export class TypeImmunityAbAttr extends PreDefendAbAttr { private immuneType: Type; private condition: AbAttrCondition;