3.9 KiB
3.9 KiB
PLAN: SpireTab Refresh & Casting Fixes
Phase 1: Fix Cast Bar Not Updating
- Audit
SpireTab.tsxcast progress subscription- Check if
useCombatStore((s) => s.castProgress)is properly subscribed - Verify the progress bar component receives the latest
castProgressvalue
- Check if
- Check
combatStore.tsforcastProgressupdates- Ensure
processCombatTick()properly updatescastProgressin state - Verify
set({ castProgress })is called with correct value (0-1 range)
- Ensure
- Fix Zustand subscription if broken
- Use
useCombatStore((s) => s.castProgress)with proper selector - Ensure component re-renders when
castProgresschanges
- Use
Phase 2: Fix Casting Not Costing Mana
- Audit
combat-actions.tsmana deduction- Verify
deductSpellCost()is called when spell completes - Check
canAffordSpellCost()is checked before casting starts
- Verify
- Ensure
rawMana/elementsstate updates- Confirm
deductSpellCost()returns updated state - Verify
combatStorepasses correct state toprocessCombatTick()
- Confirm
- Test with modular stores only
- Use
useManaStorefromstores/manaStore(not legacy) - Verify
deductSpellCostfromutils/(not legacystore-modules/)
- Use
Phase 3: Make SpireTab Full-Screen (No Study/Crafting)
- Remove study components when
simpleMode=true- In
SpireTab.tsx, conditionally render study progress ONLY if!simpleMode - Remove
currentStudyTargetsubscription when in spire mode
- In
- Remove crafting progress components
- Conditionally render crafting progress ONLY if
!simpleMode - Remove
designProgress,preparationProgress, etc. when in spire
- Conditionally render crafting progress ONLY if
- Add "Climb Down to Exit" button
- Add button in
FloorControls.tsxorSpireTab.tsx - Button calls
exitSpireMode()fromcombatStore - Visible only when
simpleMode=true(in spire)
- Add button in
Phase 4: Refresh SpireTab Layout
- Reorganize component sections
- Clear order: SpireHeader → Combat Info → Floor Controls → Activity Log
- Remove redundant elements (duplicated stats, etc.)
- Improve visual hierarchy
- Use consistent card layouts
- Proper spacing between sections
- Clear headings for each section
- Clean up confusing elements
- Remove any UI that's irrelevant to spire (study, crafting, etc.)
- Simplify floor controls for combat focus
Phase 5: Enforce Modular Stores Only
- Audit all imports in modified files
SpireTab.tsx: Ensure NO imports fromstore.tsorstore-modules/combat-actions.ts: Useutils/for helperscombatStore.ts: Already uses modular stores (verify)
- Replace any legacy imports
- Search for
@/lib/game/storeor@/lib/game/store-modulesin modified files - Replace with
@/lib/game/stores/or@/lib/game/utils/
- Search for
Phase 6: Add Regression Tests
- Create
spire-tab-refresh.test.ts- Test cast progress updates during combat ticks
- Test mana costs deducted when spells cast
- Test
simpleModehides study/crafting components - Test "Climb Down" button exits spire mode
- Add to
stores/__tests__/directory- Follow existing test patterns (Vitest)
- Mock store state as needed
- Assert acceptance criteria from SPEC
Files to Modify (Summary)
| File | Changes |
|---|---|
src/components/game/tabs/SpireTab.tsx |
Fix cast bar, remove study/crafting in spire, refresh layout |
src/components/game/tabs/FloorControls.tsx |
Add "Climb Down" button |
src/lib/game/stores/combat-actions.ts |
Verify mana deduction logic |
src/lib/game/stores/combatStore.ts |
Ensure castProgress updates correctly |
src/lib/game/stores/__tests__/spire-tab-refresh.test.ts |
New regression tests |
Verification Before Implementation
- ☑ All SPEC acceptance criteria mapped to plan items above
- ☑ No legacy store imports in plan
- ☑ All files <400 lines (combat-actions.ts is 117 lines, OK)
- ☑ Tests planned for all fixed issues