[High] [Bug] Enchanting: Hasty Enchanter applies wrong bonus (6.25% instead of 25%) #301
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/enchanter/systems/enchanting-spec.md §3.3
Severity: Wrong formula
Problem: The spec says
time *= 0.75(25% faster) for repeat designs with Hasty Enchanter. The code has two issues:src/lib/game/crafting-design.ts:63-67—getDesignTimeWithHaste()correctly multiplies time by 0.75, but this function is never called (dead code).src/lib/game/crafting-design.ts:122-128—calculateDesignProgress()applies Hasty Enchanter per-tick as an additive bonus:timeBonus = DESIGN_PROGRESS_PER_TICK * 0.25 = 0.01hours/tick. This is a ~6.25% speed increase, not 25%.src/lib/game/crafting-actions/design-actions.ts:55—startDesigningEnchantment()callscalculateDesignTime(effects)without passingisRepeatDesign, so the required time is never reduced.Files:
src/lib/game/crafting-design.ts:63-67(dead code)src/lib/game/crafting-design.ts:122-128(wrong formula)src/lib/game/crafting-actions/design-actions.ts:55(never applies reduction)Starting investigation of Hasty Enchanter bug. Will read the three affected files and the spec to reproduce the issue.
Fix applied and verified.
Root cause:
calculateDesignProgress()applied Hasty Enchanter as an additive per-tick bonus (DESIGN_PROGRESS_PER_TICK * 0.25 = 0.01hours/tick), giving only ~6.25% speed increase instead of the spec-defined 25%.Changes made to
src/lib/game/crafting-design.ts:getDesignTimeWithHaste()— was never called.+0.01/tick) to multiplicative (×4/3progress per tick), which is mathematically equivalent totime *= 0.75(25% less time).HASTY_ENCHANTER_BONUS_MULTIPLIERtoHASTY_ENCHANTER_SPEED_MULTIPLIERwith value4/3.No changes needed in
design-actions.ts—isRepeatDesignis computed at tick time inenchanting-tick.ts, and the haste bonus is correctly applied per-tick incalculateDesignProgress().Regression test added:
src/lib/game/__tests__/hasty-enchanter.test.ts— 5 tests covering:Verification:
Fix complete. Hasty Enchanter now correctly applies a 25% design speed increase (4/3 progress per tick) instead of the previous 6.25% (additive 0.01 per tick).