generated from nhcarrigan/template
feat: goddess sync, sanitize, and apotheosis init (chunk 3)
- initialState: add initialGoddessState() with all goddess sub-objects - apotheosis: init GoddessState on first apotheosis, preserve on subsequent - game: add goddessSpread block in validateAndSanitize (server-only fields capped, forward-only boss/quest/achievement enforcement) - debug: add injectMissingGoddessExplorationAreas helper and inject all 8 goddess content arrays in syncNewContent - vitest.config.ts: remove 8 goddess data files from coverage exclude (now imported via initialState) - tests: full coverage for all new code (482 tests, 100% coverage)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { initialGameState } from "../data/initialState.js";
|
||||
import { initialGameState, initialGoddessState } from "../data/initialState.js";
|
||||
import {
|
||||
defaultTranscendenceUpgrades,
|
||||
} from "../data/transcendenceUpgrades.js";
|
||||
@@ -47,6 +47,15 @@ const buildPostApotheosisState = (
|
||||
const updatedApotheosisData: ApotheosisData = { count: apotheosisCount };
|
||||
|
||||
const freshState = initialGameState(currentState.player, characterName);
|
||||
|
||||
// Goddess state: initialised on first apotheosis, preserved on subsequent resets
|
||||
let goddessSpread: object = {};
|
||||
if (apotheosisCount === 1) {
|
||||
goddessSpread = { goddess: initialGoddessState() };
|
||||
} else if (currentState.goddess !== undefined) {
|
||||
goddessSpread = { goddess: currentState.goddess };
|
||||
}
|
||||
|
||||
const updatedState: GameState = {
|
||||
...freshState,
|
||||
lastTickAt: Date.now(),
|
||||
@@ -60,6 +69,7 @@ const buildPostApotheosisState = (
|
||||
...currentState.story
|
||||
? { story: currentState.story }
|
||||
: {},
|
||||
...goddessSpread,
|
||||
};
|
||||
|
||||
return { updatedApotheosisData, updatedState };
|
||||
|
||||
Reference in New Issue
Block a user