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
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:
@@ -466,6 +466,13 @@ function makeInitial(overrides: Partial<GameState> = {}): GameState {
|
|||||||
activeSpell: 'manaBolt',
|
activeSpell: 'manaBolt',
|
||||||
currentAction: 'meditate',
|
currentAction: 'meditate',
|
||||||
castProgress: 0,
|
castProgress: 0,
|
||||||
|
combo: {
|
||||||
|
count: 0,
|
||||||
|
maxCombo: 0,
|
||||||
|
multiplier: 1,
|
||||||
|
elementChain: [],
|
||||||
|
decayTimer: 0,
|
||||||
|
},
|
||||||
|
|
||||||
spells: startSpells,
|
spells: startSpells,
|
||||||
skills: overrides.skills || {},
|
skills: overrides.skills || {},
|
||||||
@@ -1669,6 +1676,7 @@ export const useGameStore = create<GameStore>()(
|
|||||||
rawMana: state.rawMana,
|
rawMana: state.rawMana,
|
||||||
meditateTicks: state.meditateTicks,
|
meditateTicks: state.meditateTicks,
|
||||||
totalManaGathered: state.totalManaGathered,
|
totalManaGathered: state.totalManaGathered,
|
||||||
|
attunements: state.attunements,
|
||||||
elements: state.elements,
|
elements: state.elements,
|
||||||
currentFloor: state.currentFloor,
|
currentFloor: state.currentFloor,
|
||||||
floorHP: state.floorHP,
|
floorHP: state.floorHP,
|
||||||
@@ -1678,6 +1686,7 @@ export const useGameStore = create<GameStore>()(
|
|||||||
activeSpell: state.activeSpell,
|
activeSpell: state.activeSpell,
|
||||||
currentAction: state.currentAction,
|
currentAction: state.currentAction,
|
||||||
castProgress: state.castProgress,
|
castProgress: state.castProgress,
|
||||||
|
combo: state.combo,
|
||||||
spells: state.spells,
|
spells: state.spells,
|
||||||
skills: state.skills,
|
skills: state.skills,
|
||||||
skillProgress: state.skillProgress,
|
skillProgress: state.skillProgress,
|
||||||
|
|||||||
@@ -270,6 +270,15 @@ export interface StudyTarget {
|
|||||||
required: number; // Total hours needed
|
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 {
|
export interface GameState {
|
||||||
// Time
|
// Time
|
||||||
day: number;
|
day: number;
|
||||||
@@ -299,6 +308,7 @@ export interface GameState {
|
|||||||
activeSpell: string;
|
activeSpell: string;
|
||||||
currentAction: GameAction;
|
currentAction: GameAction;
|
||||||
castProgress: number; // Progress towards next spell cast (0-1)
|
castProgress: number; // Progress towards next spell cast (0-1)
|
||||||
|
combo: ComboState; // Combat combo tracking
|
||||||
|
|
||||||
// Spells
|
// Spells
|
||||||
spells: Record<string, SpellState>;
|
spells: Record<string, SpellState>;
|
||||||
|
|||||||
Reference in New Issue
Block a user