2024-09-02 22:12:34 -04:00
|
|
|
import { Stat } from "#enums/stat";
|
2024-08-09 10:16:38 -04:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-08-09 10:16:38 -04:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
2025-03-07 19:10:29 -06:00
|
|
|
import { allMoves } from "#app/data/moves/move";
|
2024-09-11 22:20:24 -04:00
|
|
|
import { CommandPhase } from "#app/phases/command-phase";
|
2024-08-09 10:16:38 -04:00
|
|
|
|
|
|
|
describe("Moves - Freezy Frost", () => {
|
2024-09-02 22:12:34 -04:00
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
2024-08-09 10:16:38 -04:00
|
|
|
|
2024-09-02 22:12:34 -04:00
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({ type: Phaser.HEADLESS });
|
|
|
|
});
|
2024-08-09 10:16:38 -04:00
|
|
|
|
2024-09-02 22:12:34 -04:00
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
2024-08-09 10:16:38 -04:00
|
|
|
|
2024-09-02 22:12:34 -04:00
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
2024-08-09 10:16:38 -04:00
|
|
|
|
2024-09-11 22:20:24 -04:00
|
|
|
game.override
|
|
|
|
.battleType("single")
|
|
|
|
.enemySpecies(Species.RATTATA)
|
|
|
|
.enemyLevel(100)
|
2025-03-09 16:13:25 -05:00
|
|
|
.enemyMoveset([Moves.HOWL, Moves.HOWL, Moves.HOWL, Moves.HOWL])
|
2024-09-11 22:20:24 -04:00
|
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
|
|
|
.startingLevel(100)
|
2025-03-09 16:13:25 -05:00
|
|
|
.moveset([Moves.FREEZY_FROST, Moves.HOWL, Moves.SPLASH])
|
2024-09-11 22:20:24 -04:00
|
|
|
.ability(Abilities.BALL_FETCH);
|
2024-08-09 10:16:38 -04:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
vi.spyOn(allMoves[Moves.FREEZY_FROST], "accuracy", "get").mockReturnValue(100);
|
2024-09-02 22:12:34 -04:00
|
|
|
});
|
2024-08-09 10:16:38 -04:00
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
it("should clear stat changes of user and opponent", async () => {
|
|
|
|
await game.classicMode.startBattle([Species.SHUCKLE]);
|
|
|
|
const user = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
|
|
|
|
game.move.select(Moves.HOWL);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
expect(user.getStatStage(Stat.ATK)).toBe(1);
|
|
|
|
expect(enemy.getStatStage(Stat.ATK)).toBe(1);
|
|
|
|
|
|
|
|
game.move.select(Moves.FREEZY_FROST);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
expect(user.getStatStage(Stat.ATK)).toBe(0);
|
|
|
|
expect(enemy.getStatStage(Stat.ATK)).toBe(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should clear all stat changes even when enemy uses the move", async () => {
|
|
|
|
game.override.enemyMoveset([Moves.FREEZY_FROST, Moves.FREEZY_FROST, Moves.FREEZY_FROST, Moves.FREEZY_FROST]);
|
|
|
|
await game.classicMode.startBattle([Species.SHUCKLE]); // Shuckle for slower Howl on first turn so Freezy Frost doesn't affect it.
|
|
|
|
const user = game.scene.getPlayerPokemon()!;
|
|
|
|
|
|
|
|
game.move.select(Moves.HOWL);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
const userAtkBefore = user.getStatStage(Stat.ATK);
|
|
|
|
expect(userAtkBefore).toBe(1);
|
|
|
|
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
|
|
await game.toNextTurn();
|
|
|
|
expect(user.getStatStage(Stat.ATK)).toBe(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should clear all stat changes in double battle", async () => {
|
|
|
|
game.override.battleType("double");
|
|
|
|
await game.classicMode.startBattle([Species.SHUCKLE, Species.RATTATA]);
|
|
|
|
const [leftPlayer, rightPlayer] = game.scene.getPlayerField();
|
|
|
|
const [leftOpp, rightOpp] = game.scene.getEnemyField();
|
|
|
|
|
|
|
|
game.move.select(Moves.HOWL, 0);
|
|
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
|
|
game.move.select(Moves.SPLASH, 1);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
expect(leftPlayer.getStatStage(Stat.ATK)).toBe(1);
|
|
|
|
expect(rightPlayer.getStatStage(Stat.ATK)).toBe(1);
|
|
|
|
expect(leftOpp.getStatStage(Stat.ATK)).toBe(2); // Both enemies use Howl
|
|
|
|
expect(rightOpp.getStatStage(Stat.ATK)).toBe(2);
|
|
|
|
|
|
|
|
game.move.select(Moves.FREEZY_FROST, 0, leftOpp.getBattlerIndex());
|
|
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
|
|
game.move.select(Moves.SPLASH, 1);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
expect(leftPlayer.getStatStage(Stat.ATK)).toBe(0);
|
|
|
|
expect(rightPlayer.getStatStage(Stat.ATK)).toBe(0);
|
|
|
|
expect(leftOpp.getStatStage(Stat.ATK)).toBe(0);
|
|
|
|
expect(rightOpp.getStatStage(Stat.ATK)).toBe(0);
|
|
|
|
});
|
2024-08-09 10:16:38 -04:00
|
|
|
});
|