2024-09-01 21:21:56 -07:00
|
|
|
import { BattlerIndex } from "#app/battle";
|
2025-01-12 15:33:05 -08:00
|
|
|
import type { MovePhase } from "#app/phases/move-phase";
|
2024-09-01 21:21:56 -07:00
|
|
|
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";
|
|
|
|
|
2024-09-20 14:05:45 -07:00
|
|
|
|
2024-09-01 21:21:56 -07:00
|
|
|
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")
|
2024-10-04 13:08:31 +08:00
|
|
|
.moveset([ Moves.SWORDS_DANCE, Moves.SPLASH ])
|
2024-09-01 21:21:56 -07:00
|
|
|
.enemySpecies(Species.MAGIKARP)
|
|
|
|
.enemyAbility(Abilities.DANCER)
|
2024-10-04 13:08:31 +08:00
|
|
|
.enemyMoveset([ Moves.VICTORY_DANCE ]);
|
2024-09-01 21:21:56 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
// Reference Link: https://bulbapedia.bulbagarden.net/wiki/Dancer_(Ability)
|
|
|
|
|
|
|
|
it("triggers when dance moves are used, doesn't consume extra PP", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.ORICORIO, Species.FEEBAS ]);
|
2024-09-01 21:21:56 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
const [ oricorio ] = game.scene.getPlayerField();
|
2024-09-01 21:21:56 -07:00
|
|
|
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
|
|
game.move.select(Moves.SWORDS_DANCE, 1);
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.setTurnOrder([ BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2 ]);
|
2024-09-01 21:21:56 -07:00
|
|
|
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);
|
2024-09-20 14:05:45 -07:00
|
|
|
});
|
2024-09-01 21:21:56 -07:00
|
|
|
});
|