mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
* Move game-mode to its own file Reduces circular imports to 325 * Move battler-index to own file Reduces circular deps to 314 * Move trainer-variant to own file Reduces circ deps to 313 * Move enums in pokemon to their own file * Move arena-tag-type to its own file * Move pokemon-moves to its own file * Move command to own file * Move learnMoveType to own file * Move form change item to own file * Move battlerTagLapseType to own file * Move anim enums to own shared file * Move enums out of challenges * Move species form change triggers to own file Reduces circ imports to 291 * Update test importing pokemon move * Replace move attribute imports with string names * Untangle circular deps from game data * Fix missing string call in switch summon phase * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Ensure ChargeMove's is method calls super * Use InstanceType for proper narrowing * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
116 lines
3.8 KiB
TypeScript
116 lines
3.8 KiB
TypeScript
import { Stat } from "#enums/stat";
|
|
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 type { CommandPhase } from "#app/phases/command-phase";
|
|
import { Command } from "#enums/command";
|
|
import { AttemptRunPhase } from "#app/phases/attempt-run-phase";
|
|
|
|
describe("Abilities - Speed Boost", () => {
|
|
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.SHUCKLE)
|
|
.enemyAbility(AbilityId.BALL_FETCH)
|
|
.enemyLevel(100)
|
|
.ability(AbilityId.SPEED_BOOST)
|
|
.enemyMoveset(MoveId.SPLASH)
|
|
.moveset([MoveId.SPLASH, MoveId.U_TURN]);
|
|
});
|
|
|
|
it("should increase speed by 1 stage at end of turn", async () => {
|
|
await game.classicMode.startBattle();
|
|
|
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
|
|
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
|
|
});
|
|
|
|
it("should not trigger this turn if pokemon was switched into combat via attack, but the turn after", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.SHUCKLE, SpeciesId.NINJASK]);
|
|
|
|
game.move.select(MoveId.U_TURN);
|
|
game.doSelectPartyPokemon(1);
|
|
await game.toNextTurn();
|
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
|
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
|
|
});
|
|
|
|
it("checking back to back swtiches", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.SHUCKLE, SpeciesId.NINJASK]);
|
|
|
|
const [shuckle, ninjask] = game.scene.getPlayerParty();
|
|
|
|
game.move.select(MoveId.U_TURN);
|
|
game.doSelectPartyPokemon(1);
|
|
await game.toNextTurn();
|
|
expect(game.scene.getPlayerPokemon()!).toBe(ninjask);
|
|
expect(ninjask.getStatStage(Stat.SPD)).toBe(0);
|
|
|
|
game.move.select(MoveId.U_TURN);
|
|
game.doSelectPartyPokemon(1);
|
|
await game.toNextTurn();
|
|
expect(game.scene.getPlayerPokemon()!).toBe(shuckle);
|
|
expect(shuckle.getStatStage(Stat.SPD)).toBe(0);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
expect(shuckle.getStatStage(Stat.SPD)).toBe(1);
|
|
});
|
|
|
|
it("should not trigger this turn if pokemon was switched into combat via normal switch, but the turn after", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.SHUCKLE, SpeciesId.NINJASK]);
|
|
|
|
game.doSwitchPokemon(1);
|
|
await game.toNextTurn();
|
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
|
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
|
|
});
|
|
|
|
it("should not trigger if pokemon fails to escape", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.SHUCKLE]);
|
|
|
|
const commandPhase = game.scene.phaseManager.getCurrentPhase() as CommandPhase;
|
|
commandPhase.handleCommand(Command.RUN, 0);
|
|
const runPhase = game.scene.phaseManager.getCurrentPhase() as AttemptRunPhase;
|
|
runPhase.forceFailEscape = true;
|
|
await game.phaseInterceptor.to(AttemptRunPhase);
|
|
await game.toNextTurn();
|
|
|
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
|
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
|
|
});
|
|
});
|