mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
* Rename `Abilities` to `AbilityId` * Rename `abilities.ts` to `ability-id.ts` * Rename `Moves` to `MoveId` * Rename `moves.ts` to `move-id.ts` * Rename `Species` to `SpeciesId` * Rename `species.ts` to `species-id.ts` * Rename `Biome` to `BiomeId` * Rename `biome.ts` to `biome-id.ts` * Replace `Abilities` with `AbilityId` in comments * Replace `Biome` with `BiomeId` in comments * Replace `Moves` with `MoveId` in comments * Replace `Species` with `SpeciesId` in comments
77 lines
2.5 KiB
TypeScript
77 lines
2.5 KiB
TypeScript
import { allMoves } from "#app/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/testUtils/gameManager";
|
|
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);
|
|
});
|
|
});
|