Fix Sub-Task 1: Spire UI Fixes (Bugs 1, 2, 3)
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 5m12s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 5m12s
- Bug 1: Floor health display now reactive (uses Zustand store properly) - Bug 2: Climb Down button now climbs floor-by-floor, exit only at floor 1 - Bug 3: Redesigned SpireTab as Spire Stats view, moved Enter Spire Mode button to SpireTab, moved activity log to SpireModeUI Changes: - Added climbDownFloor() action to store.ts - Modified exitSpireMode() to only work at floor 1 - Updated SpireTab.tsx: removed Current Floor stat, added Enter Spire Mode button - Updated page.tsx: Climb Down climbs one floor, added Exit Spire button at floor 1, moved activity log to SpireModeUI
This commit is contained in:
+45
-6
@@ -813,6 +813,7 @@ interface GameStore extends GameState, CraftingActions {
|
||||
|
||||
// Spire Mode actions
|
||||
enterSpireMode: () => void;
|
||||
climbDownFloor: () => void; // Climb down one floor at a time
|
||||
exitSpireMode: () => void;
|
||||
}
|
||||
|
||||
@@ -2018,13 +2019,51 @@ export const useGameStore = create<GameStore>()(
|
||||
}));
|
||||
},
|
||||
|
||||
// Exit Spire Mode - return to normal game UI
|
||||
// Climb down one floor (for Spire Mode)
|
||||
climbDownFloor: () => {
|
||||
set((state) => {
|
||||
const newFloor = Math.max(1, state.currentFloor - 1);
|
||||
if (newFloor === state.currentFloor) {
|
||||
// Already at floor 1, can't go down further
|
||||
return state;
|
||||
}
|
||||
|
||||
// Mark current floor as cleared (it will respawn when we come back)
|
||||
const clearedFloors = { ...state.clearedFloors };
|
||||
clearedFloors[state.currentFloor] = true;
|
||||
|
||||
// Check if new floor was cleared (needs respawn)
|
||||
const newFloorCleared = clearedFloors[newFloor];
|
||||
if (newFloorCleared) {
|
||||
delete clearedFloors[newFloor];
|
||||
}
|
||||
|
||||
return {
|
||||
currentFloor: newFloor,
|
||||
floorMaxHP: getFloorMaxHP(newFloor),
|
||||
floorHP: getFloorMaxHP(newFloor),
|
||||
maxFloorReached: Math.max(state.maxFloorReached, newFloor),
|
||||
clearedFloors,
|
||||
climbDirection: 'down' as const,
|
||||
equipmentSpellStates: state.equipmentSpellStates.map(s => ({ ...s, castProgress: 0 })),
|
||||
log: [`⬇️ Climbed down to floor ${newFloor}${newFloorCleared ? ' (respawned)' : ''}.`, ...state.log.slice(0, 49)],
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
// Exit Spire Mode - only works when at floor 1
|
||||
exitSpireMode: () => {
|
||||
set((state) => ({
|
||||
spireMode: false,
|
||||
currentAction: 'meditate',
|
||||
log: ['⬇️ Climbed down from the Spire. Returning to normal view.', ...state.log.slice(0, 49)],
|
||||
}));
|
||||
set((state) => {
|
||||
// Only allow exit if at floor 1 (bottom)
|
||||
if (state.currentFloor > 1) {
|
||||
return state; // Can't exit, need to climb down to floor 1 first
|
||||
}
|
||||
return {
|
||||
spireMode: false,
|
||||
currentAction: 'meditate',
|
||||
log: ['⬇️ Climbed down from the Spire. Returning to normal view.', ...state.log.slice(0, 49)],
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
togglePause: () => {
|
||||
|
||||
Reference in New Issue
Block a user