fix: preserve autoQuest and autoBoss settings across prestige
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m3s
CI / Lint, Build & Test (pull_request) Successful in 1m9s

Resolves #51 — after a prestige the post-prestige state was built from
initialGameState which hard-codes both flags to false, so auto-quest and
auto-boss would silently turn off mid-run even if the player had them
enabled. buildPostPrestigeState now carries the live values forward so
automation preferences survive the reset.
This commit is contained in:
2026-03-18 12:48:41 -07:00
committed by Naomi Carrigan
parent 03b6c847b3
commit 425b55ec9e
+10
View File
@@ -5,6 +5,7 @@
* @author Naomi Carrigan * @author Naomi Carrigan
*/ */
/* eslint-disable max-lines-per-function -- buildPostPrestigeState requires constructing a large composite state object */ /* eslint-disable max-lines-per-function -- buildPostPrestigeState requires constructing a large composite state object */
/* eslint-disable complexity -- buildPostPrestigeState has many optional fields that each add a branch point */
import { initialGameState } from "../data/initialState.js"; import { initialGameState } from "../data/initialState.js";
import { defaultPrestigeUpgrades } from "../data/prestigeUpgrades.js"; import { defaultPrestigeUpgrades } from "../data/prestigeUpgrades.js";
import type { import type {
@@ -239,8 +240,17 @@ const buildPostPrestigeState = (
const prestigeState: GameState = { const prestigeState: GameState = {
...freshState, ...freshState,
// Achievements are permanent — earned achievements survive all prestiges // Achievements are permanent — earned achievements survive all prestiges
achievements: currentState.achievements, achievements: currentState.achievements,
/*
* Preserve automation preferences across prestige — the player explicitly
* opted into these settings and would not expect them to silently reset.
*/
autoBoss: currentState.autoBoss ?? false,
autoQuest: currentState.autoQuest ?? false,
// Boss statuses reset for gameplay, but first-kill claimed flag is preserved // Boss statuses reset for gameplay, but first-kill claimed flag is preserved
bosses: bossesWithBountyClaimed, bosses: bossesWithBountyClaimed,
lastTickAt: Date.now(), lastTickAt: Date.now(),