generated from nhcarrigan/template
fix: preserve autoQuest and autoBoss settings across prestige (#66)
## Summary - `buildPostPrestigeState` was constructing the post-prestige `GameState` from `initialGameState`, which hard-codes `autoQuest` and `autoBoss` to `false` - Neither flag was being carried forward, so both automation settings silently reset after every prestige - Now both values are explicitly preserved from `currentState` (with `?? false` fallback for safety) Closes #51 ✨ This issue was created with help from Hikari~ 🌸 Reviewed-on: #66 Co-authored-by: Hikari <hikari@nhcarrigan.com> Co-committed-by: Hikari <hikari@nhcarrigan.com>
This commit was merged in pull request #66.
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,11 +240,20 @@ 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(),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fold current-run totals into lifetime stats so the GameState reflects
|
* Fold current-run totals into lifetime stats so the GameState reflects
|
||||||
|
|||||||
Reference in New Issue
Block a user