pokerogue/src/test/game-mode.test.ts
RedstonewolfX 06331ccdf6
[Daily] Daily standardization (#3776)
* Disable Luck in Daily Runs

If the Game Mode is Daily Run, the player's Luck is set to 0, and the Luck value is hidden.

* Give free map in daily

Adds a Map to the player's pool of starting items for Daily Runs.

* Disable Eviolite in Daily Runs

Disables Eviolite spawning in Daily Run mode.

* Write shop test and add new overrides

Adds new overrides that allow you to force content to be locked or unlocked
These overrides were also added to the OverridesHelper to make them available to tests

Adds a new check function for content unlocks, which returns `true` if it is overrode to be unlocked, `false` if it is overrode to be locked, and the unlock data mapped to a Boolean otherwise

All existing checks (other than the ones that involve actually unlocking things) for unlockables have been changed to use this

Added a pair of new exporting booleans, specifically for my test, that check if Eviolite or Mini Black Hole are in the loot table

* Prevent shinies from altering runs

Places variant rolls inside of an ExecuteWithSeedOffset block, using the current floor's RNG seed as the seed and the Pokémon's ID as the offset.

---------

Co-authored-by: Leo Kim <47556641+KimJeongSun@users.noreply.github.com>
Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com>
2024-09-26 01:39:59 -07:00

47 lines
1.8 KiB
TypeScript

import { GameMode, GameModes, getGameMode } from "#app/game-mode";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import * as Utils from "../utils";
import GameManager from "./utils/gameManager";
describe("game-mode", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
});
beforeEach(() => {
game = new GameManager(phaserGame);
});
describe("classic", () => {
let classicGameMode: GameMode;
beforeEach(() => {
classicGameMode = getGameMode(GameModes.CLASSIC);
});
it("does NOT spawn trainers within 3 waves of fixed battle", () => {
const { arena } = game.scene;
/** set wave 16 to be a fixed trainer fight meaning wave 13-19 don't allow trainer spawns */
vi.spyOn(classicGameMode, "isFixedBattle").mockImplementation(
(n: number) => (n === 16 ? true : false)
);
vi.spyOn(arena, "getTrainerChance").mockReturnValue(1);
vi.spyOn(Utils, "randSeedInt").mockReturnValue(0);
expect(classicGameMode.isWaveTrainer(11, arena)).toBeFalsy();
expect(classicGameMode.isWaveTrainer(12, arena)).toBeTruthy();
expect(classicGameMode.isWaveTrainer(13, arena)).toBeFalsy();
expect(classicGameMode.isWaveTrainer(14, arena)).toBeFalsy();
expect(classicGameMode.isWaveTrainer(15, arena)).toBeFalsy();
// Wave 16 is a fixed trainer battle
expect(classicGameMode.isWaveTrainer(17, arena)).toBeFalsy();
expect(classicGameMode.isWaveTrainer(18, arena)).toBeFalsy();
expect(classicGameMode.isWaveTrainer(19, arena)).toBeFalsy();
});
});
});