[High] [Bug] Enchanting spec vs code: 6 discrepancies including missing disenchant recovery, duplicate spell_iceShard, missing discipline perks #324

Closed
opened 2026-06-08 16:02:43 +02:00 by Anexim · 2 comments
Owner

Spec: docs/specs/attunements/enchanter/systems/enchanting-spec.md

Discrepancies found:

D2 [HIGH] — spell_iceShard defined twice with different costs

  • Basic Spells (data/enchantments/spell-effects/basic-spells.ts): cost 75
  • Frost Spells (data/enchantments/spell-effects/frost-spells.ts): cost 95
  • The spec lists both values (75 in §7.1 Basic, 95 in §7.1 Frost)
  • Runtime: frost version overwrites basic version in ENCHANTMENT_EFFECTS merge (spread order), so effective cost is 95
  • Fix: Remove duplicate from one file or reconcile to single canonical value

D7 [HIGH] — disenchantEquipment doesn't add 'Ready for Enchantment' tag or reset rarity

  • disenchant-actions.ts only clears enchantments and resets usedCapacity
  • Does NOT add 'Ready for Enchantment' tag or reset rarity to 'common'
  • Compare with crafting-prep.tscompletePreparation() which DOES add the tag and reset rarity
  • Fix: disenchantEquipment should also add the tag and reset rarity, matching completePreparation

D8 [HIGH] — disenchantEquipment calculates mana recovery but never credits it

  • disenchant-actions.ts:17-19 calculates totalRecovered but only writes to log
  • Never credits recovered mana to any mana store
  • Fix: Credit totalRecovered to the appropriate mana pool

D13 [HIGH] — Discipline perks from spec §8 have no data/definition files

  • The spec lists 20+ discipline perks (Study Basic Weapon Enchantments, Study Mana Enchantments, Study Basic/Intermediate/Advanced Spell Enchantments, Study Special Enchantments, Enchantment Crafting)
  • No discipline perk definitions or threshold data files found in the codebase
  • The unlockedEffects state in the crafting store exists but is never populated from discipline perks
  • Fix: Implement discipline perk data files and wire them to unlockedEffects

D14 [HIGH] — enchantPower mechanic doesn't exist

  • Spec §8 lists enchant-1 (infinite, 150 XP, +5 enchantPower/tier) and enchant-2 (capped, 300 XP, +10/tier, max 3)
  • No enchantPower stat or ENCHANTMENT CRAFTING discipline definition exists
  • The efficiencyBonus parameter in calculateEffectCapacityCost is never set to non-zero
  • Fix: Implement enchantPower stat and wire it to enchantment strength

D3 [LOW] — Spec references non-existent file

  • Spec §11 lists src/lib/game/crafting-attunements.ts — file doesn't exist
  • calculateEnchantingXP lives in src/lib/game/data/attunements.ts:126-128
  • Fix: Update spec to reference correct file path

D1/D6 [MEDIUM] — metalSpellFocus missing from spec capacity table

  • catalysts.ts:30-36 defines metalSpellFocus (catalyst, offHand, capacity 50)
  • Not listed in spec §6.1 capacity table
  • Fix: Add to spec
