[P2] Fixing Incorrect Freeze Dry Interaction With Soaked Wonder Guard Target (#4798)

* [Bug] fixed interaction between freeze dry and soaked wonder guard target

* added automated test for freeze dry interaction with soaked wonder guard target

* using parameter instead of function to get typeMultiplier
This commit is contained in:
geeilhan 2024-11-05 18:37:47 +01:00 committed by GitHub
parent 6fd3ba284c
commit 198d3ce2a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 1 deletions

View File

@ -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 { 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 cancelled.value = true; // Suppresses "No Effect" message
(args[0] as Utils.NumberHolder).value = 0; (args[0] as Utils.NumberHolder).value = 0;
return true; return true;

View File

@ -72,6 +72,31 @@ describe("Moves - Freeze-Dry", () => {
expect(enemy.getMoveEffectiveness).toHaveReturnedWith(1); 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) // enable if this is ever fixed (lol)
it.todo("should deal 2x damage to water types under Normalize", async () => { it.todo("should deal 2x damage to water types under Normalize", async () => {
game.override.ability(Abilities.NORMALIZE); game.override.ability(Abilities.NORMALIZE);