simplify logic for ignoretypeimmunityabattr

This commit is contained in:
contra1337 2024-05-06 19:13:35 -05:00
parent 0ee76e3019
commit 78d3bf7779
2 changed files with 2 additions and 2 deletions

View File

@ -2483,7 +2483,7 @@ export class IgnoreTypeImmunityAbAttr extends AbAttr {
} }
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
if (this.defenderType === (args[1] as Type) && this.allowedMoveTypes.some(type => type === (args[0] as Type))) { if (this.defenderType === (args[1] as Type) && this.allowedMoveTypes.includes(args[0] as Type)) {
cancelled.value = true; cancelled.value = true;
return true; return true;
} }

View File

@ -902,7 +902,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
const types = this.getTypes(true, true); const types = this.getTypes(true, true);
let multiplier = types.map(defType => { let multiplier = types.map(defType => {
if (source && source.hasAbilityWithAttr(IgnoreTypeImmunityAbAttr)) { if (source) {
const ignoreImmunity = new Utils.BooleanHolder(false); const ignoreImmunity = new Utils.BooleanHolder(false);
applyAbAttrs(IgnoreTypeImmunityAbAttr, source, ignoreImmunity, moveType, defType); applyAbAttrs(IgnoreTypeImmunityAbAttr, source, ignoreImmunity, moveType, defType);
if (ignoreImmunity.value) if (ignoreImmunity.value)