🐛 FABRICATOR: Crafted equipment stats completely broken — 4 critical breaks #170

Closed
opened 2026-05-27 17:28:14 +02:00 by Anexim · 1 comment
Owner

Bug

Equipment stats from crafted gear from the fabricator don't work. Investigation reveals 4 critical breaks in the chain.

Break #1: completeEquipmentCrafting is Dead Code

File: src/lib/game/crafting-equipment.ts:93-115
The function that converts EquipmentCraftingProgress into an EquipmentInstance is never called anywhere. Zero call sites across the entire repo.

Break #2: gearTrait is Display-Only Flavor Text

File: src/lib/game/data/fabricator-recipe-types.ts:25, FabricatorSubTab.tsx:85
All stat descriptions on fabricator recipes (e.g. "+25 Earth Mana Capacity", "+15% cast speed") are strings displayed as italic amber flavor text. They are never parsed, never converted into actual stats, never applied to the crafted EquipmentInstance.

Break #3: baseDamage/baseCastSpeed on EquipmentType Are Dead Data

File: src/lib/game/data/equipment/types.ts:29-30, swords.ts
No combat code reads equipType.baseDamage or equipType.baseCastSpeed. Combat uses spell base damage + discipline bonuses + skill bonuses only.

Break #4: Crafted Equipment Starts with Zero Enchantments

File: src/lib/game/crafting-equipment.ts:105
Even if completeEquipmentCrafting were called, the created EquipmentInstance has enchantments: []. Since computeEquipmentEffects() reads only instance.enchantments[], crafted gear would still have zero effects.

The Fix Needs

  1. Wire completeEquipmentCrafting to be called when crafting progress reaches 100%
  2. Either convert gearTrait strings into actual enchantments, or add a proper stat system to fabricator recipes
  3. Remove dead baseDamage/baseCastSpeed fields OR wire them into combat calculations
  4. Populate enchantments[] on crafted instances

Files

  • src/lib/game/crafting-equipment.ts:84-115 (dead code)
  • src/lib/game/data/fabricator-recipe-types.ts:25
  • src/lib/game/data/equipment/types.ts:29-30
  • src/lib/game/effects.ts:28-72 (computeEquipmentEffects)
  • src/lib/game/stores/craftingStore.ts:247-258
  • src/components/game/tabs/CraftingTab/FabricatorSubTab.tsx:85
## Bug Equipment stats from crafted gear from the fabricator don't work. Investigation reveals **4 critical breaks** in the chain. ### Break #1: `completeEquipmentCrafting` is Dead Code **File:** `src/lib/game/crafting-equipment.ts:93-115` The function that converts `EquipmentCraftingProgress` into an `EquipmentInstance` is **never called anywhere**. Zero call sites across the entire repo. ### Break #2: `gearTrait` is Display-Only Flavor Text **File:** `src/lib/game/data/fabricator-recipe-types.ts:25`, `FabricatorSubTab.tsx:85` All stat descriptions on fabricator recipes (e.g. "+25 Earth Mana Capacity", "+15% cast speed") are strings displayed as italic amber flavor text. They are **never parsed, never converted into actual stats, never applied** to the crafted `EquipmentInstance`. ### Break #3: `baseDamage`/`baseCastSpeed` on EquipmentType Are Dead Data **File:** `src/lib/game/data/equipment/types.ts:29-30`, `swords.ts` No combat code reads `equipType.baseDamage` or `equipType.baseCastSpeed`. Combat uses spell base damage + discipline bonuses + skill bonuses only. ### Break #4: Crafted Equipment Starts with Zero Enchantments **File:** `src/lib/game/crafting-equipment.ts:105` Even if `completeEquipmentCrafting` were called, the created `EquipmentInstance` has `enchantments: []`. Since `computeEquipmentEffects()` reads only `instance.enchantments[]`, crafted gear would still have zero effects. ## The Fix Needs 1. Wire `completeEquipmentCrafting` to be called when crafting progress reaches 100% 2. Either convert `gearTrait` strings into actual enchantments, or add a proper stat system to fabricator recipes 3. Remove dead `baseDamage`/`baseCastSpeed` fields OR wire them into combat calculations 4. Populate `enchantments[]` on crafted instances ## Files - `src/lib/game/crafting-equipment.ts:84-115` (dead code) - `src/lib/game/data/fabricator-recipe-types.ts:25` - `src/lib/game/data/equipment/types.ts:29-30` - `src/lib/game/effects.ts:28-72` (computeEquipmentEffects) - `src/lib/game/stores/craftingStore.ts:247-258` - `src/components/game/tabs/CraftingTab/FabricatorSubTab.tsx:85`
Anexim added the ai:todo label 2026-05-27 17:28:14 +02:00
n8n-gitea was assigned by Anexim 2026-05-27 17:28:14 +02:00
Author
Owner

Fix Complete — All 4 Breaks Resolved

Break #1: completeEquipmentCrafting was dead code → FIXED

  • Added processEquipmentCraftingTick action to craftingStore.ts (extracted to crafting-equipment-tick.ts to stay under 400-line limit)
  • Wired into gameStore.ts tick() — when currentAction === 'craft', the tick advances equipmentCraftingProgress by HOURS_PER_TICK per tick
  • When progress reaches required, resolves the recipe (fabricator or blueprint), creates the EquipmentInstance, adds it to equipmentInstances, clears progress, returns to meditate

