refactor: rename enchantmentDesigns to completedEnchantmentDesigns across codebase
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m28s

This commit is contained in:
2026-06-15 13:25:55 +02:00
parent 83106bf37d
commit 8c93756778
18 changed files with 31 additions and 31 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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."
},
@@ -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
@@ -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({
<div className="text-sm text-[var(--text-muted)] mb-2">Design:</div>
<ScrollArea className="h-32">
<div className="space-y-1">
{enchantmentDesigns.map(design => (
{completedEnchantmentDesigns.map(design => (
<div
key={design.id}
className={`p-2 rounded border cursor-pointer text-sm transition-all
@@ -172,7 +172,7 @@ export function EnchantmentApplier({
</span>
</div>
))}
{enchantmentDesigns.length === 0 && (
{completedEnchantmentDesigns.length === 0 && (
<div className="text-center text-[var(--text-muted)] text-xs py-2">
No designs available. Create one in the Design stage.
</div>
@@ -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;
@@ -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 */}
<SavedDesigns
enchantmentDesigns={enchantmentDesigns}
completedEnchantmentDesigns={completedEnchantmentDesigns}
selectedDesign={selectedDesign}
setSelectedDesign={setSelectedDesign}
deleteDesign={deleteDesign}
@@ -9,7 +9,7 @@ import type { SavedDesignsProps } from './types';
import { DebugName } from '@/components/game/debug/debug-context';
export function SavedDesigns({
enchantmentDesigns,
completedEnchantmentDesigns,
selectedDesign,
setSelectedDesign,
deleteDesign,
@@ -17,14 +17,14 @@ export function SavedDesigns({
return (
<DebugName name="SavedDesigns">
<GameCard variant="default" className="lg:col-span-2">
<SectionHeader title={`Saved Designs (${enchantmentDesigns.length})`} />
{enchantmentDesigns.length === 0 ? (
<SectionHeader title={`Saved Designs (${completedEnchantmentDesigns.length})`} />
{completedEnchantmentDesigns.length === 0 ? (
<div className="text-center text-[var(--text-muted)] py-4">
No saved designs yet
</div>
) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
{enchantmentDesigns.map(design => (
{completedEnchantmentDesigns.map(design => (
<div
key={design.id}
className={`p-3 rounded border cursor-pointer transition-all
@@ -23,7 +23,7 @@ export interface EffectSelectorProps {
}
export interface SavedDesignsProps {
enchantmentDesigns: EnchantmentDesign[];
completedEnchantmentDesigns: EnchantmentDesign[];
selectedDesign: string | null;
setSelectedDesign: (id: string | null) => void;
deleteDesign: (id: string) => void;
@@ -97,7 +97,7 @@ export function resetAllStores() {
preparationProgress: null,
applicationProgress: null,
equipmentCraftingProgress: null,
enchantmentDesigns: [],
completedEnchantmentDesigns: [],
unlockedEffects: [],
equippedInstances: {},
equipmentInstances: {},
@@ -103,7 +103,7 @@ function resetAllStores() {
preparationProgress: null,
applicationProgress: null,
equipmentCraftingProgress: null,
enchantmentDesigns: [],
completedEnchantmentDesigns: [],
unlockedEffects: [],
equippedInstances: {},
equipmentInstances: {},
@@ -92,7 +92,7 @@ function resetAllStores() {
preparationProgress: null,
applicationProgress: null,
equipmentCraftingProgress: null,
enchantmentDesigns: [],
completedEnchantmentDesigns: [],
unlockedEffects: [],
equippedInstances: {},
equipmentInstances: {},
@@ -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({});
@@ -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,
@@ -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<CraftingState>) => void
) {
set((state) => ({
enchantmentDesigns: state.enchantmentDesigns.filter(d => d.id !== designId),
completedEnchantmentDesigns: state.completedEnchantmentDesigns.filter(d => d.id !== designId),
}));
}
@@ -17,7 +17,7 @@ export function createDefaultCraftingState(): CraftingState {
preparationProgress: null,
applicationProgress: null,
equipmentCraftingProgress: null,
enchantmentDesigns: [],
completedEnchantmentDesigns: [],
unlockedEffects: [],
unlockedRecipes: [],
equippedInstances: initial.equippedInstances,
+1 -1
View File
@@ -293,7 +293,7 @@ export const useCraftingStore = create<CraftingStore>()(
preparationProgress: state.preparationProgress,
applicationProgress: state.applicationProgress,
equipmentCraftingProgress: state.equipmentCraftingProgress,
enchantmentDesigns: state.enchantmentDesigns,
completedEnchantmentDesigns: state.completedEnchantmentDesigns,
unlockedEffects: state.unlockedEffects,
unlockedRecipes: state.unlockedRecipes,
equipmentInstances: state.equipmentInstances,
+1 -1
View File
@@ -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<string, EquipmentInstance>;
@@ -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' };
+1 -1
View File
@@ -239,7 +239,7 @@ export interface GameState {
// Equipment System (new instance-based system)
equippedInstances: Record<string, string | null>; // slot -> instanceId
equipmentInstances: Record<string, EquipmentInstance>; // instanceId -> instance
enchantmentDesigns: EnchantmentDesign[]; // Saved enchantment designs
completedEnchantmentDesigns: EnchantmentDesign[]; // Saved enchantment designs
// Crafting Progress
designProgress: DesignProgress | null;