Make the ExposedTag not require allowed types to hit the immune type.

pull/812/head
Jakub Hanko 2024-05-14 11:24:40 +02:00
parent 33e71605b4
commit d5720fbf50
No known key found for this signature in database
GPG Key ID: 775D427937A306CC
2 changed files with 8 additions and 11 deletions

View File

@ -7,7 +7,7 @@ import { StatusEffect } from "./status-effect";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { Moves } from "./enums/moves"; import { Moves } from "./enums/moves";
import { ChargeAttr, MoveFlags, allMoves } from "./move"; import { ChargeAttr, MoveFlags, allMoves } from "./move";
import { Type } from "./type"; import { getTypeDamageMultiplier, Type } from "./type";
import { BlockNonDirectDamageAbAttr, FlinchEffectAbAttr, ReverseDrainAbAttr, applyAbAttrs } from "./ability"; import { BlockNonDirectDamageAbAttr, FlinchEffectAbAttr, ReverseDrainAbAttr, applyAbAttrs } from "./ability";
import { Abilities } from "./enums/abilities"; import { Abilities } from "./enums/abilities";
import { BattlerTagType } from "./enums/battler-tag-type"; import { BattlerTagType } from "./enums/battler-tag-type";
@ -1102,12 +1102,10 @@ export class MagnetRisenTag extends TypeImmuneTag {
export class ExposedTag extends BattlerTag { export class ExposedTag extends BattlerTag {
public immuneType: Type; 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); super(tagType, BattlerTagLapseType.TURN_END, 1, sourceMove);
this.immuneType = type; this.immuneType = type;
this.allowedTypes = allowedTypes;
} }
/** /**
@ -1117,16 +1115,15 @@ export class ExposedTag extends BattlerTag {
loadTag(source: BattlerTag | any): void { loadTag(source: BattlerTag | any): void {
super.loadTag(source); super.loadTag(source);
this.immuneType = source.type as Type; this.immuneType = source.type as Type;
this.allowedTypes = source.allowedTypes as Type[];
} }
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
return lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType); return lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType);
} }
ignoreImmunity(pokemon: Pokemon, moveType: Type): boolean { ignoreImmunity(types: Type[], moveType: Type): boolean {
return pokemon.getTypes(true, true).includes(this.immuneType) return types.includes(this.immuneType)
&& this.allowedTypes.includes(moveType); && getTypeDamageMultiplier(moveType, this.immuneType) == 0;
} }
} }
@ -1389,9 +1386,9 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
case BattlerTagType.MAGNET_RISEN: case BattlerTagType.MAGNET_RISEN:
return new MagnetRisenTag(tagType, sourceMove); return new MagnetRisenTag(tagType, sourceMove);
case BattlerTagType.ODOR_SLEUTH: 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: case BattlerTagType.MIRACLE_EYE:
return new ExposedTag(tagType, sourceMove, Type.DARK, [ Type.PSYCHIC ]); return new ExposedTag(tagType, sourceMove, Type.DARK);
case BattlerTagType.NONE: case BattlerTagType.NONE:
default: default:
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId); return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);

View File

@ -967,7 +967,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return 1; return 1;
const exposedTags = this.getTags(ExposedTag) as ExposedTag[]; 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; return 1;
} }
} }