[High] [Bug] Item Fabrication: Crafting Efficiency cost reduction never applied #316
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Spec: docs/specs/attunements/fabricator/systems/item-fabrication-spec.md §7
Severity: Missing feature
Problem: The
craftingCostReductionstat is correctly defined in the discipline (base 15 + perk 10 = 25% max), but no code in any crafting path reads or applies it:src/lib/game/crafting-fabricator.ts:141-148—deductMaterials()deducts full recipe amountssrc/lib/game/stores/pipelines/equipment-crafting.ts:120-132— uses raw recipe amountsThe entire Crafting Efficiency cost reduction mechanic is non-functional.
Files:
src/lib/game/crafting-fabricator.ts:141-148,src/lib/game/stores/pipelines/equipment-crafting.ts:120-132Starting work on this bug. Investigating Item Fabrication Crafting Efficiency cost reduction issue.
Fix implemented and tested.
Root cause: The
craftingCostReductionstat was correctly computed bycomputeDisciplineEffects()but never consumed by any crafting code path. Material deductions, cost checks, and UI displays all used raw recipe amounts.Changes made across 5 files:
src/lib/game/crafting-fabricator.ts— AddedgetCraftingCostReduction()helper (reads from discipline effects bonuses, capped at 75%). AddedapplyCostReduction(baseAmount, reduction)helper. ModifieddeductMaterials()andcheckFabricatorCosts()to accept optionalcostReductionparam (defaults to live discipline value).executeMaterialCraft()benefits automatically since it callsdeductMaterials().src/lib/game/stores/pipelines/equipment-crafting.ts—startFabricatorCrafting()passes cost reduction through todeductMaterials().cancelEquipmentCrafting()now uses reduced amounts for material refunds (player only gets back what they actually paid).src/lib/game/data/fabricator-recipes.ts—canCraftRecipe()now accepts optionalcostReductionparam and checks against discounted amounts.src/components/game/tabs/CraftingTab/FabricatorSubTab.tsx—RecipeCardandMaterialRecipeCardreceivecostReductionprop from parent. UI shows discounted costs with original cost in parenthetical. Shows-% costbadge when reduction is active.src/components/game/tabs/CraftingTab/MaterialRecipeCard.tsx— AddedcostReductionprop, applies to material display andcanCraftRecipecheck.Formula (per spec §7):
actualCost = ceil(baseCost × (1 - craftingCostReduction / 100)), minimum 1.Verification:
Fix complete. All tests passing. Ready for review.