mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 14:02:18 +02:00
* [Test] Add/update test utils - Add `FieldHelper` which has methods to mock a pokemon's ability or force a pokemon to be Terastallized - Add `MoveHelper#use` which can be used to remove the need for setting pokemon move overrides by modifying the moveset of the pokemon - Add `MoveHelper#selectEnemyMove` to make an enemy pokemon select a specific move - Add `MoveHelper#forceEnemyMove` which modifies the pokemon's moveset and then uses `selectEnemyMove` - Fix `GameManager#toNextTurn` to work correctly in double battles - Add `GameManager#toEndOfTurn` which advances to the end of the turn * Update some tests - Disable broken Good As Gold test and add `.edgeCase` to Good As Gold - Fix Powder test - Update some tests to demonstrate new methods
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { MoveResult } from "#app/field/pokemon";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
describe("Moves - Chloroblast", () => {
|
|
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
|
|
.ability(Abilities.BALL_FETCH)
|
|
.battleStyle("single")
|
|
.disableCrits()
|
|
.enemySpecies(Species.MAGIKARP)
|
|
.enemyAbility(Abilities.BALL_FETCH);
|
|
});
|
|
|
|
it("should not deal recoil damage if the opponent uses protect", async () => {
|
|
await game.classicMode.startBattle([Species.FEEBAS]);
|
|
|
|
game.move.use(Moves.CHLOROBLAST);
|
|
await game.move.forceEnemyMove(Moves.PROTECT);
|
|
await game.toEndOfTurn();
|
|
|
|
const player = game.field.getPlayerPokemon();
|
|
|
|
expect(player.isFullHp()).toBe(true);
|
|
expect(player.getLastXMoves()[0]).toMatchObject({ result: MoveResult.MISS, move: Moves.CHLOROBLAST });
|
|
});
|
|
});
|