Fix Toxic Orb test

This commit is contained in:
NightKev 2024-10-11 08:54:27 -07:00
parent d96289a2db
commit e42460b893

View File

@ -1,7 +1,4 @@
import { StatusEffect } from "#app/data/status-effect";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { MessagePhase } from "#app/phases/message-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import i18next from "#app/plugins/i18n";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
@ -27,40 +24,33 @@ describe("Items - Toxic orb", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
const moveToUse = Moves.GROWTH;
const oppMoveToUse = Moves.TACKLE;
game.override.battleType("single");
game.override.enemySpecies(Species.RATTATA);
game.override.ability(Abilities.INSOMNIA);
game.override.enemyAbility(Abilities.INSOMNIA);
game.override.startingLevel(2000);
game.override.moveset([ moveToUse ]);
game.override.enemyMoveset([ oppMoveToUse, oppMoveToUse, oppMoveToUse, oppMoveToUse ]);
game.override.startingHeldItems([{
name: "TOXIC_ORB",
}]);
game.override
.battleType("single")
.enemySpecies(Species.MAGIKARP)
.ability(Abilities.BALL_FETCH)
.enemyAbility(Abilities.BALL_FETCH)
.moveset(Moves.SPLASH)
.enemyMoveset(Moves.SPLASH)
.startingHeldItems([{
name: "TOXIC_ORB",
}]);
vi.spyOn(i18next, "t");
});
it("TOXIC ORB", async () => {
const moveToUse = Moves.GROWTH;
await game.startBattle([
Species.MIGHTYENA,
Species.MIGHTYENA,
]);
expect(game.scene.modifiers[0].type.id).toBe("TOXIC_ORB");
it("should badly poison the holder", async () => {
await game.classicMode.startBattle([ Species.FEEBAS ]);
game.move.select(moveToUse);
const player = game.scene.getPlayerPokemon()!;
expect(player.getHeldItems()[0].type.id).toBe("TOXIC_ORB");
// will run the 13 phase from enemyCommandPhase to TurnEndPhase
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnEndPhase);
// Toxic orb should trigger here
await game.phaseInterceptor.run(MessagePhase);
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to("TurnEndPhase");
await game.phaseInterceptor.to("MessagePhase");
expect(i18next.t).toHaveBeenCalledWith("statusEffect:toxic.obtainSource", expect.anything());
await game.phaseInterceptor.run(MessagePhase);
await game.phaseInterceptor.to("MessagePhase");
expect(i18next.t).toHaveBeenCalledWith("statusEffect:toxic.activation", expect.anything());
expect(game.scene.getParty()[0].status!.effect).toBe(StatusEffect.TOXIC);
expect(player.status?.effect).toBe(StatusEffect.TOXIC);
}, 20000);
});