Reworked STARTING_WAVE_OVERRIDE to use null as a default value + fixed startingWave jank

This commit is contained in:
Bertie690 2025-09-14 19:20:24 -04:00
parent a49cc74916
commit 17c13115dd
5 changed files with 15 additions and 8 deletions

View File

@ -21,10 +21,10 @@ import { FieldSpritePipeline } from "#app/pipelines/field-sprite";
import { InvertPostFX } from "#app/pipelines/invert"; import { InvertPostFX } from "#app/pipelines/invert";
import { SpritePipeline } from "#app/pipelines/sprite"; import { SpritePipeline } from "#app/pipelines/sprite";
import { SceneBase } from "#app/scene-base"; import { SceneBase } from "#app/scene-base";
import { startingWave } from "#app/starting-wave";
import { TimedEventManager } from "#app/timed-event-manager"; import { TimedEventManager } from "#app/timed-event-manager";
import { UiInputs } from "#app/ui-inputs"; import { UiInputs } from "#app/ui-inputs";
import { biomeDepths, getBiomeName } from "#balance/biomes"; import { biomeDepths, getBiomeName } from "#balance/biomes";
import { startingWave } from "#balance/misc";
import { pokemonPrevolutions } from "#balance/pokemon-evolutions"; import { pokemonPrevolutions } from "#balance/pokemon-evolutions";
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#balance/starters"; import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#balance/starters";
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets } from "#data/battle-anims"; import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets } from "#data/battle-anims";

2
src/data/balance/misc.ts Normal file
View File

@ -0,0 +1,2 @@
/** The default wave that new runs start at. */
export const startingWave = 1;

View File

@ -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. * 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 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 STARTING_BIOME_OVERRIDE: BiomeId | null = null;
readonly ARENA_TINT_OVERRIDE: TimeOfDay | null = null; readonly ARENA_TINT_OVERRIDE: TimeOfDay | null = null;
/** Multiplies XP gained by this value including 0. Set to null to ignore the override. */ /** Multiplies XP gained by this value including 0. Set to null to ignore the override. */

View File

@ -1,3 +0,0 @@
import Overrides from "#app/overrides";
export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1;

View File

@ -62,11 +62,14 @@ export class OverridesHelper extends GameManagerHelper {
} }
/** /**
* Override the starting wave index * Override the starting wave index.
* @param wave - The wave to set. Classic: `1`-`200` * @param wave - The wave to set, or `null` to disable the override.
* @returns `this` * @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); vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(wave);
this.log(`Starting wave set to ${wave}!`); this.log(`Starting wave set to ${wave}!`);
return this; return this;