mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-11-22 19:18:19 +01:00
* Learn Move Phase rewrite * Typedocs * messages with confirm do not need an extra button press no more * Added Documentation * This does not work * so sad * Some updates * Eslint issues + clean up * Additions to handle learning during evolution + test fixes * some more checks * Update src/overrides.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/test/phases/learn-move-phase.test.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Added new function and updated tests * Fixed bracketing and added parameter types * Added Sketch to the conditional * Added some fixes. Weird stuff going on. * Whoops * async implementation done * Update src/phases/learn-move-phase.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> * Made showText=> summary a promise * adapt learn-move-phase to `async-await` * await add --------- Co-authored-by: frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import Phaser from "phaser";
|
|
import GameManager from "#test/utils/gameManager";
|
|
import { Species } from "#enums/species";
|
|
import { Moves } from "#enums/moves";
|
|
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
|
|
|
describe("Learn Move Phase", () => {
|
|
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.xpMultiplier(50);
|
|
});
|
|
|
|
it("If Pokemon has less than 4 moves, its newest move will be added to the lowest empty index", async () => {
|
|
game.override.moveset([Moves.SPLASH]);
|
|
await game.startBattle([Species.BULBASAUR]);
|
|
const pokemon = game.scene.getPlayerPokemon()!;
|
|
const newMovePos = pokemon?.getMoveset().length;
|
|
game.move.select(Moves.SPLASH);
|
|
await game.doKillOpponents();
|
|
await game.phaseInterceptor.to(LearnMovePhase);
|
|
const levelMove = pokemon.getLevelMoves(5)[0];
|
|
const levelReq = levelMove[0];
|
|
const levelMoveId = levelMove[1];
|
|
expect(pokemon.level).toBeGreaterThanOrEqual(levelReq);
|
|
expect(pokemon?.getMoveset()[newMovePos]?.moveId).toBe(levelMoveId);
|
|
});
|
|
|
|
/**
|
|
* Future Tests:
|
|
* If a Pokemon has four moves, the user can specify an old move to be forgotten and a new move will take its place.
|
|
* If a Pokemon has four moves, the user can reject the new move, keeping the moveset the same.
|
|
*/
|
|
});
|