2024-09-01 21:21:56 -07:00
|
|
|
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";
|
|
|
|
|
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")
|
|
|
|
.moveset([Moves.SWORDS_DANCE, Moves.SPLASH])
|
|
|
|
.enemySpecies(Species.MAGIKARP)
|
|
|
|
.enemyAbility(Abilities.DANCER)
|
2024-09-09 09:55:11 -07: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 () => {
|
|
|
|
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);
|
2024-09-20 14:05:45 -07:00
|
|
|
});
|
2024-09-01 21:21:56 -07:00
|
|
|
});
|