2024-08-22 06:49:33 -07:00
|
|
|
import { BattlerIndex } from "#app/battle";
|
|
|
|
import { Abilities } from "#app/enums/abilities";
|
|
|
|
import { CommandPhase } from "#app/phases/command-phase";
|
|
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
2024-07-30 22:06:31 +08:00
|
|
|
import { Moves } from "#enums/moves";
|
2024-08-22 06:49:33 -07:00
|
|
|
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-08-22 06:49:33 -07:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
2024-07-30 22:06:31 +08:00
|
|
|
|
|
|
|
describe("Abilities - Pastel Veil", () => {
|
|
|
|
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-08-22 06:49:33 -07:00
|
|
|
game.override
|
|
|
|
.battleType("double")
|
2024-10-04 13:08:31 +08:00
|
|
|
.moveset([ Moves.TOXIC_THREAD, Moves.SPLASH ])
|
2024-08-22 06:49:33 -07:00
|
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
|
|
|
.enemySpecies(Species.SUNKERN)
|
2024-09-09 09:55:11 -07:00
|
|
|
.enemyMoveset(Moves.SPLASH);
|
2024-07-30 22:06:31 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it("prevents the user and its allies from being afflicted by poison", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.startBattle([ Species.MAGIKARP, Species.GALAR_PONYTA ]);
|
2024-08-22 06:49:33 -07:00
|
|
|
const ponyta = game.scene.getPlayerField()[1];
|
|
|
|
const magikarp = game.scene.getPlayerField()[0];
|
|
|
|
ponyta.abilityIndex = 1;
|
2024-07-30 22:06:31 +08:00
|
|
|
|
|
|
|
expect(ponyta.hasAbility(Abilities.PASTEL_VEIL)).toBe(true);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SPLASH);
|
|
|
|
game.move.select(Moves.TOXIC_THREAD, 1, BattlerIndex.PLAYER);
|
2024-07-30 22:06:31 +08:00
|
|
|
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
expect(magikarp.status?.effect).toBeUndefined();
|
2024-07-30 22:06:31 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it("it heals the poisoned status condition of allies if user is sent out into battle", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.startBattle([ Species.MAGIKARP, Species.FEEBAS, Species.GALAR_PONYTA ]);
|
2024-11-03 18:53:52 -08:00
|
|
|
const ponyta = game.scene.getPlayerParty()[2];
|
2024-08-22 06:49:33 -07:00
|
|
|
const magikarp = game.scene.getPlayerField()[0];
|
|
|
|
ponyta.abilityIndex = 1;
|
2024-07-30 22:06:31 +08:00
|
|
|
|
|
|
|
expect(ponyta.hasAbility(Abilities.PASTEL_VEIL)).toBe(true);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SPLASH);
|
|
|
|
game.move.select(Moves.TOXIC_THREAD, 1, BattlerIndex.PLAYER);
|
2024-07-30 22:06:31 +08:00
|
|
|
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
2024-08-22 06:49:33 -07:00
|
|
|
expect(magikarp.status?.effect).toBe(StatusEffect.POISON);
|
2024-07-30 22:06:31 +08:00
|
|
|
|
|
|
|
await game.phaseInterceptor.to(CommandPhase);
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SPLASH);
|
2024-07-30 22:06:31 +08:00
|
|
|
game.doSwitchPokemon(2);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
expect(magikarp.status?.effect).toBeUndefined();
|
2024-07-30 22:06:31 +08:00
|
|
|
});
|
|
|
|
});
|