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
+2 -1
View File
@@ -26,6 +26,7 @@ import { ConfirmDialog } from '@/components/game/ConfirmDialog';
import { DebugName } from '@/lib/game/debug-context';
import { equipItem, unequipItem, deleteEquipmentInstance } from '@/lib/game/crafting-actions';
import { useCombatStore, useCraftingStore } from '@/lib/game/stores';
import type { GameState } from '@/lib/game/types';
// Rarity color mappings using design system tokens
export const RARITY_BORDER_COLORS: Record<string, string> = {
@@ -151,7 +152,7 @@ export function EquipmentTab() {
// Equip an item to a slot
const handleEquip = (instanceId: string, slot: EquipmentSlot) => {
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);
showToast('success', 'Item Equipped', `${instance?.name || 'Item'} equipped to ${SLOT_NAMES[slot]}`);
};