mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-02 06:25:08 +01:00
* Make `OPP_MOVESET_OVERRIDE` fully override the enemy's moveset * Update tests with new override behavior * Fix tests * Fix another test * Move overrides no longer required to be arrays * Remove `SPLASH_ONLY` test utility variable * Update moveset override helper functions * Missed some tests
65 lines
2.3 KiB
TypeScript
65 lines
2.3 KiB
TypeScript
import { BattlerIndex } from "#app/battle";
|
|
import { MovePhase } from "#app/phases/move-phase";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import GameManager from "#test/utils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
const TIMEOUT = 20 * 1000;
|
|
|
|
describe("Abilities - Dancer", () => {
|
|
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
|
|
.battleType("double")
|
|
.moveset([Moves.SWORDS_DANCE, Moves.SPLASH])
|
|
.enemySpecies(Species.MAGIKARP)
|
|
.enemyAbility(Abilities.DANCER)
|
|
.enemyMoveset([Moves.VICTORY_DANCE]);
|
|
});
|
|
|
|
// Reference Link: https://bulbapedia.bulbagarden.net/wiki/Dancer_(Ability)
|
|
|
|
it("triggers when dance moves are used, doesn't consume extra PP", async () => {
|
|
await game.classicMode.startBattle([Species.ORICORIO, Species.FEEBAS]);
|
|
|
|
const [oricorio] = game.scene.getPlayerField();
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
game.move.select(Moves.SWORDS_DANCE, 1);
|
|
await game.setTurnOrder([BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2]);
|
|
await game.phaseInterceptor.to("MovePhase");
|
|
// immediately copies ally move
|
|
await game.phaseInterceptor.to("MovePhase", false);
|
|
let currentPhase = game.scene.getCurrentPhase() as MovePhase;
|
|
expect(currentPhase.pokemon).toBe(oricorio);
|
|
expect(currentPhase.move.moveId).toBe(Moves.SWORDS_DANCE);
|
|
await game.phaseInterceptor.to("MoveEndPhase");
|
|
await game.phaseInterceptor.to("MovePhase");
|
|
// immediately copies enemy move
|
|
await game.phaseInterceptor.to("MovePhase", false);
|
|
currentPhase = game.scene.getCurrentPhase() as MovePhase;
|
|
expect(currentPhase.pokemon).toBe(oricorio);
|
|
expect(currentPhase.move.moveId).toBe(Moves.VICTORY_DANCE);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
// doesn't use PP if copied move is also in moveset
|
|
expect(oricorio.moveset[0]?.ppUsed).toBe(0);
|
|
}, TIMEOUT);
|
|
});
|