pokerogue/test/abilities/super_luck.test.ts
Sirz Benjie 9e4162d429
[Bug] Fix super luck implementation (#5625)
* Fix super luck implementation

* Use numberholder instead of booleanholder

* Update tsdoc for getCritStage
2025-04-04 17:40:25 -07:00

44 lines
1.2 KiB
TypeScript

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, vi } from "vitest";
describe("Abilities - Super Luck", () => {
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
.moveset([Moves.TACKLE])
.ability(Abilities.SUPER_LUCK)
.battleType("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH);
});
it("should increase the crit stage of a user by 1", async () => {
await game.classicMode.startBattle([Species.MAGIKARP]);
const enemy = game.scene.getEnemyPokemon()!;
const fn = vi.spyOn(enemy, "getCritStage");
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to("BerryPhase");
expect(fn).toHaveReturnedWith(1);
fn.mockRestore();
});
});