mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-29 21:12:45 +02:00
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { SpeciesId } from "#enums/species-id";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import { MoveId } from "#enums/move-id";
|
|
import { AbilityId } from "#enums/ability-id";
|
|
import { StatusEffect } from "#enums/status-effect";
|
|
|
|
describe("Spec - Pokemon Functions", () => {
|
|
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
|
|
.battleStyle("single")
|
|
.startingLevel(100)
|
|
.criticalHits(false)
|
|
.enemySpecies(SpeciesId.MAGIKARP)
|
|
.enemyAbility(AbilityId.BALL_FETCH)
|
|
.ability(AbilityId.BALL_FETCH)
|
|
.enemyMoveset(MoveId.SPLASH);
|
|
});
|
|
|
|
describe("doSetStatus", () => {
|
|
it("should change the Pokemon's status, ignoring feasibility checks", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.ACCELGOR]);
|
|
|
|
const player = game.field.getPlayerPokemon();
|
|
|
|
expect(player.status?.effect).toBeUndefined();
|
|
player.doSetStatus(StatusEffect.BURN);
|
|
expect(player.status?.effect).toBe(StatusEffect.BURN);
|
|
|
|
expect(player.canSetStatus(StatusEffect.SLEEP)).toBe(false);
|
|
player.doSetStatus(StatusEffect.SLEEP, 5);
|
|
expect(player.status?.effect).toBe(StatusEffect.SLEEP);
|
|
expect(player.status?.sleepTurnsRemaining).toBe(5);
|
|
});
|
|
});
|
|
});
|