add game.override.battleType

This commit is contained in:
Felix Staud 2024-07-25 14:36:46 -07:00
parent e33888e5f5
commit 3788631846

View File

@ -30,7 +30,7 @@ export class OverridesHelper {
/** /**
* Override the starting wave (index) * Override the starting wave (index)
* @param wave the wave (index) to set. Classic: `1`-`200` * @param wave the wave (index) to set. Classic: `1`-`200`
* @returns spy instance * @returns this
*/ */
startingWave(wave: number): this { startingWave(wave: number): this {
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(wave); vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(wave);
@ -40,8 +40,8 @@ export class OverridesHelper {
/** /**
* Override each wave to have or not have standard trainer battles * Override each wave to have or not have standard trainer battles
* @returns spy instance * @returns this
* @param disable - true * @param disable true
*/ */
disableTrainerWaves(disable: boolean): this { disableTrainerWaves(disable: boolean): this {
const realFn = getGameMode; const realFn = getGameMode;
@ -57,7 +57,7 @@ export class OverridesHelper {
/** /**
* Override the weather (type) * Override the weather (type)
* @param type weather type to set * @param type weather type to set
* @returns spy instance * @returns this
*/ */
weather(type: WeatherType): this { weather(type: WeatherType): this {
vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(type); vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(type);
@ -68,7 +68,7 @@ export class OverridesHelper {
/** /**
* Override the seed * Override the seed
* @param seed the seed to set * @param seed the seed to set
* @returns spy instance * @returns this
*/ */
seed(seed: string): this { seed(seed: string): this {
vi.spyOn(this.game.scene, "resetSeed").mockImplementation(() => { vi.spyOn(this.game.scene, "resetSeed").mockImplementation(() => {
@ -81,6 +81,17 @@ export class OverridesHelper {
return this; return this;
} }
/**
* Override the battle type (single or double)
* @param battleType battle type to set
* @returns this
*/
battleType(battleType: "single" | "double"): this {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue(battleType);
this.log(`Battle type set to ${battleType} only!`);
return this;
}
private log(...params: any[]) { private log(...params: any[]) {
console.log("Overrides:", ...params); console.log("Overrides:", ...params);
} }