diff --git a/src/data/ability.ts b/src/data/ability.ts index 5c439367889..cc72693713b 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2562,6 +2562,9 @@ export class IgnoreTypeImmunityAbAttr extends AbAttr { } } +/** + * Ignores the type immunity to Status Effects of the defender if the defender is of a certain type + */ export class IgnoreTypeStatusEffectImmunityAbAttr extends AbAttr { statusEffect: StatusEffect[]; defenderType: Type[]; diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index a4e754a33e6..efa24f7e3b5 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2000,12 +2000,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { switch (effect) { case StatusEffect.POISON: case StatusEffect.TOXIC: + // Check if the Pokemon is immune to Poison/Toxic or if the source pokemon is canceling the immunity let poisonImmunity = types.map(defType => { const cancelImmunity = new Utils.BooleanHolder(false); - if (defType !== Type.POISON && defType !== Type.STEEL) { - return false; - } + // Check if the Pokemon is not immune to Poison/Toxic + if (defType !== Type.POISON && defType !== Type.STEEL) + return false; + + // Check if the source Pokemon has an ability that cancels the Poison/Toxic immunity if (source) { applyAbAttrs(IgnoreTypeStatusEffectImmunityAbAttr, source, cancelImmunity, effect, defType); if (cancelImmunity.value) @@ -2017,6 +2020,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return true; } }) + if (this.isOfType(Type.POISON) || this.isOfType(Type.STEEL)){ if (poisonImmunity.includes(true)) return false;