fixed type immunity abilities not working against status moves

pull/240/head
Luc Dube 2024-04-22 15:28:21 -04:00
parent 71f99da38d
commit 6548b65843
1 changed files with 5 additions and 1 deletions

View File

@ -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;
}