From b85f093674379b2e2d765c25b1403f10793cab0c Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sat, 30 Mar 2024 17:23:58 -0400 Subject: [PATCH] Grass types are immune to powder moves --- src/data/move.ts | 10 ++++++++++ src/field/pokemon.ts | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/data/move.ts b/src/data/move.ts index 15090f833..ef413c5f3 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -161,6 +161,16 @@ export default class Move { return false; } + isTypeImmune(type: Type): boolean { + switch (type) { + case Type.GRASS: + if (this.hasFlag(MoveFlags.POWDER_MOVE)) + return true; + break; + } + return false; + } + condition(condition: MoveCondition | MoveConditionFunc): this { if (typeof condition === 'function') condition = new MoveCondition(condition as MoveConditionFunc); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 1775e0677..18a985533 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1044,6 +1044,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { : 1); if (typeless) typeMultiplier.value = 1; + if (this.getTypes(true, true).find(t => move.isTypeImmune(t))) + typeMultiplier.value = 0; switch (moveCategory) { case MoveCategory.PHYSICAL: