import { allMoves } from "#app/data/move";
import { Abilities } from "#app/enums/abilities";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
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, vi } from "vitest";
describe("Abilities - Battery", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
const batteryMultiplier = 1.3;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("double");
game.override.enemySpecies(Species.SHUCKLE);
game.override.enemyAbility(Abilities.BALL_FETCH);
game.override.moveset([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]);
game.override.enemyMoveset(Moves.SPLASH);
it("raises the power of allies' special moves by 30%", async () => {
const moveToCheck = allMoves[Moves.DAZZLING_GLEAM];
const basePower = moveToCheck.power;
vi.spyOn(moveToCheck, "calculateBattlePower");
await game.startBattle([Species.PIKACHU, Species.CHARJABUG]);
game.move.select(Moves.DAZZLING_GLEAM);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower * batteryMultiplier);
it("does not raise the power of allies' non-special moves", async () => {
const moveToCheck = allMoves[Moves.BREAKING_SWIPE];
game.move.select(Moves.BREAKING_SWIPE);
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);
it("does not raise the power of the ability owner's special moves", async () => {
await game.startBattle([Species.CHARJABUG, Species.PIKACHU]);
await game.phaseInterceptor.to(TurnEndPhase);