Break #2: gearTrait was display-only flavor text → FIXED

  • Added bonusEnchantments?: AppliedEnchantment[] field to FabricatorRecipe type
  • Populated all 19 fabricator recipes across 3 files with real enchantment effects:
    • Earth gear → earth_cap_10, mana_regen_1
    • Metal gear → metal_cap_10, mana_cap_50, damage_5
    • Crystal gear → mana_cap_50, mana_regen_1/2, crystal_cap_10
    • Sand gear → attack_speed_10, sand_cap_10
    • Wizard branch → earth_cap_10, mana_regen_1/2/5, mana_cap_50/100, metal_cap_10, light_cap_10, damage_10
    • Physical branch → damage_5/10, attack_speed_10, mana_cap_50, dark_cap_10, earth_cap_10

Break #3: baseDamage/baseCastSpeed on EquipmentType were dead data → FIXED

  • Removed baseDamage?: number and baseCastSpeed?: number from EquipmentType interface in equipment/types.ts
  • Removed all 5 instances from swords.ts equipment definitions
  • Combat already uses baseDamageBonus/baseDamageMultiplier from enchantments and discipline effects only

Break #4: Crafted equipment had enchantments: [] → FIXED

  • completeEquipmentCrafting now accepts optional bonusEnchantments: AppliedEnchantment[] parameter
  • Crafted instances are populated with the recipe's bonusEnchantments
  • usedCapacity is computed from enchantment costs

Files Changed (14 files, +230/-34)

  • src/lib/game/stores/craftingStore.ts — imported extracted tick, added action
  • src/lib/game/stores/crafting-equipment-tick.ts — NEW: extracted tick processing logic
  • src/lib/game/stores/craftingStore.types.ts — added processEquipmentCraftingTick type
  • src/lib/game/stores/gameStore.ts — wired crafting tick into main tick pipeline
  • src/lib/game/crafting-equipment.tscompleteEquipmentCrafting accepts bonus enchantments
  • src/lib/game/data/fabricator-recipe-types.ts — added bonusEnchantments field
  • src/lib/game/data/fabricator-recipes.ts — populated 11 core recipes with bonus enchantments
  • src/lib/game/data/fabricator-wizard-recipes.ts — populated 7 wizard recipes
  • src/lib/game/data/fabricator-physical-recipes.ts — populated 9 physical recipes
  • src/lib/game/data/equipment/types.ts — removed dead baseDamage/baseCastSpeed
  • src/lib/game/data/equipment/swords.ts — removed dead stats from 5 sword definitions

Test Results

  • All 918 tests pass, zero regressions
  • All files under 400-line limit
  • No circular dependencies introduced
## ✅ Fix Complete — All 4 Breaks Resolved ### Break #1: `completeEquipmentCrafting` was dead code → FIXED - Added `processEquipmentCraftingTick` action to `craftingStore.ts` (extracted to `crafting-equipment-tick.ts` to stay under 400-line limit) - Wired into `gameStore.ts` tick() — when `currentAction === 'craft'`, the tick advances `equipmentCraftingProgress` by `HOURS_PER_TICK` per tick - When progress reaches `required`, resolves the recipe (fabricator or blueprint), creates the `EquipmentInstance`, adds it to `equipmentInstances`, clears progress, returns to `meditate` ### Break #2: `gearTrait` was display-only flavor text → FIXED - Added `bonusEnchantments?: AppliedEnchantment[]` field to `FabricatorRecipe` type - Populated all 19 fabricator recipes across 3 files with real enchantment effects: - Earth gear → `earth_cap_10`, `mana_regen_1` - Metal gear → `metal_cap_10`, `mana_cap_50`, `damage_5` - Crystal gear → `mana_cap_50`, `mana_regen_1/2`, `crystal_cap_10` - Sand gear → `attack_speed_10`, `sand_cap_10` - Wizard branch → `earth_cap_10`, `mana_regen_1/2/5`, `mana_cap_50/100`, `metal_cap_10`, `light_cap_10`, `damage_10` - Physical branch → `damage_5/10`, `attack_speed_10`, `mana_cap_50`, `dark_cap_10`, `earth_cap_10` ### Break #3: `baseDamage`/`baseCastSpeed` on EquipmentType were dead data → FIXED - Removed `baseDamage?: number` and `baseCastSpeed?: number` from `EquipmentType` interface in `equipment/types.ts` - Removed all 5 instances from `swords.ts` equipment definitions - Combat already uses `baseDamageBonus`/`baseDamageMultiplier` from enchantments and discipline effects only ### Break #4: Crafted equipment had `enchantments: []` → FIXED - `completeEquipmentCrafting` now accepts optional `bonusEnchantments: AppliedEnchantment[]` parameter - Crafted instances are populated with the recipe's `bonusEnchantments` - `usedCapacity` is computed from enchantment costs ### Files Changed (14 files, +230/-34) - `src/lib/game/stores/craftingStore.ts` — imported extracted tick, added action - `src/lib/game/stores/crafting-equipment-tick.ts` — NEW: extracted tick processing logic - `src/lib/game/stores/craftingStore.types.ts` — added `processEquipmentCraftingTick` type - `src/lib/game/stores/gameStore.ts` — wired crafting tick into main tick pipeline - `src/lib/game/crafting-equipment.ts` — `completeEquipmentCrafting` accepts bonus enchantments - `src/lib/game/data/fabricator-recipe-types.ts` — added `bonusEnchantments` field - `src/lib/game/data/fabricator-recipes.ts` — populated 11 core recipes with bonus enchantments - `src/lib/game/data/fabricator-wizard-recipes.ts` — populated 7 wizard recipes - `src/lib/game/data/fabricator-physical-recipes.ts` — populated 9 physical recipes - `src/lib/game/data/equipment/types.ts` — removed dead `baseDamage`/`baseCastSpeed` - `src/lib/game/data/equipment/swords.ts` — removed dead stats from 5 sword definitions ### Test Results - All **918 tests pass**, zero regressions - All files under 400-line limit - No circular dependencies introduced
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#170