Files
elysium/apps/api/src/services/apotheosis.ts
T
hikari a6f9844120 feat: add apotheosis third prestige layer and remove IDEAS.md
Apotheosis is the ultimate reset — wipes absolutely everything
including prestige and transcendence — in exchange for a pure
bragging-rights badge. No mechanical benefit whatsoever.

Unlock condition: all 15 Transcendence echo upgrades purchased.
Can be achieved multiple times; each cycle requires repurchasing
all Transcendence upgrades again.

What survives: Codex lore entries and lifetime profile statistics.
What is wiped: resources, prestige, runestones, transcendence data
(echoes, echo upgrades, multipliers), equipment, upgrades, bosses,
quests, zones, adventurers, achievements.

New files: Apotheosis.ts type, apotheosis service, apotheosis route,
ApotheosisPanel.tsx component.

Modified: GameState (apotheosis field), Api.ts, types/index.ts,
prestige service (carry apotheosis), transcendence service (carry
apotheosis), game.ts anti-cheat (cap apotheosis count), API client,
GameContext (apotheosis() function), GameLayout (new tab), ResourceBar
(gold apotheosis badge shown above transcendence and prestige badges),
styles.css, AboutPanel how-to-play.

Also removes IDEAS.md — all planned features are now implemented!
2026-03-07 02:37:08 -08:00

42 lines
1.7 KiB
TypeScript

import type { ApotheosisData, GameState } from "@elysium/types";
import { INITIAL_GAME_STATE } from "../data/initialState.js";
import { DEFAULT_TRANSCENDENCE_UPGRADES } from "../data/transcendenceUpgrades.js";
/** Total number of echo upgrades — all must be purchased to unlock Apotheosis */
const TOTAL_ECHO_UPGRADES = DEFAULT_TRANSCENDENCE_UPGRADES.length;
/**
* Returns true when the player is eligible to achieve Apotheosis:
* all Transcendence echo upgrades must be purchased.
*/
export const isEligibleForApotheosis = (state: GameState): boolean => {
const purchasedIds = state.transcendence?.purchasedUpgradeIds ?? [];
return purchasedIds.length >= TOTAL_ECHO_UPGRADES &&
DEFAULT_TRANSCENDENCE_UPGRADES.every((u) => purchasedIds.includes(u.id));
};
/**
* Builds the new game state after Apotheosis — the ultimate nuclear reset.
* Wipes absolutely everything including prestige and transcendence.
* Only codex lore entries and the apotheosis count itself are preserved.
*/
export const buildPostApotheosisState = (
currentState: GameState,
characterName: string,
): { newState: GameState; newApotheosisData: ApotheosisData } => {
const newCount = (currentState.apotheosis?.count ?? 0) + 1;
const newApotheosisData: ApotheosisData = { count: newCount };
const freshState = INITIAL_GAME_STATE(currentState.player, characterName);
const newState: GameState = {
...freshState,
lastTickAt: Date.now(),
// Codex lore persists through all resets — players keep their discovered entries
...(currentState.codex ? { codex: currentState.codex } : {}),
// Apotheosis data is eternal — never wiped by any reset
apotheosis: newApotheosisData,
};
return { newState, newApotheosisData };
};