From 17c13115dd446c9fbb1dad78a2bd7b447327386f Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Sun, 14 Sep 2025 19:20:24 -0400 Subject: [PATCH] Reworked `STARTING_WAVE_OVERRIDE` to use `null` as a default value + fixed `startingWave` jank --- src/battle-scene.ts | 2 +- src/data/balance/misc.ts | 2 ++ src/overrides.ts | 7 ++++++- src/starting-wave.ts | 3 --- test/test-utils/helpers/overrides-helper.ts | 9 ++++++--- 5 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 src/data/balance/misc.ts delete mode 100644 src/starting-wave.ts diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 374cf3f270f..7bbe330fdf3 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -21,10 +21,10 @@ import { FieldSpritePipeline } from "#app/pipelines/field-sprite"; import { InvertPostFX } from "#app/pipelines/invert"; import { SpritePipeline } from "#app/pipelines/sprite"; import { SceneBase } from "#app/scene-base"; -import { startingWave } from "#app/starting-wave"; import { TimedEventManager } from "#app/timed-event-manager"; import { UiInputs } from "#app/ui-inputs"; import { biomeDepths, getBiomeName } from "#balance/biomes"; +import { startingWave } from "#balance/misc"; import { pokemonPrevolutions } from "#balance/pokemon-evolutions"; import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#balance/starters"; import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets } from "#data/battle-anims"; diff --git a/src/data/balance/misc.ts b/src/data/balance/misc.ts new file mode 100644 index 00000000000..feb9be2d680 --- /dev/null +++ b/src/data/balance/misc.ts @@ -0,0 +1,2 @@ +/** The default wave that new runs start at. */ +export const startingWave = 1; \ No newline at end of file diff --git a/src/overrides.ts b/src/overrides.ts index 9f6b4ced3a2..18f7472e186 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -73,7 +73,12 @@ class DefaultOverrides { * If `"odd-doubles"`, follow the `"double"` rule on odd wave numbers, and follow the `"single"` rule on even wave numbers. */ readonly BATTLE_STYLE_OVERRIDE: BattleStyle | null = null; - readonly STARTING_WAVE_OVERRIDE: number = 0; + /** + * If present and non-null, will override the starting wave # when starting a new run. + * Should never be set to a negative value. + * @defaultValue `null` + */ + readonly STARTING_WAVE_OVERRIDE: number | null = null; readonly STARTING_BIOME_OVERRIDE: BiomeId | null = null; readonly ARENA_TINT_OVERRIDE: TimeOfDay | null = null; /** Multiplies XP gained by this value including 0. Set to null to ignore the override. */ diff --git a/src/starting-wave.ts b/src/starting-wave.ts deleted file mode 100644 index 7dbcffebbfe..00000000000 --- a/src/starting-wave.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Overrides from "#app/overrides"; - -export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1; diff --git a/test/test-utils/helpers/overrides-helper.ts b/test/test-utils/helpers/overrides-helper.ts index da0d75bf564..c7c5584dfa8 100644 --- a/test/test-utils/helpers/overrides-helper.ts +++ b/test/test-utils/helpers/overrides-helper.ts @@ -62,11 +62,14 @@ export class OverridesHelper extends GameManagerHelper { } /** - * Override the starting wave index - * @param wave - The wave to set. Classic: `1`-`200` + * Override the starting wave index. + * @param wave - The wave to set, or `null` to disable the override. * @returns `this` */ - public startingWave(wave: number): this { + public startingWave(wave: number | null): this { + if (wave != null && wave <= 0) { + throw new Error("Attempted to set invalid wave index: " + wave.toString()); + } vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(wave); this.log(`Starting wave set to ${wave}!`); return this;