mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
https://github.com/pagefaultgames/pokerogue/pull/5927/ * Removed unnecessary test timeout parameters from test files We set it in vitest config anyways * Removed unneeded `mockRestore` calls We call `restoreAllMocks` after each test runs anyhow * Removed accidentall forgotten-about timeout * Revdrt magic bounce test file for now * Fixed ting * Fixed bug * Fixed import * Update test/data/status_effect.test.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update battle.test.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Ran bim --------- Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
117 lines
4.0 KiB
TypeScript
117 lines
4.0 KiB
TypeScript
import { Stat } from "#enums/stat";
|
|
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
|
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
import { AbilityId } from "#enums/ability-id";
|
|
import { MoveId } from "#enums/move-id";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import { SubstituteTag } from "#app/data/battler-tags";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
|
|
describe("Moves - Tidy Up", () => {
|
|
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
|
|
.battleStyle("single")
|
|
.enemySpecies(SpeciesId.MAGIKARP)
|
|
.enemyAbility(AbilityId.BALL_FETCH)
|
|
.enemyMoveset(MoveId.SPLASH)
|
|
.starterSpecies(SpeciesId.FEEBAS)
|
|
.ability(AbilityId.BALL_FETCH)
|
|
.moveset([MoveId.TIDY_UP])
|
|
.startingLevel(50);
|
|
});
|
|
|
|
it("spikes are cleared", async () => {
|
|
game.override.moveset([MoveId.SPIKES, MoveId.TIDY_UP]).enemyMoveset(MoveId.SPIKES);
|
|
await game.classicMode.startBattle();
|
|
|
|
game.move.select(MoveId.SPIKES);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
game.move.select(MoveId.TIDY_UP);
|
|
await game.phaseInterceptor.to(MoveEndPhase);
|
|
expect(game.scene.arena.getTag(ArenaTagType.SPIKES)).toBeUndefined();
|
|
});
|
|
|
|
it("stealth rocks are cleared", async () => {
|
|
game.override.moveset([MoveId.STEALTH_ROCK, MoveId.TIDY_UP]).enemyMoveset(MoveId.STEALTH_ROCK);
|
|
await game.classicMode.startBattle();
|
|
|
|
game.move.select(MoveId.STEALTH_ROCK);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
game.move.select(MoveId.TIDY_UP);
|
|
await game.phaseInterceptor.to(MoveEndPhase);
|
|
expect(game.scene.arena.getTag(ArenaTagType.STEALTH_ROCK)).toBeUndefined();
|
|
});
|
|
|
|
it("toxic spikes are cleared", async () => {
|
|
game.override.moveset([MoveId.TOXIC_SPIKES, MoveId.TIDY_UP]).enemyMoveset(MoveId.TOXIC_SPIKES);
|
|
await game.classicMode.startBattle();
|
|
|
|
game.move.select(MoveId.TOXIC_SPIKES);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
game.move.select(MoveId.TIDY_UP);
|
|
await game.phaseInterceptor.to(MoveEndPhase);
|
|
expect(game.scene.arena.getTag(ArenaTagType.TOXIC_SPIKES)).toBeUndefined();
|
|
});
|
|
|
|
it("sticky webs are cleared", async () => {
|
|
game.override.moveset([MoveId.STICKY_WEB, MoveId.TIDY_UP]).enemyMoveset(MoveId.STICKY_WEB);
|
|
|
|
await game.classicMode.startBattle();
|
|
|
|
game.move.select(MoveId.STICKY_WEB);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
game.move.select(MoveId.TIDY_UP);
|
|
await game.phaseInterceptor.to(MoveEndPhase);
|
|
expect(game.scene.arena.getTag(ArenaTagType.STICKY_WEB)).toBeUndefined();
|
|
});
|
|
|
|
it("substitutes are cleared", async () => {
|
|
game.override.moveset([MoveId.SUBSTITUTE, MoveId.TIDY_UP]).enemyMoveset(MoveId.SUBSTITUTE);
|
|
|
|
await game.classicMode.startBattle();
|
|
|
|
game.move.select(MoveId.SUBSTITUTE);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
game.move.select(MoveId.TIDY_UP);
|
|
await game.phaseInterceptor.to(MoveEndPhase);
|
|
|
|
const pokemon = [game.scene.getPlayerPokemon()!, game.scene.getEnemyPokemon()!];
|
|
pokemon.forEach(p => {
|
|
expect(p).toBeDefined();
|
|
expect(p!.getTag(SubstituteTag)).toBeUndefined();
|
|
});
|
|
});
|
|
|
|
it("user's stats are raised with no traps set", async () => {
|
|
await game.classicMode.startBattle();
|
|
|
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(0);
|
|
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
|
|
|
|
game.move.select(MoveId.TIDY_UP);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1);
|
|
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
|
|
});
|
|
});
|