diff --git a/src/data/ability.ts b/src/data/ability.ts index efbf7d3be82..176ed58d41d 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2608,7 +2608,7 @@ export class ProtectStatAbAttr extends PreStatStageChangeAbAttr { /** * Apply the {@linkcode ProtectedStatAbAttr} to an interaction - * @param pokemon The {@linkcode Pokemon} with the ability + * @param _pokemon * @param _passive * @param simulated * @param stat the {@linkcode BattleStat} being affected @@ -2616,8 +2616,8 @@ export class ProtectStatAbAttr extends PreStatStageChangeAbAttr { * @param _args * @returns true if the stat is protected, false otherwise */ - applyPreStatStageChange(pokemon: Pokemon, _passive: boolean, _simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, _args: any[]): boolean { - if (!this.isStatIncrease(pokemon) && (Utils.isNullOrUndefined(this.protectedStat) || stat === this.protectedStat)) { + applyPreStatStageChange(_pokemon: Pokemon, _passive: boolean, _simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, _args: any[]): boolean { + if (Utils.isNullOrUndefined(this.protectedStat) || stat === this.protectedStat) { cancelled.value = true; return true; } @@ -2632,15 +2632,6 @@ export class ProtectStatAbAttr extends PreStatStageChangeAbAttr { statName: this.protectedStat ? i18next.t(getStatKey(this.protectedStat)) : i18next.t("battle:stats") }); } - - /** - * Check if the stat is an increase due to an {@linkcode StatStageChangeMultiplierAbAttr} inverting the multiplier - * @param pokemon The {@linkcode Pokemon} with the ability - * @returns true if the stat is an increase due to an {@linkcode StatStageChangeMultiplierAbAttr} inverting the multiplier - */ - private isStatIncrease(pokemon: Pokemon): boolean { - return pokemon.getAbilityAttrs(StatStageChangeMultiplierAbAttr).some(attr => attr.isInvert()); - } } /** @@ -3748,19 +3739,11 @@ export class StatStageChangeMultiplierAbAttr extends AbAttr { this.multiplier = multiplier; } - apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { + override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { (args[0] as Utils.IntegerHolder).value *= this.multiplier; return true; } - - /** - * Check if the multiplier is negative/inverts the change - * @returns true if the multiplier is negative - */ - isInvert(): boolean { - return this.multiplier < 0; - } } export class StatStageChangeCopyAbAttr extends AbAttr {