pokerogue/test/moves/thunder_wave.test.ts

101 lines
3.1 KiB
TypeScript
Raw Normal View History

import type { EnemyPokemon } from "#app/field/pokemon";
import { Abilities } from "#enums/abilities";
[Ability][Move] Rewrite Type Resolution and Effectiveness Calculation Functions (#3704) * Make type/category read-only * Fix protean/libero tests * Refactor Pokemon type effectiveness calculation * Merge getMoveEffectiveness and getAttackMoveEffectiveness * Move priority-blocking ability check * Fix incorrect early stopping implementation in MultiHitAttr * Fix Aerilate, etc. affecting variable-type moves * Thunder Wave now respects Attack type immunities * Use final move types for pre-defend abilities * Steal some things from flx's PR hehe * Fix Thousand Arrows + "No effect" messages * Fix status type effectiveness check * Another status move effectiveness update + some docs * changing status logic again... * Fix unnecessary "No Effect" message for Volt Absorb, etc * Add type effectiveness unit test * Add Galvanize integration tests * Add multi-hit test to galvanize tests * Add power check to first Galvanize test * Add missing doc line Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * Resolve torranx's nits * Apply suggestions from Kev's code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * More suggestions I missed Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Optimize effectiveness test and make others more stylish (#3) * Resolve Kev's remaining nits and some test issues --------- Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta Co-authored-by: frutescens
2024-08-25 19:11:01 -07:00
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { StatusEffect } from "#enums/status-effect";
import GameManager from "#test/testUtils/gameManager";
[Ability][Move] Rewrite Type Resolution and Effectiveness Calculation Functions (#3704) * Make type/category read-only * Fix protean/libero tests * Refactor Pokemon type effectiveness calculation * Merge getMoveEffectiveness and getAttackMoveEffectiveness * Move priority-blocking ability check * Fix incorrect early stopping implementation in MultiHitAttr * Fix Aerilate, etc. affecting variable-type moves * Thunder Wave now respects Attack type immunities * Use final move types for pre-defend abilities * Steal some things from flx's PR hehe * Fix Thousand Arrows + "No effect" messages * Fix status type effectiveness check * Another status move effectiveness update + some docs * changing status logic again... * Fix unnecessary "No Effect" message for Volt Absorb, etc * Add type effectiveness unit test * Add Galvanize integration tests * Add multi-hit test to galvanize tests * Add power check to first Galvanize test * Add missing doc line Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * Resolve torranx's nits * Apply suggestions from Kev's code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * More suggestions I missed Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Optimize effectiveness test and make others more stylish (#3) * Resolve Kev's remaining nits and some test issues --------- Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta Co-authored-by: frutescens
2024-08-25 19:11:01 -07:00
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
[Ability][Move] Rewrite Type Resolution and Effectiveness Calculation Functions (#3704) * Make type/category read-only * Fix protean/libero tests * Refactor Pokemon type effectiveness calculation * Merge getMoveEffectiveness and getAttackMoveEffectiveness * Move priority-blocking ability check * Fix incorrect early stopping implementation in MultiHitAttr * Fix Aerilate, etc. affecting variable-type moves * Thunder Wave now respects Attack type immunities * Use final move types for pre-defend abilities * Steal some things from flx's PR hehe * Fix Thousand Arrows + "No effect" messages * Fix status type effectiveness check * Another status move effectiveness update + some docs * changing status logic again... * Fix unnecessary "No Effect" message for Volt Absorb, etc * Add type effectiveness unit test * Add Galvanize integration tests * Add multi-hit test to galvanize tests * Add power check to first Galvanize test * Add missing doc line Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * Resolve torranx's nits * Apply suggestions from Kev's code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * More suggestions I missed Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Optimize effectiveness test and make others more stylish (#3) * Resolve Kev's remaining nits and some test issues --------- Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta Co-authored-by: frutescens
2024-08-25 19:11:01 -07:00
describe("Moves - Thunder Wave", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.battleType("single")
.starterSpecies(Species.PIKACHU)
2024-10-04 13:08:31 +08:00
.moveset([ Moves.THUNDER_WAVE ])
.enemyMoveset(Moves.SPLASH);
[Ability][Move] Rewrite Type Resolution and Effectiveness Calculation Functions (#3704) * Make type/category read-only * Fix protean/libero tests * Refactor Pokemon type effectiveness calculation * Merge getMoveEffectiveness and getAttackMoveEffectiveness * Move priority-blocking ability check * Fix incorrect early stopping implementation in MultiHitAttr * Fix Aerilate, etc. affecting variable-type moves * Thunder Wave now respects Attack type immunities * Use final move types for pre-defend abilities * Steal some things from flx's PR hehe * Fix Thousand Arrows + "No effect" messages * Fix status type effectiveness check * Another status move effectiveness update + some docs * changing status logic again... * Fix unnecessary "No Effect" message for Volt Absorb, etc * Add type effectiveness unit test * Add Galvanize integration tests * Add multi-hit test to galvanize tests * Add power check to first Galvanize test * Add missing doc line Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * Resolve torranx's nits * Apply suggestions from Kev's code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * More suggestions I missed Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Optimize effectiveness test and make others more stylish (#3) * Resolve Kev's remaining nits and some test issues --------- Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta Co-authored-by: frutescens
2024-08-25 19:11:01 -07:00
});
// References: https://bulbapedia.bulbagarden.net/wiki/Thunder_Wave_(move)
it("paralyzes non-statused Pokemon that are not Ground types", async () => {
game.override.enemySpecies(Species.MAGIKARP);
await game.startBattle();
const enemyPokemon: EnemyPokemon = game.scene.getEnemyPokemon()!;
game.move.select(Moves.THUNDER_WAVE);
await game.move.forceHit();
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.status?.effect).toBe(StatusEffect.PARALYSIS);
});
[Ability][Move] Rewrite Type Resolution and Effectiveness Calculation Functions (#3704) * Make type/category read-only * Fix protean/libero tests * Refactor Pokemon type effectiveness calculation * Merge getMoveEffectiveness and getAttackMoveEffectiveness * Move priority-blocking ability check * Fix incorrect early stopping implementation in MultiHitAttr * Fix Aerilate, etc. affecting variable-type moves * Thunder Wave now respects Attack type immunities * Use final move types for pre-defend abilities * Steal some things from flx's PR hehe * Fix Thousand Arrows + "No effect" messages * Fix status type effectiveness check * Another status move effectiveness update + some docs * changing status logic again... * Fix unnecessary "No Effect" message for Volt Absorb, etc * Add type effectiveness unit test * Add Galvanize integration tests * Add multi-hit test to galvanize tests * Add power check to first Galvanize test * Add missing doc line Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * Resolve torranx's nits * Apply suggestions from Kev's code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * More suggestions I missed Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Optimize effectiveness test and make others more stylish (#3) * Resolve Kev's remaining nits and some test issues --------- Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta Co-authored-by: frutescens
2024-08-25 19:11:01 -07:00
it("does not paralyze if the Pokemon is a Ground-type", async () => {
game.override.enemySpecies(Species.DIGLETT);
await game.startBattle();
const enemyPokemon: EnemyPokemon = game.scene.getEnemyPokemon()!;
game.move.select(Moves.THUNDER_WAVE);
await game.move.forceHit();
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.status).toBeUndefined();
});
[Ability][Move] Rewrite Type Resolution and Effectiveness Calculation Functions (#3704) * Make type/category read-only * Fix protean/libero tests * Refactor Pokemon type effectiveness calculation * Merge getMoveEffectiveness and getAttackMoveEffectiveness * Move priority-blocking ability check * Fix incorrect early stopping implementation in MultiHitAttr * Fix Aerilate, etc. affecting variable-type moves * Thunder Wave now respects Attack type immunities * Use final move types for pre-defend abilities * Steal some things from flx's PR hehe * Fix Thousand Arrows + "No effect" messages * Fix status type effectiveness check * Another status move effectiveness update + some docs * changing status logic again... * Fix unnecessary "No Effect" message for Volt Absorb, etc * Add type effectiveness unit test * Add Galvanize integration tests * Add multi-hit test to galvanize tests * Add power check to first Galvanize test * Add missing doc line Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * Resolve torranx's nits * Apply suggestions from Kev's code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * More suggestions I missed Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Optimize effectiveness test and make others more stylish (#3) * Resolve Kev's remaining nits and some test issues --------- Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta Co-authored-by: frutescens
2024-08-25 19:11:01 -07:00
it("does not paralyze if the Pokemon already has a status effect", async () => {
game.override.enemySpecies(Species.MAGIKARP).enemyStatusEffect(StatusEffect.BURN);
await game.startBattle();
const enemyPokemon: EnemyPokemon = game.scene.getEnemyPokemon()!;
game.move.select(Moves.THUNDER_WAVE);
await game.move.forceHit();
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.status?.effect).not.toBe(StatusEffect.PARALYSIS);
});
[Ability][Move] Rewrite Type Resolution and Effectiveness Calculation Functions (#3704) * Make type/category read-only * Fix protean/libero tests * Refactor Pokemon type effectiveness calculation * Merge getMoveEffectiveness and getAttackMoveEffectiveness * Move priority-blocking ability check * Fix incorrect early stopping implementation in MultiHitAttr * Fix Aerilate, etc. affecting variable-type moves * Thunder Wave now respects Attack type immunities * Use final move types for pre-defend abilities * Steal some things from flx's PR hehe * Fix Thousand Arrows + "No effect" messages * Fix status type effectiveness check * Another status move effectiveness update + some docs * changing status logic again... * Fix unnecessary "No Effect" message for Volt Absorb, etc * Add type effectiveness unit test * Add Galvanize integration tests * Add multi-hit test to galvanize tests * Add power check to first Galvanize test * Add missing doc line Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * Resolve torranx's nits * Apply suggestions from Kev's code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * More suggestions I missed Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Optimize effectiveness test and make others more stylish (#3) * Resolve Kev's remaining nits and some test issues --------- Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta Co-authored-by: frutescens
2024-08-25 19:11:01 -07:00
it("affects Ground types if the user has Normalize", async () => {
game.override.ability(Abilities.NORMALIZE).enemySpecies(Species.DIGLETT);
await game.startBattle();
const enemyPokemon: EnemyPokemon = game.scene.getEnemyPokemon()!;
game.move.select(Moves.THUNDER_WAVE);
await game.move.forceHit();
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.status?.effect).toBe(StatusEffect.PARALYSIS);
});
[Ability][Move] Rewrite Type Resolution and Effectiveness Calculation Functions (#3704) * Make type/category read-only * Fix protean/libero tests * Refactor Pokemon type effectiveness calculation * Merge getMoveEffectiveness and getAttackMoveEffectiveness * Move priority-blocking ability check * Fix incorrect early stopping implementation in MultiHitAttr * Fix Aerilate, etc. affecting variable-type moves * Thunder Wave now respects Attack type immunities * Use final move types for pre-defend abilities * Steal some things from flx's PR hehe * Fix Thousand Arrows + "No effect" messages * Fix status type effectiveness check * Another status move effectiveness update + some docs * changing status logic again... * Fix unnecessary "No Effect" message for Volt Absorb, etc * Add type effectiveness unit test * Add Galvanize integration tests * Add multi-hit test to galvanize tests * Add power check to first Galvanize test * Add missing doc line Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * Resolve torranx's nits * Apply suggestions from Kev's code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * More suggestions I missed Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Optimize effectiveness test and make others more stylish (#3) * Resolve Kev's remaining nits and some test issues --------- Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta Co-authored-by: frutescens
2024-08-25 19:11:01 -07:00
it("does not affect Ghost types if the user has Normalize", async () => {
game.override.ability(Abilities.NORMALIZE).enemySpecies(Species.HAUNTER);
await game.startBattle();
const enemyPokemon: EnemyPokemon = game.scene.getEnemyPokemon()!;
game.move.select(Moves.THUNDER_WAVE);
await game.move.forceHit();
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.status).toBeUndefined();
});
[Ability][Move] Rewrite Type Resolution and Effectiveness Calculation Functions (#3704) * Make type/category read-only * Fix protean/libero tests * Refactor Pokemon type effectiveness calculation * Merge getMoveEffectiveness and getAttackMoveEffectiveness * Move priority-blocking ability check * Fix incorrect early stopping implementation in MultiHitAttr * Fix Aerilate, etc. affecting variable-type moves * Thunder Wave now respects Attack type immunities * Use final move types for pre-defend abilities * Steal some things from flx's PR hehe * Fix Thousand Arrows + "No effect" messages * Fix status type effectiveness check * Another status move effectiveness update + some docs * changing status logic again... * Fix unnecessary "No Effect" message for Volt Absorb, etc * Add type effectiveness unit test * Add Galvanize integration tests * Add multi-hit test to galvanize tests * Add power check to first Galvanize test * Add missing doc line Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * Resolve torranx's nits * Apply suggestions from Kev's code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * More suggestions I missed Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Optimize effectiveness test and make others more stylish (#3) * Resolve Kev's remaining nits and some test issues --------- Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta Co-authored-by: frutescens
2024-08-25 19:11:01 -07:00
});