**Spec:** `docs/specs/attunements/enchanter/systems/enchanting-spec.md` **Discrepancies found:** ### D2 [HIGH] — `spell_iceShard` defined twice with different costs - **Basic Spells** (`data/enchantments/spell-effects/basic-spells.ts`): cost **75** - **Frost Spells** (`data/enchantments/spell-effects/frost-spells.ts`): cost **95** - The spec lists both values (75 in §7.1 Basic, 95 in §7.1 Frost) - Runtime: frost version overwrites basic version in `ENCHANTMENT_EFFECTS` merge (spread order), so effective cost is **95** - **Fix:** Remove duplicate from one file or reconcile to single canonical value ### D7 [HIGH] — `disenchantEquipment` doesn't add 'Ready for Enchantment' tag or reset rarity - `disenchant-actions.ts` only clears enchantments and resets `usedCapacity` - Does NOT add `'Ready for Enchantment'` tag or reset `rarity` to `'common'` - Compare with `crafting-prep.ts` → `completePreparation()` which DOES add the tag and reset rarity - **Fix:** `disenchantEquipment` should also add the tag and reset rarity, matching `completePreparation` ### D8 [HIGH] — `disenchantEquipment` calculates mana recovery but never credits it - `disenchant-actions.ts:17-19` calculates `totalRecovered` but only writes to log - Never credits recovered mana to any mana store - **Fix:** Credit `totalRecovered` to the appropriate mana pool ### D13 [HIGH] — Discipline perks from spec §8 have no data/definition files - The spec lists 20+ discipline perks (Study Basic Weapon Enchantments, Study Mana Enchantments, Study Basic/Intermediate/Advanced Spell Enchantments, Study Special Enchantments, Enchantment Crafting) - No discipline perk definitions or threshold data files found in the codebase - The `unlockedEffects` state in the crafting store exists but is never populated from discipline perks - **Fix:** Implement discipline perk data files and wire them to `unlockedEffects` ### D14 [HIGH] — `enchantPower` mechanic doesn't exist - Spec §8 lists `enchant-1` (infinite, 150 XP, +5 enchantPower/tier) and `enchant-2` (capped, 300 XP, +10/tier, max 3) - No `enchantPower` stat or `ENCHANTMENT CRAFTING` discipline definition exists - The `efficiencyBonus` parameter in `calculateEffectCapacityCost` is never set to non-zero - **Fix:** Implement `enchantPower` stat and wire it to enchantment strength ### D3 [LOW] — Spec references non-existent file - Spec §11 lists `src/lib/game/crafting-attunements.ts` — file doesn't exist - `calculateEnchantingXP` lives in `src/lib/game/data/attunements.ts:126-128` - **Fix:** Update spec to reference correct file path ### D1/D6 [MEDIUM] — `metalSpellFocus` missing from spec capacity table - `catalysts.ts:30-36` defines `metalSpellFocus` (catalyst, offHand, capacity 50) - Not listed in spec §6.1 capacity table - **Fix:** Add to spec
Anexim added the ai:todo label 2026-06-08 16:02:43 +02:00
n8n-gitea was assigned by Anexim 2026-06-08 16:02:43 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-09 09:14:42 +02:00
Author
Owner

Starting work on enchanting spec vs code discrepancies. Will investigate all 6 issues systematically.

Starting work on enchanting spec vs code discrepancies. Will investigate all 6 issues systematically.
Anexim added ai:done and removed ai:in-progress labels 2026-06-09 09:34:12 +02:00
Author
Owner

All 6 discrepancies resolved and pushed to master (commit e45c206):

D2 [HIGH] — spell_iceShard: Added to basic-spells.ts at cost 75 (canonical per spec §7.1 Basic), removed duplicate from frost-spells.ts (cost 95).

D7 [HIGH] — disenchantEquipment now adds 'Ready for Enchantment' tag and resets rarity to 'common', matching completePreparation() behavior.

D8 [HIGH] — disenchantEquipment now credits recovered mana to the raw mana pool via useManaStore.

D13 [HIGH] — Already implemented: discipline perks with unlocksEffects are defined in data files, collected by discipline-slice processTick, and wired to craftingStore.unlockEffects via gameStore tick.

D14 [HIGH] — Added getEnchantingEfficiencyBonus() in discipline-effects.ts that converts enchantPower to efficiencyBonus (enchantPower/100, capped at 0.9). Wired into craftingStore.startDesigningEnchantment, design-actions.ts, and enchanting-tick.ts.

D3 [LOW] — Fixed spec file reference from crafting-attunements.ts to data/attunements.ts.

D1/D6 [MEDIUM] — Added missing metalSpellFocus (capacity 50) to spec capacity table.

All 1086 tests pass.

All 6 discrepancies resolved and pushed to master (commit e45c206): **D2 [HIGH]** — spell_iceShard: Added to basic-spells.ts at cost 75 (canonical per spec §7.1 Basic), removed duplicate from frost-spells.ts (cost 95). **D7 [HIGH]** — disenchantEquipment now adds 'Ready for Enchantment' tag and resets rarity to 'common', matching completePreparation() behavior. **D8 [HIGH]** — disenchantEquipment now credits recovered mana to the raw mana pool via useManaStore. **D13 [HIGH]** — Already implemented: discipline perks with unlocksEffects are defined in data files, collected by discipline-slice processTick, and wired to craftingStore.unlockEffects via gameStore tick. **D14 [HIGH]** — Added getEnchantingEfficiencyBonus() in discipline-effects.ts that converts enchantPower to efficiencyBonus (enchantPower/100, capped at 0.9). Wired into craftingStore.startDesigningEnchantment, design-actions.ts, and enchanting-tick.ts. **D3 [LOW]** — Fixed spec file reference from crafting-attunements.ts to data/attunements.ts. **D1/D6 [MEDIUM]** — Added missing metalSpellFocus (capacity 50) to spec capacity table. All 1086 tests pass.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#324