mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-29 21:12:45 +02:00
* [Bug] Toxic Spikes implementation issues fixed Adjusted MoveEffectPhase.start() so that ENEMY_SIDE targeted moves no longer occur twice per use in double battles. Updated Toxic Orb test to no longer expect a tick of damage turn 1. Fixed Toxic/Poison dealing damage immediately when applied. Fixed Hazards not persisting through save Added unit tests Fixed flyout not displaying correct number of Spikes/Toxic Spikes after a refresh * Update Toxic Orb test * Updates Toxic Spikes tests * Apply suggestions from code review * Fix merge issues Replace `integer` with `number` in `arena-tag.ts` * Remove partial Magic Bounce implementation * Remove stray newline * Remove extra change in safeguard test --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import { StatusEffect } from "#app/data/status-effect";
|
|
import i18next from "#app/plugins/i18n";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import GameManager from "#test/utils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const TIMEOUT = 20 * 1000;
|
|
|
|
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);
|
|
game.override
|
|
.battleType("single")
|
|
.enemySpecies(Species.RATTATA)
|
|
.ability(Abilities.BALL_FETCH)
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
|
.moveset([ Moves.SPLASH ])
|
|
.enemyMoveset(Moves.SPLASH)
|
|
.startingHeldItems([{
|
|
name: "TOXIC_ORB",
|
|
}]);
|
|
|
|
vi.spyOn(i18next, "t");
|
|
});
|
|
|
|
it("badly poisons the holder", async () => {
|
|
await game.classicMode.startBattle([ Species.MIGHTYENA ]);
|
|
|
|
const player = game.scene.getPlayerField()[0];
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
// Toxic orb should trigger here
|
|
await game.phaseInterceptor.run("MessagePhase");
|
|
expect(i18next.t).toHaveBeenCalledWith("statusEffect:toxic.obtainSource", expect.anything());
|
|
|
|
await game.toNextTurn();
|
|
|
|
expect(player.status?.effect).toBe(StatusEffect.TOXIC);
|
|
// Damage should not have ticked yet.
|
|
expect(player.status?.turnCount).toBe(0);
|
|
}, TIMEOUT);
|
|
});
|