Fix 3 bugs: equip crash, enchantment not processing, spire spell casting
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m43s

Bug 1: EquipmentTab handleEquip was passing useCombatStore to equipItem()
which needs the crafting store (has equipmentInstances/equippedInstances).
Fixed by using useCraftingStore instead.

Bug 2: processCraftingTick() from crafting-slice.ts was never called in the
game tick loop. Added call in tick-logic.ts when currentAction is
'design'/'prepare'/'enchant'/'craft' so enchantment progress advances.

Bug 3: equipmentSpellStates was initialized as [] and never populated from
equipped items. Added logic in tick-logic.ts to build equipmentSpellStates
from active equipment spells when climbing (currentAction === 'climb').
This commit is contained in:
2026-05-11 12:07:12 +02:00
parent ae0bf3e38d
commit f6bf049f91
5 changed files with 874 additions and 4 deletions
+18
View File
@@ -0,0 +1,18 @@
# Circular Dependencies
Generated: 2026-05-11T09:20:28.554Z
Found: 8 circular chain(s) — these MUST be fixed before modifying involved files.
1. Processed 161 files (4.4s) (31 warnings)
2. 1) data/equipment/index.ts > data/equipment/utils.ts
3. 2) data/golems/index.ts > data/golems/utils.ts
4. 3) stores/combat-actions.ts > stores/combatStore.ts
5. 4) stores/combatStore.ts > stores/gameStore.ts
6. 5) stores/combatStore.ts > stores/gameStore.ts > stores/gameActions.ts
7. 6) stores/combatStore.ts > stores/gameStore.ts > stores/gameActions.ts > stores/skillStore.ts
8. 7) stores/combatStore.ts > stores/gameStore.ts > stores/gameLoopActions.ts
## How to fix
1. Identify which import in the chain can be extracted to a shared types/utils file.
2. Move the shared type or function there.
3. Both files import from the new shared module instead of each other.
4. Run: bunx madge --circular src/lib/game (should return clean)
+818
View File
@@ -0,0 +1,818 @@
{
"_meta": {
"generated": "2026-05-11T09:20:23.712Z",
"description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.",
"usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry."
},
"graph": {
"attunements/data.ts": [
"types.ts"
],
"attunements/index.ts": [
"attunements/data.ts",
"attunements/types.ts",
"attunements/utils.ts"
],
"attunements/types.ts": [],
"attunements/utils.ts": [
"attunements/data.ts",
"attunements/types.ts"
],
"computed-stats.ts": [
"utils/index.ts"
],
"constants.ts": [
"constants/index.ts"
],
"constants/core.ts": [],
"constants/elements.ts": [
"types.ts"
],
"constants/guardians.ts": [
"types.ts"
],
"constants/index.ts": [
"constants/core.ts",
"constants/elements.ts",
"constants/guardians.ts",
"constants/prestige.ts",
"constants/rooms.ts",
"constants/skills.ts",
"constants/spells.ts"
],
"constants/prestige.ts": [
"types.ts"
],
"constants/rooms.ts": [],
"constants/skills.ts": [
"types.ts"
],
"constants/spells-modules/advanced-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells-modules/aoe-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells-modules/basic-elemental-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells-modules/compound-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells-modules/enchantment-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells-modules/legendary-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells-modules/lightning-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells-modules/master-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells-modules/raw-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells-modules/utility-spells.ts": [
"constants/elements.ts",
"types.ts"
],
"constants/spells.ts": [
"constants/spells-modules/advanced-spells.ts",
"constants/spells-modules/aoe-spells.ts",
"constants/spells-modules/basic-elemental-spells.ts",
"constants/spells-modules/compound-spells.ts",
"constants/spells-modules/enchantment-spells.ts",
"constants/spells-modules/legendary-spells.ts",
"constants/spells-modules/lightning-spells.ts",
"constants/spells-modules/master-spells.ts",
"constants/spells-modules/raw-spells.ts",
"constants/spells-modules/utility-spells.ts",
"types.ts"
],
"crafting-actions/application-actions.ts": [
"crafting-apply.ts",
"types.ts"
],
"crafting-actions/computed-getters.ts": [
"data/enchantment-effects.ts",
"types.ts"
],
"crafting-actions/crafting-equipment-actions.ts": [
"crafting-equipment.ts",
"types.ts"
],
"crafting-actions/design-actions.ts": [
"crafting-design.ts",
"crafting-utils.ts",
"special-effects.ts",
"types.ts",
"upgrade-effects.ts"
],
"crafting-actions/disenchant-actions.ts": [
"types.ts"
],
"crafting-actions/equipment-actions.ts": [
"crafting-utils.ts",
"types.ts"
],
"crafting-actions/index.ts": [
"crafting-actions/application-actions.ts",
"crafting-actions/computed-getters.ts",
"crafting-actions/crafting-equipment-actions.ts",
"crafting-actions/design-actions.ts",
"crafting-actions/disenchant-actions.ts",
"crafting-actions/equipment-actions.ts",
"crafting-actions/preparation-actions.ts"
],
"crafting-actions/preparation-actions.ts": [
"crafting-prep.ts",
"types.ts"
],
"crafting-apply.ts": [
"crafting-utils.ts",
"data/attunements.ts",
"data/enchantment-effects.ts",
"special-effects.ts",
"types.ts",
"upgrade-effects.ts"
],
"crafting-attunements.ts": [
"data/attunements.ts",
"types.ts"
],
"crafting-design.ts": [
"data/attunements.ts",
"data/enchantment-effects.ts",
"data/equipment/index.ts",
"special-effects.ts",
"types.ts",
"upgrade-effects.ts"
],
"crafting-equipment.ts": [
"crafting-utils.ts",
"data/crafting-recipes.ts",
"data/equipment/index.ts",
"types.ts"
],
"crafting-loot.ts": [
"data/crafting-recipes.ts",
"types.ts"
],
"crafting-prep.ts": [
"crafting-utils.ts",
"types.ts"
],
"crafting-slice.ts": [
"constants.ts",
"crafting-actions/index.ts",
"crafting-apply.ts",
"crafting-attunements.ts",
"crafting-design.ts",
"crafting-equipment.ts",
"crafting-loot.ts",
"crafting-prep.ts",
"crafting-utils.ts",
"data/attunements.ts",
"data/crafting-recipes.ts",
"data/enchantment-effects.ts",
"data/equipment/index.ts",
"special-effects.ts",
"types.ts",
"upgrade-effects.ts",
"upgrade-effects.types.ts"
],
"crafting-utils.ts": [
"data/crafting-recipes.ts",
"data/enchantment-effects.ts",
"data/equipment/index.ts",
"types.ts"
],
"data/achievements.ts": [
"types.ts"
],
"data/attunements.ts": [
"types.ts"
],
"data/crafting-recipes.ts": [
"types.ts"
],
"data/enchantment-effects.ts": [
"data/enchantments/index.ts"
],
"data/enchantment-types.ts": [
"data/equipment/index.ts"
],
"data/enchantments/combat-effects.ts": [
"data/enchantment-types.ts",
"data/equipment/index.ts"
],
"data/enchantments/defense-effects.ts": [
"data/enchantment-types.ts",
"data/equipment/index.ts"
],
"data/enchantments/elemental-effects.ts": [
"data/enchantment-types.ts",
"data/equipment/index.ts"
],
"data/enchantments/index.ts": [
"data/enchantment-types.ts",
"data/enchantments/combat-effects.ts",
"data/enchantments/defense-effects.ts",
"data/enchantments/elemental-effects.ts",
"data/enchantments/mana-effects.ts",
"data/enchantments/special-effects.ts",
"data/enchantments/spell-effects/index.ts",
"data/enchantments/utility-effects.ts"
],
"data/enchantments/mana-effects.ts": [
"constants.ts",
"data/enchantment-types.ts",
"data/equipment/index.ts"
],
"data/enchantments/special-effects.ts": [
"data/enchantment-types.ts",
"data/equipment/index.ts"
],
"data/enchantments/spell-effects/basic-spells.ts": [
"data/enchantments/spell-effects/types.ts"
],
"data/enchantments/spell-effects/index.ts": [
"data/enchantments/spell-effects/basic-spells.ts",
"data/enchantments/spell-effects/lightning-spells.ts",
"data/enchantments/spell-effects/metal-spells.ts",
"data/enchantments/spell-effects/sand-spells.ts",
"data/enchantments/spell-effects/tier2-spells.ts",
"data/enchantments/spell-effects/tier3-spells.ts",
"data/enchantments/spell-effects/types.ts"
],
"data/enchantments/spell-effects/lightning-spells.ts": [
"data/enchantments/spell-effects/types.ts"
],
"data/enchantments/spell-effects/metal-spells.ts": [
"data/enchantments/spell-effects/types.ts"
],
"data/enchantments/spell-effects/sand-spells.ts": [
"data/enchantments/spell-effects/types.ts"
],
"data/enchantments/spell-effects/tier2-spells.ts": [
"data/enchantments/spell-effects/types.ts"
],
"data/enchantments/spell-effects/tier3-spells.ts": [
"data/enchantments/spell-effects/types.ts"
],
"data/enchantments/spell-effects/types.ts": [],
"data/enchantments/utility-effects.ts": [
"data/enchantment-types.ts",
"data/equipment/index.ts"
],
"data/equipment/accessories.ts": [
"data/equipment/types.ts"
],
"data/equipment/body.ts": [
"data/equipment/types.ts"
],
"data/equipment/casters.ts": [
"data/equipment/types.ts"
],
"data/equipment/catalysts.ts": [
"data/equipment/types.ts"
],
"data/equipment/feet.ts": [
"data/equipment/types.ts"
],
"data/equipment/hands.ts": [
"data/equipment/types.ts"
],
"data/equipment/head.ts": [
"data/equipment/types.ts"
],
"data/equipment/index.ts": [
"data/equipment/accessories.ts",
"data/equipment/body.ts",
"data/equipment/casters.ts",
"data/equipment/catalysts.ts",
"data/equipment/feet.ts",
"data/equipment/hands.ts",
"data/equipment/head.ts",
"data/equipment/shields.ts",
"data/equipment/swords.ts",
"data/equipment/types.ts",
"data/equipment/utils.ts"
],
"data/equipment/shields.ts": [
"data/equipment/types.ts"
],
"data/equipment/swords.ts": [
"data/equipment/types.ts"
],
"data/equipment/types.ts": [],
"data/equipment/utils.ts": [
"data/equipment/index.ts",
"data/equipment/types.ts"
],
"data/golems/base-golems.ts": [
"data/golems/types.ts"
],
"data/golems/elemental-golems.ts": [
"data/golems/types.ts"
],
"data/golems/hybrid-golems.ts": [
"data/golems/types.ts"
],
"data/golems/index.ts": [
"data/golems/base-golems.ts",
"data/golems/elemental-golems.ts",
"data/golems/hybrid-golems.ts",
"data/golems/types.ts",
"data/golems/utils.ts"
],
"data/golems/types.ts": [],
"data/golems/utils.ts": [
"data/golems/index.ts",
"data/golems/types.ts"
],
"data/loot-drops.ts": [
"types.ts"
],
"debug-context.tsx": [],
"dynamic-compute.ts": [
"special-effects.ts",
"upgrade-effects.types.ts"
],
"effects.ts": [
"data/enchantment-effects.ts",
"special-effects.ts",
"types.ts",
"upgrade-effects.ts",
"upgrade-effects.types.ts"
],
"formatting.ts": [
"computed-stats.ts"
],
"hooks/useGameDerived.ts": [
"constants.ts",
"special-effects.ts",
"store.ts",
"store/computed.ts",
"upgrade-effects.ts"
],
"hooks/useSkillUpgradeSelection.ts": [],
"navigation-slice.ts": [
"computed-stats.ts",
"types.ts"
],
"skill-evolution-modules/elemental-attunement.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/enchanting-skills.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/focused-mind.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/guardian-skills.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/hybrid-skills.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/index.ts": [
"skill-evolution-modules/elemental-attunement.ts",
"skill-evolution-modules/enchanting-skills.ts",
"skill-evolution-modules/focused-mind.ts",
"skill-evolution-modules/guardian-skills.ts",
"skill-evolution-modules/hybrid-skills.ts",
"skill-evolution-modules/insight-harvest.ts",
"skill-evolution-modules/invocation-skills.ts",
"skill-evolution-modules/knowledge-retention.ts",
"skill-evolution-modules/mana-utility-skills.ts",
"skill-evolution-modules/mana-well-flow.ts",
"skill-evolution-modules/quick-learner.ts",
"skill-evolution-modules/types.ts",
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/insight-harvest.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/invocation-skills.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/knowledge-retention.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/learning-skills.ts": [
"skill-evolution-modules/focused-mind.ts",
"skill-evolution-modules/insight-harvest.ts",
"skill-evolution-modules/knowledge-retention.ts",
"skill-evolution-modules/quick-learner.ts"
],
"skill-evolution-modules/magic-skills.ts": [
"skill-evolution-modules/elemental-attunement.ts",
"skill-evolution-modules/mana-utility-skills.ts",
"skill-evolution-modules/mana-well-flow.ts"
],
"skill-evolution-modules/mana-utility-skills.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/mana-well-flow.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/quick-learner.ts": [
"skill-evolution-modules/utils.ts",
"types.ts"
],
"skill-evolution-modules/types.ts": [
"types.ts"
],
"skill-evolution-modules/utils.ts": [
"types.ts"
],
"skill-evolution.ts": [
"skill-evolution-modules/index.ts"
],
"special-effects.ts": [
"upgrade-effects.types.ts"
],
"store-modules/activity-log.ts": [
"types.ts"
],
"store-modules/computed-stats.ts": [
"constants.ts",
"data/attunements.ts",
"effects.ts",
"special-effects.ts",
"types.ts",
"upgrade-effects.types.ts"
],
"store-modules/enemy-utils.ts": [
"constants.ts",
"types.ts",
"utils/floor-utils.ts"
],
"store-modules/initial-state.ts": [
"constants.ts",
"crafting-slice.ts",
"store-modules/computed-stats.ts",
"store-modules/room-utils.ts",
"types.ts",
"upgrade-effects.ts",
"utils/floor-utils.ts"
],
"store-modules/room-utils.ts": [
"constants.ts",
"store-modules/enemy-utils.ts",
"types.ts",
"utils/floor-utils.ts"
],
"store-modules/store-actions.ts": [
"constants.ts",
"crafting-slice.ts",
"data/attunements.ts",
"data/enchantment-effects.ts",
"data/equipment/index.ts",
"data/golems/index.ts",
"effects.ts",
"skill-evolution.ts",
"special-effects.ts",
"store-modules/activity-log.ts",
"store-modules/computed-stats.ts",
"store-modules/enemy-utils.ts",
"store-modules/initial-state.ts",
"store-modules/room-utils.ts",
"types.ts",
"upgrade-effects.ts",
"upgrade-effects.types.ts",
"utils/combat-utils.ts"
],
"store-modules/tick-logic.ts": [
"constants.ts",
"data/attunements.ts",
"data/golems/index.ts",
"effects.ts",
"special-effects.ts",
"store-modules/activity-log.ts",
"store-modules/computed-stats.ts",
"store-modules/room-utils.ts",
"types.ts",
"utils/floor-utils.ts"
],
"store-tests/test-utils.ts": [
"constants.ts",
"types.ts"
],
"store.ts": [
"store-modules/activity-log.ts",
"store-modules/computed-stats.ts",
"store-modules/initial-state.ts",
"store-modules/room-utils.ts",
"types.ts",
"utils/floor-utils.ts",
"utils/formatting.ts"
],
"store/combatSlice.ts": [
"constants.ts",
"special-effects.ts",
"store/computed.ts",
"types.ts",
"upgrade-effects.ts"
],
"store/computed.ts": [
"constants.ts",
"effects.ts",
"skill-evolution.ts",
"types.ts",
"upgrade-effects.ts",
"upgrade-effects.types.ts"
],
"store/crafting-modules/initial-state.ts": [
"data/equipment/index.ts",
"store/crafting-modules/types.ts"
],
"store/crafting-modules/selectors.ts": [
"data/equipment/index.ts",
"store/crafting-modules/types.ts",
"store/crafting-modules/utils.ts",
"types.ts"
],
"store/crafting-modules/slice-logic.ts": [
"data/equipment/index.ts",
"store/crafting-modules/initial-state.ts",
"store/crafting-modules/selectors.ts",
"store/crafting-modules/tick-processors.ts",
"store/crafting-modules/types.ts",
"store/crafting-modules/utils.ts",
"types.ts"
],
"store/crafting-modules/starting-equipment.ts": [
"store/crafting-modules/utils.ts",
"types.ts"
],
"store/crafting-modules/tick-processors.ts": [
"data/enchantment-effects.ts",
"store/crafting-modules/types.ts",
"store/crafting-modules/utils.ts",
"types.ts"
],
"store/crafting-modules/types.ts": [
"data/equipment/index.ts",
"types.ts"
],
"store/crafting-modules/utils.ts": [
"data/enchantment-effects.ts",
"data/equipment/index.ts",
"types.ts"
],
"store/craftingSlice.ts": [
"store/crafting-modules/initial-state.ts",
"store/crafting-modules/slice-logic.ts",
"store/crafting-modules/starting-equipment.ts",
"store/crafting-modules/types.ts",
"store/crafting-modules/utils.ts"
],
"store/index.ts": [
"store.ts",
"store/computed.ts"
],
"store/manaSlice.ts": [
"constants.ts",
"special-effects.ts",
"store.ts",
"store/computed.ts",
"types.ts",
"upgrade-effects.ts"
],
"store/pactSlice.ts": [
"constants.ts",
"store/computed.ts",
"types.ts"
],
"store/prestigeSlice.ts": [
"constants.ts",
"store/computed.ts",
"types.ts"
],
"store/skillSlice.ts": [
"constants.ts",
"skill-evolution.ts",
"types.ts",
"upgrade-effects.ts"
],
"store/timeSlice.ts": [
"constants.ts",
"store/computed.ts",
"types.ts"
],
"stores/attunementStore.ts": [
"data/attunements.ts",
"types.ts"
],
"stores/combat-actions.ts": [
"constants.ts",
"stores/combatStore.ts",
"stores/prestigeStore.ts",
"types.ts",
"utils/index.ts"
],
"stores/combatStore.ts": [
"stores/combat-actions.ts",
"stores/gameStore.ts",
"stores/prestigeStore.ts",
"types.ts",
"utils/activity-log.ts",
"utils/index.ts",
"utils/room-utils.ts"
],
"stores/craftingStore.ts": [
"crafting-actions/application-actions.ts",
"crafting-actions/preparation-actions.ts",
"crafting-apply.ts",
"crafting-design.ts",
"crafting-equipment.ts",
"crafting-utils.ts",
"special-effects.ts",
"store/crafting-modules/starting-equipment.ts",
"stores/combatStore.ts",
"stores/gameStore.ts",
"stores/manaStore.ts",
"stores/skillStore.ts",
"stores/uiStore.ts",
"types.ts",
"upgrade-effects.ts"
],
"stores/gameActions.ts": [
"stores/combatStore.ts",
"stores/manaStore.ts",
"stores/prestigeStore.ts",
"stores/skillStore.ts",
"stores/uiStore.ts",
"upgrade-effects.ts",
"utils/index.ts"
],
"stores/gameHooks.ts": [
"constants.ts",
"effects.ts",
"stores/combatStore.ts",
"stores/craftingStore.ts",
"stores/gameStore.ts",
"stores/manaStore.ts",
"stores/prestigeStore.ts",
"stores/skillStore.ts",
"stores/uiStore.ts",
"utils/index.ts"
],
"stores/gameLoopActions.ts": [
"constants.ts",
"stores/combatStore.ts",
"stores/manaStore.ts",
"stores/prestigeStore.ts",
"stores/skillStore.ts",
"stores/uiStore.ts",
"utils/index.ts"
],
"stores/gameStore.ts": [
"constants.ts",
"data/attunements.ts",
"special-effects.ts",
"stores/attunementStore.ts",
"stores/combatStore.ts",
"stores/gameActions.ts",
"stores/gameLoopActions.ts",
"stores/manaStore.ts",
"stores/prestigeStore.ts",
"stores/skillStore.ts",
"stores/uiStore.ts",
"upgrade-effects.ts",
"utils/index.ts"
],
"stores/index.ts": [
"constants.ts",
"store-modules/computed-stats.ts",
"stores/attunementStore.ts",
"stores/combatStore.ts",
"stores/craftingStore.ts",
"stores/gameHooks.ts",
"stores/gameStore.ts",
"stores/manaStore.ts",
"stores/prestigeStore.ts",
"stores/skillStore.ts",
"stores/uiStore.ts",
"utils/index.ts"
],
"stores/manaStore.ts": [
"constants.ts",
"types.ts"
],
"stores/prestigeStore.ts": [
"constants.ts",
"types.ts"
],
"stores/skillStore.ts": [
"constants.ts",
"skill-evolution.ts",
"stores/combatStore.ts",
"stores/manaStore.ts",
"types.ts"
],
"stores/uiStore.ts": [],
"study-slice.ts": [
"constants.ts",
"special-effects.ts",
"types.ts",
"upgrade-effects.ts"
],
"types.ts": [
"types/attunements.ts",
"types/elements.ts",
"types/equipment.ts",
"types/game.ts",
"types/skills.ts",
"types/spells.ts"
],
"types/attunements.ts": [],
"types/elements.ts": [],
"types/equipment.ts": [],
"types/game.ts": [
"types/attunements.ts",
"types/elements.ts",
"types/equipment.ts",
"types/spells.ts"
],
"types/index.ts": [
"types/attunements.ts",
"types/elements.ts",
"types/equipment.ts",
"types/game.ts",
"types/skills.ts",
"types/spells.ts"
],
"types/skills.ts": [],
"types/spells.ts": [],
"upgrade-effects.ts": [
"dynamic-compute.ts",
"skill-evolution.ts",
"special-effects.ts",
"types.ts",
"upgrade-effects.types.ts"
],
"upgrade-effects.types.ts": [
"types.ts"
],
"utils/activity-log.ts": [
"types.ts"
],
"utils/combat-utils.ts": [
"constants.ts",
"data/enchantment-effects.ts",
"types.ts"
],
"utils/enemy-utils.ts": [
"constants.ts",
"types.ts",
"utils/floor-utils.ts"
],
"utils/floor-utils.ts": [
"constants.ts"
],
"utils/formatting.ts": [],
"utils/index.ts": [
"utils/combat-utils.ts",
"utils/floor-utils.ts",
"utils/formatting.ts",
"utils/mana-utils.ts"
],
"utils/mana-utils.ts": [
"constants.ts",
"data/attunements.ts",
"types.ts",
"upgrade-effects.types.ts"
],
"utils/room-utils.ts": [
"constants.ts",
"types.ts",
"utils/enemy-utils.ts",
"utils/floor-utils.ts"
]
}
}
+5 -3
View File
@@ -5,16 +5,18 @@ Mana-Loop/
├── .husky/ ├── .husky/
│ ├── scripts/ │ ├── scripts/
│ │ ├── check-file-size.js │ │ ├── check-file-size.js
│ │ ├── generate-dependency-graph.js
│ │ └── generate-project-tree.js │ │ └── generate-project-tree.js
│ ├── post-merge │ ├── post-merge
│ └── pre-commit │ └── pre-commit
├── db/ ├── db/
│ └── custom.db │ └── custom.db
├── docs/ ├── docs/
│ ├── strategy/
│ │ └── overall-remediation-plan.md
│ ├── GAME_BRIEFING.md │ ├── GAME_BRIEFING.md
│ ├── PLAN-SpireTab-refresh.md │ ├── circular-deps.txt
│ ├── SPEC-SpireTab-refresh.md │ ├── dependency-graph.json
│ ├── TASKS-SpireTab-refresh.md
│ ├── project-structure.txt │ ├── project-structure.txt
│ └── skills.md │ └── skills.md
├── download/ ├── download/
+2 -1
View File
@@ -26,6 +26,7 @@ import { ConfirmDialog } from '@/components/game/ConfirmDialog';
import { DebugName } from '@/lib/game/debug-context'; import { DebugName } from '@/lib/game/debug-context';
import { equipItem, unequipItem, deleteEquipmentInstance } from '@/lib/game/crafting-actions'; import { equipItem, unequipItem, deleteEquipmentInstance } from '@/lib/game/crafting-actions';
import { useCombatStore, useCraftingStore } from '@/lib/game/stores'; import { useCombatStore, useCraftingStore } from '@/lib/game/stores';
import type { GameState } from '@/lib/game/types';
// Rarity color mappings using design system tokens // Rarity color mappings using design system tokens
export const RARITY_BORDER_COLORS: Record<string, string> = { export const RARITY_BORDER_COLORS: Record<string, string> = {
@@ -151,7 +152,7 @@ export function EquipmentTab() {
// Equip an item to a slot // Equip an item to a slot
const handleEquip = (instanceId: string, slot: EquipmentSlot) => { const handleEquip = (instanceId: string, slot: EquipmentSlot) => {
const instance = equipmentInstances[instanceId]; const instance = equipmentInstances[instanceId];
equipItem(instanceId, slot, useCombatStore.getState, (fn) => useCombatStore.setState(fn)); equipItem(instanceId, slot, useCraftingStore.getState as () => GameState, (fn) => useCraftingStore.setState(fn as any));
setSelectedSlot(null); setSelectedSlot(null);
showToast('success', 'Item Equipped', `${instance?.name || 'Item'} equipped to ${SLOT_NAMES[slot]}`); showToast('success', 'Item Equipped', `${instance?.name || 'Item'} equipped to ${SLOT_NAMES[slot]}`);
}; };
+31
View File
@@ -16,6 +16,8 @@ import { GOLEMS_DEF, isGolemUnlocked, getGolemDamage } from '../data/golems';
import { SPELLS_DEF, ELEMENTS } from '../constants'; import { SPELLS_DEF, ELEMENTS } from '../constants';
import { canAffordSpellCost, deductSpellCost, calcDamage } from './computed-stats'; import { canAffordSpellCost, deductSpellCost, calcDamage } from './computed-stats';
import { getFloorElement, getFloorMaxHP } from '../utils/floor-utils'; import { getFloorElement, getFloorMaxHP } from '../utils/floor-utils';
import { processCraftingTick } from '../crafting-slice';
import { getActiveEquipmentSpells } from '../utils/combat-utils';
interface TickParams { interface TickParams {
state: GameState; state: GameState;
@@ -219,6 +221,34 @@ export function processTick({ state, set, get }: TickParams): void {
comboHitCount = comboHitCount || 0; comboHitCount = comboHitCount || 0;
floorHitCount = floorHitCount || 0; floorHitCount = floorHitCount || 0;
// Build equipment spell states from equipped items (Bug #3 fix)
let equipmentSpellStates = state.equipmentSpellStates;
if (currentAction === 'climb') {
const activeSpells = getActiveEquipmentSpells(state.equippedInstances, state.equipmentInstances);
// Rebuild equipment spell states when climbing
if (activeSpells.length > 0) {
equipmentSpellStates = activeSpells.map(s => {
const existing = state.equipmentSpellStates.find(es => es.spellId === s.spellId && es.sourceEquipment === s.equipmentId);
return existing || { spellId: s.spellId, sourceEquipment: s.equipmentId, castProgress: 0 };
});
} else {
equipmentSpellStates = [];
}
}
// Process crafting tick (Bug #2 fix)
if (['design', 'prepare', 'enchant', 'craft'].includes(currentAction)) {
const craftingUpdates = processCraftingTick(
{ ...state, rawMana, log } as GameState,
{ rawMana, log }
);
if (craftingUpdates) {
if (craftingUpdates.rawMana !== undefined) rawMana = craftingUpdates.rawMana;
if (craftingUpdates.log) log = craftingUpdates.log;
if (craftingUpdates.currentAction) currentAction = craftingUpdates.currentAction;
}
}
// Update state // Update state
set({ set({
day, hour, rawMana, elements, meditateTicks, day, hour, rawMana, elements, meditateTicks,
@@ -226,5 +256,6 @@ export function processTick({ state, set, get }: TickParams): void {
parallelStudyTarget, currentFloor, floorHP, floorMaxHP, maxFloorReached, signedPacts, castProgress, currentRoom, parallelStudyTarget, currentFloor, floorHP, floorMaxHP, maxFloorReached, signedPacts, castProgress, currentRoom,
comboHitCount, floorHitCount, activityLog, totalManaGathered, comboHitCount, floorHitCount, activityLog, totalManaGathered,
conversionDrains, flowSurgeEndTime, incursionStrength, conversionDrains, flowSurgeEndTime, incursionStrength,
equipmentSpellStates,
}); });
} }