extend overridesHelper

This commit is contained in:
Felix Staud 2024-07-16 16:41:30 -07:00
parent 944197330c
commit 391054c8e0
1 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,4 @@
import { Weather, WeatherType } from "#app/data/weather.js";
import { Biome } from "#app/enums/biome"; import { Biome } from "#app/enums/biome";
import * as Overrides from "#app/overrides"; import * as Overrides from "#app/overrides";
import { vi } from "vitest"; import { vi } from "vitest";
@ -9,7 +10,7 @@ export class OverridesHelper {
constructor() {} constructor() {}
/** /**
* Set the encounter chance for a mystery encounter. * Override the encounter chance for a mystery encounter.
* @param percentage the encounter chance in % * @param percentage the encounter chance in %
*/ */
mysteryEncounterChance(percentage: number) { mysteryEncounterChance(percentage: number) {
@ -20,7 +21,7 @@ export class OverridesHelper {
} }
/** /**
* Set the starting biome * Override the starting biome
* @warning The biome will not be overridden unless you call `workaround_reInitSceneWithOverrides()` (testUtils) * @warning The biome will not be overridden unless you call `workaround_reInitSceneWithOverrides()` (testUtils)
* @param biome the biome to set * @param biome the biome to set
*/ */
@ -30,8 +31,7 @@ export class OverridesHelper {
} }
/** /**
* Set 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`
*/ */
startingWave(wave: number) { startingWave(wave: number) {
@ -39,6 +39,25 @@ export class OverridesHelper {
this.log(`Starting wave set to ${wave}!`); this.log(`Starting wave set to ${wave}!`);
} }
/**
* Override the weather (type)
* @param type weather type to set
*/
weather(type: WeatherType) {
vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(type);
this.log(`Weather set to ${Weather[type]} (=${type})!`);
}
/**
* Override the seed
* @warning The seed will not be overridden unless you call `workaround_reInitSceneWithOverrides()` (testUtils)
* @param seed the seed to set
*/
seed(seed: string) {
vi.spyOn(Overrides, "SEED_OVERRIDE", "get").mockReturnValue(seed);
this.log(`Seed set to "${seed}"!`);
}
private log(...params: any[]) { private log(...params: any[]) {
console.log("Overrides:", ...params); console.log("Overrides:", ...params);
} }