pokerogue/test/moves/tidy_up.test.ts
NightKev 9dcb904649
[Misc] Improve enum naming (#5933)
* Rename `Abilities` to `AbilityId`

* Rename `abilities.ts` to `ability-id.ts`

* Rename `Moves` to `MoveId`

* Rename `moves.ts` to `move-id.ts`

* Rename `Species` to `SpeciesId`

* Rename `species.ts` to `species-id.ts`

* Rename `Biome` to `BiomeId`

* Rename `biome.ts` to `biome-id.ts`

* Replace `Abilities` with `AbilityId` in comments

* Replace `Biome` with `BiomeId` in comments

* Replace `Moves` with `MoveId` in comments

* Replace `Species` with `SpeciesId` in comments
2025-06-04 14:54:27 -07:00

116 lines
4.1 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 { SpeciesId } from "#enums/species-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";
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");
game.override.enemySpecies(SpeciesId.MAGIKARP);
game.override.enemyAbility(AbilityId.BALL_FETCH);
game.override.enemyMoveset(MoveId.SPLASH);
game.override.starterSpecies(SpeciesId.FEEBAS);
game.override.ability(AbilityId.BALL_FETCH);
game.override.moveset([MoveId.TIDY_UP]);
game.override.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();
}, 20000);
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();
}, 20000);
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();
}, 20000);
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();
}, 20000);
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();
});
}, 20000);
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);
}, 20000);
});