diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 7b6fb5b5b..2950ae1b7 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -7,7 +7,7 @@ import { StatusEffect } from "./status-effect"; import * as Utils from "../utils"; import { Moves } from "./enums/moves"; import { ChargeAttr, MoveFlags, allMoves } from "./move"; -import { Type } from "./type"; +import { getTypeDamageMultiplier, Type } from "./type"; import { BlockNonDirectDamageAbAttr, FlinchEffectAbAttr, ReverseDrainAbAttr, applyAbAttrs } from "./ability"; import { Abilities } from "./enums/abilities"; import { BattlerTagType } from "./enums/battler-tag-type"; @@ -1102,12 +1102,10 @@ export class MagnetRisenTag extends TypeImmuneTag { export class ExposedTag extends BattlerTag { public immuneType: Type; - public allowedTypes: Type[]; - constructor(tagType: BattlerTagType, sourceMove: Moves, type: Type, allowedTypes: Type[]) { + constructor(tagType: BattlerTagType, sourceMove: Moves, type: Type) { super(tagType, BattlerTagLapseType.TURN_END, 1, sourceMove); this.immuneType = type; - this.allowedTypes = allowedTypes; } /** @@ -1117,16 +1115,15 @@ export class ExposedTag extends BattlerTag { loadTag(source: BattlerTag | any): void { super.loadTag(source); this.immuneType = source.type as Type; - this.allowedTypes = source.allowedTypes as Type[]; } lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { return lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType); } - ignoreImmunity(pokemon: Pokemon, moveType: Type): boolean { - return pokemon.getTypes(true, true).includes(this.immuneType) - && this.allowedTypes.includes(moveType); + ignoreImmunity(types: Type[], moveType: Type): boolean { + return types.includes(this.immuneType) + && getTypeDamageMultiplier(moveType, this.immuneType) == 0; } } @@ -1389,9 +1386,9 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc case BattlerTagType.MAGNET_RISEN: return new MagnetRisenTag(tagType, sourceMove); case BattlerTagType.ODOR_SLEUTH: - return new ExposedTag(tagType, sourceMove, Type.GHOST, [ Type.NORMAL, Type.FIGHTING ]); + return new ExposedTag(tagType, sourceMove, Type.GHOST); case BattlerTagType.MIRACLE_EYE: - return new ExposedTag(tagType, sourceMove, Type.DARK, [ Type.PSYCHIC ]); + return new ExposedTag(tagType, sourceMove, Type.DARK); case BattlerTagType.NONE: default: return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 3ba9d7609..ddb84a8b5 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -967,7 +967,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return 1; const exposedTags = this.getTags(ExposedTag) as ExposedTag[]; - if (exposedTags.some(t => t.ignoreImmunity(this, moveType))) { + if (exposedTags.some(t => t.ignoreImmunity(types, moveType))) { return 1; } }