mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-24 15:56:22 +00:00
[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:
parent
6fd3ba284c
commit
198d3ce2a6
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user