2024-10-09 13:01:49 -07:00
|
|
|
import i18next from "#app/plugins/i18n";
|
2024-06-13 18:44:23 -04:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
2024-11-08 14:44:34 -08:00
|
|
|
import { StatusEffect } from "#enums/status-effect";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-07-25 16:43:48 -07:00
|
|
|
import Phaser from "phaser";
|
2024-10-09 13:01:49 -07:00
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
2024-06-08 00:33:45 +02:00
|
|
|
|
|
|
|
describe("Items - Toxic orb", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
2024-10-11 10:41:54 -04:00
|
|
|
game.override
|
|
|
|
.battleType("single")
|
2024-10-22 09:37:13 -07:00
|
|
|
.enemySpecies(Species.MAGIKARP)
|
2024-10-11 10:41:54 -04:00
|
|
|
.ability(Abilities.BALL_FETCH)
|
|
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
2024-10-22 09:37:13 -07:00
|
|
|
.moveset(Moves.SPLASH)
|
2024-10-11 10:41:54 -04:00
|
|
|
.enemyMoveset(Moves.SPLASH)
|
|
|
|
.startingHeldItems([{
|
|
|
|
name: "TOXIC_ORB",
|
|
|
|
}]);
|
2024-10-09 13:01:49 -07:00
|
|
|
|
|
|
|
vi.spyOn(i18next, "t");
|
2024-06-08 00:33:45 +02:00
|
|
|
});
|
|
|
|
|
2024-10-22 09:37:13 -07:00
|
|
|
it("should badly poison the holder", async () => {
|
|
|
|
await game.classicMode.startBattle([ Species.FEEBAS ]);
|
2024-06-08 00:33:45 +02:00
|
|
|
|
2024-10-22 09:37:13 -07:00
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
|
|
expect(player.getHeldItems()[0].type.id).toBe("TOXIC_ORB");
|
2024-06-08 00:33:45 +02:00
|
|
|
|
2024-10-11 10:41:54 -04:00
|
|
|
game.move.select(Moves.SPLASH);
|
|
|
|
|
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
2024-10-22 09:37:13 -07:00
|
|
|
await game.phaseInterceptor.to("MessagePhase");
|
2024-10-09 13:01:49 -07:00
|
|
|
expect(i18next.t).toHaveBeenCalledWith("statusEffect:toxic.obtainSource", expect.anything());
|
|
|
|
|
2024-10-11 10:41:54 -04:00
|
|
|
expect(player.status?.effect).toBe(StatusEffect.TOXIC);
|
2024-10-22 09:37:13 -07:00
|
|
|
expect(player.status?.toxicTurnCount).toBe(0);
|
|
|
|
});
|
2024-06-08 00:33:45 +02:00
|
|
|
});
|