generated from nhcarrigan/template
fix: preserve autoQuest and autoBoss settings across prestige
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:
@@ -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(),
|
||||||
|
|||||||
Reference in New Issue
Block a user