chore: golemancy redesign cleanup — remove orphaned legacy code and update docs
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m19s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m19s
This commit is contained in:
@@ -19,6 +19,8 @@ export interface ManaState {
|
||||
meditateTicks: number;
|
||||
totalManaGathered: number;
|
||||
elements: Record<string, ElementState>;
|
||||
/** Per-element net regen rates (from unified conversion system) */
|
||||
elementRegen: Record<string, number>;
|
||||
}
|
||||
|
||||
// ─── Mana Actions ────────────────────────────────────────────────────────────
|
||||
@@ -40,6 +42,7 @@ export interface ManaActions {
|
||||
spendElementMana: (element: string, amount: number) => Result<void>;
|
||||
setElementMax: (max: number) => void;
|
||||
computeElementMaxWithBonuses: (perElementBonuses: Record<string, number>) => void;
|
||||
setElementRegen: (regen: Record<string, number>) => void;
|
||||
|
||||
// Reset
|
||||
resetMana: (prestigeUpgrades: Record<string, number>) => void;
|
||||
@@ -66,6 +69,7 @@ export const useManaStore = create<ManaStore>()(
|
||||
}
|
||||
])
|
||||
) as Record<string, ElementState>,
|
||||
elementRegen: {},
|
||||
|
||||
setRawMana: (amount: number) => {
|
||||
set({ rawMana: Math.max(0, amount) });
|
||||
@@ -148,17 +152,21 @@ export const useManaStore = create<ManaStore>()(
|
||||
});
|
||||
},
|
||||
|
||||
setElementRegen: (regen: Record<string, number>) => {
|
||||
set({ elementRegen: regen });
|
||||
},
|
||||
|
||||
resetMana: (prestigeUpgrades: Record<string, number>) => {
|
||||
const elementMax = 10 + (prestigeUpgrades.elementalAttune || 0) * 25;
|
||||
const startingMana = 10 + (prestigeUpgrades.manaStart || 0) * 10;
|
||||
set({ rawMana: startingMana, meditateTicks: 0, totalManaGathered: 0, elements: makeInitialElements(elementMax, prestigeUpgrades) });
|
||||
set({ rawMana: startingMana, meditateTicks: 0, totalManaGathered: 0, elements: makeInitialElements(elementMax, prestigeUpgrades), elementRegen: {} });
|
||||
},
|
||||
}),
|
||||
{
|
||||
storage: createSafeStorage(),
|
||||
name: 'mana-loop-mana',
|
||||
version: 2,
|
||||
partialize: (state) => ({ rawMana: state.rawMana, meditateTicks: state.meditateTicks, totalManaGathered: state.totalManaGathered, elements: state.elements }),
|
||||
partialize: (state) => ({ rawMana: state.rawMana, meditateTicks: state.meditateTicks, totalManaGathered: state.totalManaGathered, elements: state.elements, elementRegen: state.elementRegen }),
|
||||
migrate: (persistedState: any, _version) => {
|
||||
if (persistedState && persistedState.elements) {
|
||||
for (const k of Object.keys(persistedState.elements)) {
|
||||
|
||||
Reference in New Issue
Block a user