2024-09-15 13:06:22 -04:00
|
|
|
import { allMoves } from "#app/data/move";
|
|
|
|
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-09-15 13:06:22 -04:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
|
|
|
|
describe("Arena - Grassy Terrain", () => {
|
|
|
|
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")
|
|
|
|
.disableCrits()
|
2024-09-16 10:58:28 -04:00
|
|
|
.enemyLevel(1)
|
|
|
|
.enemySpecies(Species.SHUCKLE)
|
|
|
|
.enemyAbility(Abilities.STURDY)
|
|
|
|
.enemyMoveset(Moves.FLY)
|
2024-10-04 13:08:31 +08:00
|
|
|
.moveset([ Moves.GRASSY_TERRAIN, Moves.EARTHQUAKE ])
|
2024-09-16 10:58:28 -04:00
|
|
|
.ability(Abilities.NO_GUARD);
|
2024-09-15 13:06:22 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("halves the damage of Earthquake", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.TAUROS ]);
|
2024-09-15 13:06:22 -04:00
|
|
|
|
|
|
|
const eq = allMoves[Moves.EARTHQUAKE];
|
|
|
|
vi.spyOn(eq, "calculateBattlePower");
|
|
|
|
|
|
|
|
game.move.select(Moves.EARTHQUAKE);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
expect(eq.calculateBattlePower).toHaveReturnedWith(100);
|
|
|
|
|
|
|
|
game.move.select(Moves.GRASSY_TERRAIN);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
game.move.select(Moves.EARTHQUAKE);
|
|
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
|
|
|
|
expect(eq.calculateBattlePower).toHaveReturnedWith(50);
|
2024-09-20 14:05:45 -07:00
|
|
|
});
|
2024-09-16 10:58:28 -04:00
|
|
|
|
|
|
|
it("Does not halve the damage of Earthquake if opponent is not grounded", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.NINJASK ]);
|
2024-09-16 10:58:28 -04:00
|
|
|
|
|
|
|
const eq = allMoves[Moves.EARTHQUAKE];
|
|
|
|
vi.spyOn(eq, "calculateBattlePower");
|
|
|
|
|
|
|
|
game.move.select(Moves.GRASSY_TERRAIN);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
game.move.select(Moves.EARTHQUAKE);
|
|
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
|
|
|
|
expect(eq.calculateBattlePower).toHaveReturnedWith(100);
|
2024-09-20 14:05:45 -07:00
|
|
|
});
|
2024-09-15 13:06:22 -04:00
|
|
|
});
|