Bug: Fabricator recipes use Raw Mana instead of required elemental mana #155

Closed
opened 2026-05-27 10:22:55 +02:00 by Anexim · 2 comments
Owner

Bug Description

Fabricator recipes that require specific elemental mana (Earth, Crystal, etc.) are incorrectly using/displaying the player's Raw Mana pool instead of the appropriate elemental mana.

Root Causes

1. UI Display Issue

src/components/game/tabs/CraftingTab/FabricatorSubTab.tsx line 127 reads rawMana from the mana store and passes it as manaAmount to RecipeCard (line 175). The canCraftRecipe function in fabricator-recipes.ts (lines 208-222) compares this single manaCost number against manaAmount, completely ignoring the recipe's manaType field.

2. Crafting Execution Issue

The startCraftingEquipment in craftingStore.ts (lines 268-290) passes rawMana to CraftingEquipment.canStartEquipmentCrafting, which looks up CRAFTING_RECIPES[fabricator-${recipe.id}]. No fabricator IDs exist in CRAFTING_RECIPES, so crafting can never actually start.

Fix Required

  1. In FabricatorSubTab.tsx: Read the appropriate elemental mana from the mana store based on each recipe's manaType field
  2. In fabricator-recipes.ts: Update canCraftRecipe to accept a mana type parameter and check the correct mana pool
  3. In craftingStore.ts: Either add fabricator recipes to the crafting system or create a separate fabricator crafting execution path that correctly deducts the right mana type

Affected Files

  • src/components/game/tabs/CraftingTab/FabricatorSubTab.tsx (lines 127, 133, 175)
  • src/lib/game/data/fabricator-recipes.ts (lines 208-222, canCraftRecipe)
  • src/lib/game/stores/craftingStore.ts (lines 268-290)
  • src/lib/game/crafting-equipment.ts (line 20)
## Bug Description Fabricator recipes that require specific elemental mana (Earth, Crystal, etc.) are incorrectly using/displaying the player's Raw Mana pool instead of the appropriate elemental mana. ## Root Causes ### 1. UI Display Issue `src/components/game/tabs/CraftingTab/FabricatorSubTab.tsx` line 127 reads `rawMana` from the mana store and passes it as `manaAmount` to `RecipeCard` (line 175). The `canCraftRecipe` function in `fabricator-recipes.ts` (lines 208-222) compares this single `manaCost` number against `manaAmount`, completely ignoring the recipe's `manaType` field. ### 2. Crafting Execution Issue The `startCraftingEquipment` in `craftingStore.ts` (lines 268-290) passes `rawMana` to `CraftingEquipment.canStartEquipmentCrafting`, which looks up `CRAFTING_RECIPES[fabricator-${recipe.id}]`. No fabricator IDs exist in `CRAFTING_RECIPES`, so crafting can never actually start. ## Fix Required 1. In `FabricatorSubTab.tsx`: Read the appropriate elemental mana from the mana store based on each recipe's `manaType` field 2. In `fabricator-recipes.ts`: Update `canCraftRecipe` to accept a mana type parameter and check the correct mana pool 3. In `craftingStore.ts`: Either add fabricator recipes to the crafting system or create a separate fabricator crafting execution path that correctly deducts the right mana type ## Affected Files - `src/components/game/tabs/CraftingTab/FabricatorSubTab.tsx` (lines 127, 133, 175) - `src/lib/game/data/fabricator-recipes.ts` (lines 208-222, `canCraftRecipe`) - `src/lib/game/stores/craftingStore.ts` (lines 268-290) - `src/lib/game/crafting-equipment.ts` (line 20)
Anexim added the ai:todo label 2026-05-27 10:22:55 +02:00
n8n-gitea was assigned by Anexim 2026-05-27 10:22:55 +02:00
Author
Owner

Starting work on #155 — Fabricator recipes use Raw Mana instead of elemental. Will fix mana type display in FabricatorSubTab, canCraftRecipe logic, and crafting execution path.

Starting work on #155 — Fabricator recipes use Raw Mana instead of elemental. Will fix mana type display in FabricatorSubTab, canCraftRecipe logic, and crafting execution path.
Author
Owner

Fixed #155 — Fabricator recipes now use correct elemental mana type.

Changes:

  1. fabricator-recipes.ts: Added optional manaType param to canCraftRecipe for clarity
  2. FabricatorSubTab.tsx: Now reads elemental mana from store based on recipe's manaType instead of always using rawMana
  3. craftingStore.ts: Added startFabricatorCrafting action that deducts correct mana type (elemental or raw)
  4. craftingStore.types.ts: Added startFabricatorCrafting to CraftingActions interface
  5. crafting-fabricator.ts: New helper file to keep craftingStore.ts under 400-line limit

All 885 tests pass. Committed and pushed as 64b4725.

Fixed #155 — Fabricator recipes now use correct elemental mana type. Changes: 1. fabricator-recipes.ts: Added optional manaType param to canCraftRecipe for clarity 2. FabricatorSubTab.tsx: Now reads elemental mana from store based on recipe's manaType instead of always using rawMana 3. craftingStore.ts: Added startFabricatorCrafting action that deducts correct mana type (elemental or raw) 4. craftingStore.types.ts: Added startFabricatorCrafting to CraftingActions interface 5. crafting-fabricator.ts: New helper file to keep craftingStore.ts under 400-line limit All 885 tests pass. Committed and pushed as 64b4725.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#155