diff --git a/src/data/ability.ts b/src/data/ability.ts index 7d54459d7d4..6a3e8da3cd4 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -512,7 +512,11 @@ export class NonSuperEffectiveImmunityAbAttr extends TypeImmunityAbAttr { } applyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean { - if (move instanceof AttackMove && pokemon.getAttackTypeEffectiveness(attacker.getMoveType(move), attacker) < 2) { + const modifierValue = args.length > 0 + ? (args[0] as Utils.NumberHolder).value + : pokemon.getAttackTypeEffectiveness(attacker.getMoveType(move), attacker); + + if (move instanceof AttackMove && modifierValue < 2) { cancelled.value = true; // Suppresses "No Effect" message (args[0] as Utils.NumberHolder).value = 0; return true; diff --git a/src/test/moves/freeze_dry.test.ts b/src/test/moves/freeze_dry.test.ts index c09d12fa597..f766ed41a82 100644 --- a/src/test/moves/freeze_dry.test.ts +++ b/src/test/moves/freeze_dry.test.ts @@ -72,6 +72,31 @@ describe("Moves - Freeze-Dry", () => { expect(enemy.getMoveEffectiveness).toHaveReturnedWith(1); }); + /** + * Freeze drys forced super effectiveness should overwrite wonder guard + */ + it("should deal 2x dmg against soaked wonder guard target", async () => { + game.override + .enemySpecies(Species.SHEDINJA) + .enemyMoveset(Moves.SPLASH) + .starterSpecies(Species.MAGIKARP) + .moveset([ Moves.SOAK, Moves.FREEZE_DRY ]); + await game.classicMode.startBattle(); + + const enemy = game.scene.getEnemyPokemon()!; + vi.spyOn(enemy, "getMoveEffectiveness"); + + game.move.select(Moves.SOAK); + await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]); + await game.toNextTurn(); + + game.move.select(Moves.FREEZE_DRY); + await game.phaseInterceptor.to("MoveEffectPhase"); + + expect(enemy.getMoveEffectiveness).toHaveReturnedWith(2); + expect(enemy.hp).toBeLessThan(enemy.getMaxHp()); + }); + // enable if this is ever fixed (lol) it.todo("should deal 2x damage to water types under Normalize", async () => { game.override.ability(Abilities.NORMALIZE);