From 8c937567780fb690c20436884b3c136f053e66dd Mon Sep 17 00:00:00 2001 From: n8n-gitea Date: Mon, 15 Jun 2026 13:25:55 +0200 Subject: [PATCH] refactor: rename enchantmentDesigns to completedEnchantmentDesigns across codebase --- docs/circular-deps.txt | 2 +- docs/dependency-graph.json | 2 +- .../attunements/enchanter/systems/enchanting-spec.md | 2 +- src/components/game/crafting/EnchantmentApplier.tsx | 10 +++++----- src/components/game/crafting/EnchantmentDesigner.tsx | 4 ++-- .../game/crafting/EnchantmentDesigner/SavedDesigns.tsx | 8 ++++---- .../game/crafting/EnchantmentDesigner/types.ts | 2 +- src/lib/game/__tests__/cross-module-helpers.ts | 2 +- .../discipline-deactivate-on-spire-entry.test.ts | 2 +- src/lib/game/__tests__/paused-conversion-dedup.test.ts | 2 +- .../game/__tests__/reset-game-comprehensive.test.ts | 4 ++-- src/lib/game/crafting-actions/application-actions.ts | 2 +- src/lib/game/crafting-actions/design-actions.ts | 6 +++--- src/lib/game/stores/crafting-initial-state.ts | 2 +- src/lib/game/stores/craftingStore.ts | 2 +- src/lib/game/stores/craftingStore.types.ts | 2 +- src/lib/game/stores/pipelines/enchanting-tick.ts | 6 +++--- src/lib/game/types/game.ts | 2 +- 18 files changed, 31 insertions(+), 31 deletions(-) diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index 89fd740..d1747e6 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,5 +1,5 @@ # Circular Dependencies -Generated: 2026-06-15T10:29:07.349Z +Generated: 2026-06-15T11:06:55.418Z Found: 8 circular chain(s) — these MUST be fixed before modifying involved files. 1. 1) data/guardian-encounters.ts > data/guardian-procedural.ts diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index 78e99b1..a2dfc34 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,6 +1,6 @@ { "_meta": { - "generated": "2026-06-15T10:29:05.083Z", + "generated": "2026-06-15T11:06:52.872Z", "description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.", "usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry." }, diff --git a/docs/specs/attunements/enchanter/systems/enchanting-spec.md b/docs/specs/attunements/enchanter/systems/enchanting-spec.md index 997cc71..4500471 100644 --- a/docs/specs/attunements/enchanter/systems/enchanting-spec.md +++ b/docs/specs/attunements/enchanter/systems/enchanting-spec.md @@ -52,7 +52,7 @@ stripping existing enchantments, then applies designs to prepared equipment. 4. Player names the design 5. Player clicks "Create Design" → design begins 6. `designProgress` accumulates at `HOURS_PER_TICK` per tick -7. When `designProgress >= requiredTime` → design saved to `completedDesigns` +7. When `designProgress >= requiredTime` → design saved to `completedEnchantmentDesigns` ### 3.2 Timing Formula diff --git a/src/components/game/crafting/EnchantmentApplier.tsx b/src/components/game/crafting/EnchantmentApplier.tsx index 5a4ab98..77dcc75 100644 --- a/src/components/game/crafting/EnchantmentApplier.tsx +++ b/src/components/game/crafting/EnchantmentApplier.tsx @@ -32,7 +32,7 @@ export function EnchantmentApplier({ }: EnchantmentApplierProps) { const equippedInstances = useCraftingStore((s) => s.equippedInstances); const equipmentInstances = useCraftingStore((s) => s.equipmentInstances); - const enchantmentDesigns = useCraftingStore((s) => s.enchantmentDesigns); + const completedEnchantmentDesigns = useCraftingStore((s) => s.completedEnchantmentDesigns); const applicationProgress = useCraftingStore((s) => s.applicationProgress); const _rawMana = useManaStore((s) => s.rawMana); const startApplying = useCraftingStore((s) => s.startApplying); @@ -54,7 +54,7 @@ export function EnchantmentApplier({ if (!selectedEquipmentInstance || !selectedDesign) return; const instance = equipmentInstances[selectedEquipmentInstance]; - const design = enchantmentDesigns.find(d => d.id === selectedDesign); + const design = completedEnchantmentDesigns.find(d => d.id === selectedDesign); if (!instance || !design) return; @@ -152,7 +152,7 @@ export function EnchantmentApplier({
Design:
- {enchantmentDesigns.map(design => ( + {completedEnchantmentDesigns.map(design => (
))} - {enchantmentDesigns.length === 0 && ( + {completedEnchantmentDesigns.length === 0 && (
No designs available. Create one in the Design stage.
@@ -208,7 +208,7 @@ export function EnchantmentApplier({ ); } - const design = enchantmentDesigns.find(d => d.id === selectedDesign); + const design = completedEnchantmentDesigns.find(d => d.id === selectedDesign); if (!design) return null; const availableCap = instance.totalCapacity - instance.usedCapacity; diff --git a/src/components/game/crafting/EnchantmentDesigner.tsx b/src/components/game/crafting/EnchantmentDesigner.tsx index d021106..ccb77ca 100644 --- a/src/components/game/crafting/EnchantmentDesigner.tsx +++ b/src/components/game/crafting/EnchantmentDesigner.tsx @@ -36,7 +36,7 @@ export function EnchantmentDesigner() { const setSelectedDesign = useCraftingStore((s) => s.setSelectedDesign); // Crafting store — other state - const enchantmentDesigns = useCraftingStore((s) => s.enchantmentDesigns); + const completedEnchantmentDesigns = useCraftingStore((s) => s.completedEnchantmentDesigns); const designProgress = useCraftingStore((s) => s.designProgress); const startDesigningEnchantment = useCraftingStore((s) => s.startDesigningEnchantment); const cancelDesign = useCraftingStore((s) => s.cancelDesign); @@ -140,7 +140,7 @@ export function EnchantmentDesigner() { {/* Saved Designs */} - - {enchantmentDesigns.length === 0 ? ( + + {completedEnchantmentDesigns.length === 0 ? (
No saved designs yet
) : (
- {enchantmentDesigns.map(design => ( + {completedEnchantmentDesigns.map(design => (
void; deleteDesign: (id: string) => void; diff --git a/src/lib/game/__tests__/cross-module-helpers.ts b/src/lib/game/__tests__/cross-module-helpers.ts index 9924bb9..b56f2c2 100644 --- a/src/lib/game/__tests__/cross-module-helpers.ts +++ b/src/lib/game/__tests__/cross-module-helpers.ts @@ -97,7 +97,7 @@ export function resetAllStores() { preparationProgress: null, applicationProgress: null, equipmentCraftingProgress: null, - enchantmentDesigns: [], + completedEnchantmentDesigns: [], unlockedEffects: [], equippedInstances: {}, equipmentInstances: {}, diff --git a/src/lib/game/__tests__/discipline-deactivate-on-spire-entry.test.ts b/src/lib/game/__tests__/discipline-deactivate-on-spire-entry.test.ts index e82e43b..2b8e375 100644 --- a/src/lib/game/__tests__/discipline-deactivate-on-spire-entry.test.ts +++ b/src/lib/game/__tests__/discipline-deactivate-on-spire-entry.test.ts @@ -103,7 +103,7 @@ function resetAllStores() { preparationProgress: null, applicationProgress: null, equipmentCraftingProgress: null, - enchantmentDesigns: [], + completedEnchantmentDesigns: [], unlockedEffects: [], equippedInstances: {}, equipmentInstances: {}, diff --git a/src/lib/game/__tests__/paused-conversion-dedup.test.ts b/src/lib/game/__tests__/paused-conversion-dedup.test.ts index 4017be7..deb95fa 100644 --- a/src/lib/game/__tests__/paused-conversion-dedup.test.ts +++ b/src/lib/game/__tests__/paused-conversion-dedup.test.ts @@ -92,7 +92,7 @@ function resetAllStores() { preparationProgress: null, applicationProgress: null, equipmentCraftingProgress: null, - enchantmentDesigns: [], + completedEnchantmentDesigns: [], unlockedEffects: [], equippedInstances: {}, equipmentInstances: {}, diff --git a/src/lib/game/__tests__/reset-game-comprehensive.test.ts b/src/lib/game/__tests__/reset-game-comprehensive.test.ts index bae83fb..e0d92c0 100644 --- a/src/lib/game/__tests__/reset-game-comprehensive.test.ts +++ b/src/lib/game/__tests__/reset-game-comprehensive.test.ts @@ -111,7 +111,7 @@ function setNonDefaultState() { equipmentType: 'basicStaff', effects: [{ effectId: 'spell_fireBolt', stacks: 1, actualCost: 30 }], }, - enchantmentDesigns: [{ id: 'design-1', name: 'My Design', equipmentType: 'basicStaff', effects: [], totalCapacityCost: 30, totalStacks: 1 }], + completedEnchantmentDesigns: [{ id: 'design-1', name: 'My Design', equipmentType: 'basicStaff', effects: [], totalCapacityCost: 30, totalStacks: 1 }], unlockedEffects: ['spell_fireBolt', 'spell_iceBolt'], unlockedRecipes: ['recipe1', 'recipe2'], lootInventory: { @@ -253,7 +253,7 @@ describe('resetGame comprehensive', () => { const crafting = useCraftingStore.getState(); expect(crafting.designProgress).toBeNull(); expect(crafting.designProgress2).toBeNull(); - expect(crafting.enchantmentDesigns).toEqual([]); + expect(crafting.completedEnchantmentDesigns).toEqual([]); expect(crafting.unlockedEffects).toEqual([]); expect(crafting.unlockedRecipes).toEqual([]); expect(crafting.lootInventory.materials).toEqual({}); diff --git a/src/lib/game/crafting-actions/application-actions.ts b/src/lib/game/crafting-actions/application-actions.ts index 2e29aa0..64b74ea 100644 --- a/src/lib/game/crafting-actions/application-actions.ts +++ b/src/lib/game/crafting-actions/application-actions.ts @@ -19,7 +19,7 @@ export function startApplying( ): boolean { const state = get(); const instance = state.equipmentInstances[equipmentInstanceId]; - const design = state.enchantmentDesigns.find(d => d.id === designId); + const design = state.completedEnchantmentDesigns.find(d => d.id === designId); const validation = CraftingApply.canApplyEnchantment( instance, diff --git a/src/lib/game/crafting-actions/design-actions.ts b/src/lib/game/crafting-actions/design-actions.ts index 45c6de7..fef7a0c 100644 --- a/src/lib/game/crafting-actions/design-actions.ts +++ b/src/lib/game/crafting-actions/design-actions.ts @@ -97,12 +97,12 @@ export function saveDesign( const state = get(); if (state.designProgress2 && state.designProgress2.designId === design.id) { set((s) => ({ - enchantmentDesigns: [...s.enchantmentDesigns, design], + completedEnchantmentDesigns: [...s.completedEnchantmentDesigns, design], designProgress2: null, })); } else { set((s) => ({ - enchantmentDesigns: [...s.enchantmentDesigns, design], + completedEnchantmentDesigns: [...s.completedEnchantmentDesigns, design], designProgress: null, })); } @@ -113,6 +113,6 @@ export function deleteDesign( set: (fn: (state: CraftingState) => Partial) => void ) { set((state) => ({ - enchantmentDesigns: state.enchantmentDesigns.filter(d => d.id !== designId), + completedEnchantmentDesigns: state.completedEnchantmentDesigns.filter(d => d.id !== designId), })); } diff --git a/src/lib/game/stores/crafting-initial-state.ts b/src/lib/game/stores/crafting-initial-state.ts index f337507..01f9bc1 100644 --- a/src/lib/game/stores/crafting-initial-state.ts +++ b/src/lib/game/stores/crafting-initial-state.ts @@ -17,7 +17,7 @@ export function createDefaultCraftingState(): CraftingState { preparationProgress: null, applicationProgress: null, equipmentCraftingProgress: null, - enchantmentDesigns: [], + completedEnchantmentDesigns: [], unlockedEffects: [], unlockedRecipes: [], equippedInstances: initial.equippedInstances, diff --git a/src/lib/game/stores/craftingStore.ts b/src/lib/game/stores/craftingStore.ts index cc40122..c06cf72 100644 --- a/src/lib/game/stores/craftingStore.ts +++ b/src/lib/game/stores/craftingStore.ts @@ -293,7 +293,7 @@ export const useCraftingStore = create()( preparationProgress: state.preparationProgress, applicationProgress: state.applicationProgress, equipmentCraftingProgress: state.equipmentCraftingProgress, - enchantmentDesigns: state.enchantmentDesigns, + completedEnchantmentDesigns: state.completedEnchantmentDesigns, unlockedEffects: state.unlockedEffects, unlockedRecipes: state.unlockedRecipes, equipmentInstances: state.equipmentInstances, diff --git a/src/lib/game/stores/craftingStore.types.ts b/src/lib/game/stores/craftingStore.types.ts index f99a1e7..ad07229 100644 --- a/src/lib/game/stores/craftingStore.types.ts +++ b/src/lib/game/stores/craftingStore.types.ts @@ -24,7 +24,7 @@ export interface CraftingState { preparationProgress: PreparationProgress | null; applicationProgress: ApplicationProgress | null; equipmentCraftingProgress: EquipmentCraftingProgress | null; - enchantmentDesigns: EnchantmentDesign[]; + completedEnchantmentDesigns: EnchantmentDesign[]; unlockedEffects: string[]; unlockedRecipes: string[]; equipmentInstances: Record; diff --git a/src/lib/game/stores/pipelines/enchanting-tick.ts b/src/lib/game/stores/pipelines/enchanting-tick.ts index ddf43a1..ce71fe8 100644 --- a/src/lib/game/stores/pipelines/enchanting-tick.ts +++ b/src/lib/game/stores/pipelines/enchanting-tick.ts @@ -42,7 +42,7 @@ export function processEnchantingTicks( writes.combat = { ...(writes.combat || {}), currentAction: 'meditate' }; } else { const activeProgress = designProgress || designProgress2!; - const isRepeatDesign = ctx.crafting.enchantmentDesigns.some( + const isRepeatDesign = ctx.crafting.completedEnchantmentDesigns.some( (d) => d.name === activeProgress.name, ); const designResult = calculateDesignProgress( @@ -64,7 +64,7 @@ export function processEnchantingTicks( ); // Return write instead of calling store directly mergeCrafting({ - enchantmentDesigns: [...ctx.crafting.enchantmentDesigns, completedDesign], + completedEnchantmentDesigns: [...ctx.crafting.completedEnchantmentDesigns, completedDesign], designProgress: designProgress ? null : undefined, designProgress2: designProgress2 ? null : undefined, }); @@ -145,7 +145,7 @@ export function processEnchantingTicks( } } else { const instance = ctx.crafting.equipmentInstances[appProgress.equipmentInstanceId]; - const design = ctx.crafting.enchantmentDesigns.find((d) => d.id === appProgress.designId); + const design = ctx.crafting.completedEnchantmentDesigns.find((d) => d.id === appProgress.designId); if (!instance || !design) { mergeCrafting({ applicationProgress: null }); writes.combat = { ...(writes.combat || {}), currentAction: 'meditate' }; diff --git a/src/lib/game/types/game.ts b/src/lib/game/types/game.ts index 2b93fe7..e354c52 100644 --- a/src/lib/game/types/game.ts +++ b/src/lib/game/types/game.ts @@ -239,7 +239,7 @@ export interface GameState { // Equipment System (new instance-based system) equippedInstances: Record; // slot -> instanceId equipmentInstances: Record; // instanceId -> instance - enchantmentDesigns: EnchantmentDesign[]; // Saved enchantment designs + completedEnchantmentDesigns: EnchantmentDesign[]; // Saved enchantment designs // Crafting Progress designProgress: DesignProgress | null;