pokerogue/test/abilities/aura-break.test.ts
Sirz Benjie 51d4c33de0
[Misc] Standardize-file-names (#6137)
* Standardize filenames to kebab-case

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>

* Move script outside of public folder

* Move update_exp_sprites to scripts

* Add ls-lint to lint file and directory names

* Update lefthook.yml to skip merge / rebase on all pre-commit commands

---------

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>
2025-07-24 16:38:31 -04:00

77 lines
2.5 KiB
TypeScript

import { allMoves } from "#data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { GameManager } from "#test/test-utils/game-manager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Abilities - Aura Break", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
const auraBreakMultiplier = ((9 / 16) * 4) / 3;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.battleStyle("single")
.moveset([MoveId.MOONBLAST, MoveId.DARK_PULSE])
.enemyMoveset(MoveId.SPLASH)
.enemyAbility(AbilityId.AURA_BREAK)
.enemySpecies(SpeciesId.SHUCKLE);
});
it("reverses the effect of Fairy Aura", async () => {
const moveToCheck = allMoves[MoveId.MOONBLAST];
const basePower = moveToCheck.power;
game.override.ability(AbilityId.FAIRY_AURA);
vi.spyOn(moveToCheck, "calculateBattlePower");
await game.classicMode.startBattle([SpeciesId.PIKACHU]);
game.move.select(MoveId.MOONBLAST);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(expect.closeTo(basePower * auraBreakMultiplier));
});
it("reverses the effect of Dark Aura", async () => {
const moveToCheck = allMoves[MoveId.DARK_PULSE];
const basePower = moveToCheck.power;
game.override.ability(AbilityId.DARK_AURA);
vi.spyOn(moveToCheck, "calculateBattlePower");
await game.classicMode.startBattle([SpeciesId.PIKACHU]);
game.move.select(MoveId.DARK_PULSE);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(expect.closeTo(basePower * auraBreakMultiplier));
});
it("has no effect if neither Fairy Aura nor Dark Aura are present", async () => {
const moveToCheck = allMoves[MoveId.MOONBLAST];
const basePower = moveToCheck.power;
game.override.ability(AbilityId.BALL_FETCH);
vi.spyOn(moveToCheck, "calculateBattlePower");
await game.classicMode.startBattle([SpeciesId.PIKACHU]);
game.move.select(MoveId.MOONBLAST);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);
});
});