8261baab54
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 3m32s
- Add 'tags' field to EquipmentInstance type - Modify Prepare step to show warning and different button text when item has enchantments - Consolidate disenchanting into Prepare step (remove separate disenchant UI) - After successful preparation, item receives 'Ready for Enchantment' tag - Modify Apply step to only allow applying enchantments to items tagged 'Ready for Enchantment' - Update subtask_6_progress.md and todo.md to mark Sub-Task 6 as completed
3.7 KiB
3.7 KiB
Sub-Task 6 Progress: CraftingTab Prepare/Apply Disenchant Consolidation
Status: Completed
Completed Steps
- Review Sub-Task 5 completion (ensure no conflicts)
- Add 'tags' field to EquipmentInstance type in equipment.ts
- Update CraftingTab Prepare step: Add logic to check if item has existing enchantments and update button text
- Modify startPreparation in crafting-slice.ts to remove existing enchantments and add 'Ready for Enchantment' tag
- Modify EnchantmentApplier to only allow applying enchantments to items tagged 'Ready for Enchantment'
- Consolidate disenchanting into Prepare step (remove separate disenchant UI)
- Test full Design-Prepare-Apply flow to ensure all criteria are met
- Run npm run build to check for build errors
- Commit and push changes
Implementation Details
Problem
The disenchanting functionality was separate from the Prepare step, requiring users to manually disenchant items before preparing them for enchantment. Additionally, there was no clear indication of which items were ready for enchantment.
Solution
-
Added 'tags' field to EquipmentInstance type (
src/lib/game/types/equipment.ts):- Added
tags: string[]field to track item state - Initialized with empty array in
createEquipmentInstancefunction
- Added
-
Modified Prepare step UI (
src/components/game/crafting/EnchantmentPreparer.tsx):- Updated button text to show "Start Preparation — this will remove existing enchantments" when item has enchantments
- Removed separate disenchant UI section
- Consolidated disenchanting into the Prepare step
- Shows warning when item has enchantments that will be removed
- Shows "Ready for Enchantment" status when item is prepared
- Disables Prepare button if item is already prepared
-
Modified Preparation completion logic (
src/lib/game/crafting-slice.ts):- When preparation completes, enchantments are cleared (disenchanted)
- Mana is recovered based on disenchanting skill level
- 'Ready for Enchantment' tag is added to the item
- Item's used capacity is reset to 0
- Item's rarity is reset to 'common'
-
Modified Apply step (
src/components/game/crafting/EnchantmentApplier.tsx):- Only shows items tagged 'Ready for Enchantment' in the equipment selection
- Shows clear error message if user tries to apply enchantment to non-prepared item
- Displays "✓ Ready" indicator next to prepared items
-
Modified startApplying function (
src/lib/game/crafting-slice.ts):- Added check to ensure equipment has 'Ready for Enchantment' tag before allowing enchantment application
Files Modified
src/lib/game/types/equipment.ts- Added tags field to EquipmentInstancesrc/lib/game/crafting-slice.ts- Updated preparation completion, startApplying, and startPreparing logicsrc/components/game/crafting/EnchantmentPreparer.tsx- Consolidated disenchant into prepare, updated button textsrc/components/game/crafting/EnchantmentApplier.tsx- Filter for prepared items only
Testing
- Build succeeds with
npm run build - Prepare step correctly shows warning and different button text for enchanted items
- After preparation completes, item receives 'Ready for Enchantment' tag
- Apply step only allows applying to prepared items
- Disenchanting is fully consolidated into Prepare step
Notes
- The 'Ready for Enchantment' tag is added only after successful preparation (not when manually disenchanting)
- Mana recovery from disenchanting during preparation is based on the disenchanting skill level
- The separate
disenchantEquipmentfunction is no longer called from the UI (consolidated into prepare) - Build tested successfully