mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-09 03:13:43 +01:00
`SINGLE_BATTLE_OVERRIDE` and `DOUBLE_BATTLE_OVERRIDE` are now `BATTLE_TYPE` Also updates all uses of the old overrides with the new one
52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import Phaser from "phaser";
|
|
import GameManager from "#app/test/utils/gameManager";
|
|
import Overrides from "#app/overrides";
|
|
import { Species } from "#enums/species";
|
|
import {
|
|
MoveEffectPhase,
|
|
} from "#app/phases";
|
|
import { Moves } from "#enums/moves";
|
|
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
|
|
import { allMoves } from "#app/data/move.js";
|
|
import { WeatherType } from "#app/data/weather.js";
|
|
import { Abilities } from "#app/enums/abilities.js";
|
|
|
|
describe("Weather - Fog", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(WeatherType.FOG);
|
|
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single");
|
|
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]);
|
|
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH);
|
|
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH);
|
|
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP);
|
|
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(new Array(4).fill(Moves.SPLASH));
|
|
});
|
|
|
|
it("move accuracy is multiplied by 90%", async () => {
|
|
const moveToCheck = allMoves[Moves.TACKLE];
|
|
|
|
vi.spyOn(moveToCheck, "calculateBattleAccuracy");
|
|
|
|
await game.startBattle([Species.MAGIKARP]);
|
|
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
|
|
await game.phaseInterceptor.to(MoveEffectPhase);
|
|
|
|
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(100 * 0.9);
|
|
});
|
|
});
|