From 6548b658431c7a6f1cee9054c93813750731f2f5 Mon Sep 17 00:00:00 2001 From: Luc Dube Date: Mon, 22 Apr 2024 15:28:21 -0400 Subject: [PATCH] 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; }