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 { 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);

View File

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