fix: add missing ComboState type and default combo state
Some checks failed
Build and Publish Mana Loop Docker Image / build-and-publish (push) Has been cancelled

- Added ComboState interface to types.ts with count, maxCombo, multiplier, elementChain, decayTimer
- Added combo field to GameState interface
- Added default combo state to makeInitial() in store.ts
- Added combo and attunements to persist partialize function
- Fixes prerender error: 'Cannot read properties of undefined (reading count)'
This commit is contained in:
2026-03-27 18:05:49 +00:00
parent 3df971488a
commit af3f59b259
2 changed files with 19 additions and 0 deletions

View File

@@ -466,6 +466,13 @@ function makeInitial(overrides: Partial<GameState> = {}): GameState {
activeSpell: 'manaBolt',
currentAction: 'meditate',
castProgress: 0,
combo: {
count: 0,
maxCombo: 0,
multiplier: 1,
elementChain: [],
decayTimer: 0,
},
spells: startSpells,
skills: overrides.skills || {},
@@ -1669,6 +1676,7 @@ export const useGameStore = create<GameStore>()(
rawMana: state.rawMana,
meditateTicks: state.meditateTicks,
totalManaGathered: state.totalManaGathered,
attunements: state.attunements,
elements: state.elements,
currentFloor: state.currentFloor,
floorHP: state.floorHP,
@@ -1678,6 +1686,7 @@ export const useGameStore = create<GameStore>()(
activeSpell: state.activeSpell,
currentAction: state.currentAction,
castProgress: state.castProgress,
combo: state.combo,
spells: state.spells,
skills: state.skills,
skillProgress: state.skillProgress,

View File

@@ -270,6 +270,15 @@ export interface StudyTarget {
required: number; // Total hours needed
}
// Combo state for combat
export interface ComboState {
count: number; // Current combo hits
maxCombo: number; // Highest combo this session
multiplier: number; // Current damage multiplier
elementChain: string[]; // Last 3 elements used
decayTimer: number; // Hours until decay starts
}
export interface GameState {
// Time
day: number;
@@ -299,6 +308,7 @@ export interface GameState {
activeSpell: string;
currentAction: GameAction;
castProgress: number; // Progress towards next spell cast (0-1)
combo: ComboState; // Combat combo tracking
// Spells
spells: Record<string, SpellState>;