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 # 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. 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) data/guardian-encounters.ts > data/guardian-procedural.ts
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"_meta": { "_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.", "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." "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 4. Player names the design
5. Player clicks "Create Design" → design begins 5. Player clicks "Create Design" → design begins
6. `designProgress` accumulates at `HOURS_PER_TICK` per tick 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 ### 3.2 Timing Formula
@@ -32,7 +32,7 @@ export function EnchantmentApplier({
}: EnchantmentApplierProps) { }: EnchantmentApplierProps) {
const equippedInstances = useCraftingStore((s) => s.equippedInstances); const equippedInstances = useCraftingStore((s) => s.equippedInstances);
const equipmentInstances = useCraftingStore((s) => s.equipmentInstances); 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 applicationProgress = useCraftingStore((s) => s.applicationProgress);
const _rawMana = useManaStore((s) => s.rawMana); const _rawMana = useManaStore((s) => s.rawMana);
const startApplying = useCraftingStore((s) => s.startApplying); const startApplying = useCraftingStore((s) => s.startApplying);
@@ -54,7 +54,7 @@ export function EnchantmentApplier({
if (!selectedEquipmentInstance || !selectedDesign) return; if (!selectedEquipmentInstance || !selectedDesign) return;
const instance = equipmentInstances[selectedEquipmentInstance]; const instance = equipmentInstances[selectedEquipmentInstance];
const design = enchantmentDesigns.find(d => d.id === selectedDesign); const design = completedEnchantmentDesigns.find(d => d.id === selectedDesign);
if (!instance || !design) return; if (!instance || !design) return;
@@ -152,7 +152,7 @@ export function EnchantmentApplier({
<div className="text-sm text-[var(--text-muted)] mb-2">Design:</div> <div className="text-sm text-[var(--text-muted)] mb-2">Design:</div>
<ScrollArea className="h-32"> <ScrollArea className="h-32">
<div className="space-y-1"> <div className="space-y-1">
{enchantmentDesigns.map(design => ( {completedEnchantmentDesigns.map(design => (
<div <div
key={design.id} key={design.id}
className={`p-2 rounded border cursor-pointer text-sm transition-all className={`p-2 rounded border cursor-pointer text-sm transition-all
@@ -172,7 +172,7 @@ export function EnchantmentApplier({
</span> </span>
</div> </div>
))} ))}
{enchantmentDesigns.length === 0 && ( {completedEnchantmentDesigns.length === 0 && (
<div className="text-center text-[var(--text-muted)] text-xs py-2"> <div className="text-center text-[var(--text-muted)] text-xs py-2">
No designs available. Create one in the Design stage. No designs available. Create one in the Design stage.
</div> </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; if (!design) return null;
const availableCap = instance.totalCapacity - instance.usedCapacity; const availableCap = instance.totalCapacity - instance.usedCapacity;
@@ -36,7 +36,7 @@ export function EnchantmentDesigner() {
const setSelectedDesign = useCraftingStore((s) => s.setSelectedDesign); const setSelectedDesign = useCraftingStore((s) => s.setSelectedDesign);
// Crafting store — other state // Crafting store — other state
const enchantmentDesigns = useCraftingStore((s) => s.enchantmentDesigns); const completedEnchantmentDesigns = useCraftingStore((s) => s.completedEnchantmentDesigns);
const designProgress = useCraftingStore((s) => s.designProgress); const designProgress = useCraftingStore((s) => s.designProgress);
const startDesigningEnchantment = useCraftingStore((s) => s.startDesigningEnchantment); const startDesigningEnchantment = useCraftingStore((s) => s.startDesigningEnchantment);
const cancelDesign = useCraftingStore((s) => s.cancelDesign); const cancelDesign = useCraftingStore((s) => s.cancelDesign);
@@ -140,7 +140,7 @@ export function EnchantmentDesigner() {
{/* Saved Designs */} {/* Saved Designs */}
<SavedDesigns <SavedDesigns
enchantmentDesigns={enchantmentDesigns} completedEnchantmentDesigns={completedEnchantmentDesigns}
selectedDesign={selectedDesign} selectedDesign={selectedDesign}
setSelectedDesign={setSelectedDesign} setSelectedDesign={setSelectedDesign}
deleteDesign={deleteDesign} deleteDesign={deleteDesign}
@@ -9,7 +9,7 @@ import type { SavedDesignsProps } from './types';
import { DebugName } from '@/components/game/debug/debug-context'; import { DebugName } from '@/components/game/debug/debug-context';
export function SavedDesigns({ export function SavedDesigns({
enchantmentDesigns, completedEnchantmentDesigns,
selectedDesign, selectedDesign,
setSelectedDesign, setSelectedDesign,
deleteDesign, deleteDesign,
@@ -17,14 +17,14 @@ export function SavedDesigns({
return ( return (
<DebugName name="SavedDesigns"> <DebugName name="SavedDesigns">
<GameCard variant="default" className="lg:col-span-2"> <GameCard variant="default" className="lg:col-span-2">
<SectionHeader title={`Saved Designs (${enchantmentDesigns.length})`} /> <SectionHeader title={`Saved Designs (${completedEnchantmentDesigns.length})`} />
{enchantmentDesigns.length === 0 ? ( {completedEnchantmentDesigns.length === 0 ? (
<div className="text-center text-[var(--text-muted)] py-4"> <div className="text-center text-[var(--text-muted)] py-4">
No saved designs yet No saved designs yet
</div> </div>
) : ( ) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3"> <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
{enchantmentDesigns.map(design => ( {completedEnchantmentDesigns.map(design => (
<div <div
key={design.id} key={design.id}
className={`p-3 rounded border cursor-pointer transition-all className={`p-3 rounded border cursor-pointer transition-all
@@ -23,7 +23,7 @@ export interface EffectSelectorProps {
} }
export interface SavedDesignsProps { export interface SavedDesignsProps {
enchantmentDesigns: EnchantmentDesign[]; completedEnchantmentDesigns: EnchantmentDesign[];
selectedDesign: string | null; selectedDesign: string | null;
setSelectedDesign: (id: string | null) => void; setSelectedDesign: (id: string | null) => void;
deleteDesign: (id: string) => void; deleteDesign: (id: string) => void;
@@ -97,7 +97,7 @@ export function resetAllStores() {
preparationProgress: null, preparationProgress: null,
applicationProgress: null, applicationProgress: null,
equipmentCraftingProgress: null, equipmentCraftingProgress: null,
enchantmentDesigns: [], completedEnchantmentDesigns: [],
unlockedEffects: [], unlockedEffects: [],
equippedInstances: {}, equippedInstances: {},
equipmentInstances: {}, equipmentInstances: {},
@@ -103,7 +103,7 @@ function resetAllStores() {
preparationProgress: null, preparationProgress: null,
applicationProgress: null, applicationProgress: null,
equipmentCraftingProgress: null, equipmentCraftingProgress: null,
enchantmentDesigns: [], completedEnchantmentDesigns: [],
unlockedEffects: [], unlockedEffects: [],
equippedInstances: {}, equippedInstances: {},
equipmentInstances: {}, equipmentInstances: {},
@@ -92,7 +92,7 @@ function resetAllStores() {
preparationProgress: null, preparationProgress: null,
applicationProgress: null, applicationProgress: null,
equipmentCraftingProgress: null, equipmentCraftingProgress: null,
enchantmentDesigns: [], completedEnchantmentDesigns: [],
unlockedEffects: [], unlockedEffects: [],
equippedInstances: {}, equippedInstances: {},
equipmentInstances: {}, equipmentInstances: {},
@@ -111,7 +111,7 @@ function setNonDefaultState() {
equipmentType: 'basicStaff', equipmentType: 'basicStaff',
effects: [{ effectId: 'spell_fireBolt', stacks: 1, actualCost: 30 }], 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'], unlockedEffects: ['spell_fireBolt', 'spell_iceBolt'],
unlockedRecipes: ['recipe1', 'recipe2'], unlockedRecipes: ['recipe1', 'recipe2'],
lootInventory: { lootInventory: {
@@ -253,7 +253,7 @@ describe('resetGame comprehensive', () => {
const crafting = useCraftingStore.getState(); const crafting = useCraftingStore.getState();
expect(crafting.designProgress).toBeNull(); expect(crafting.designProgress).toBeNull();
expect(crafting.designProgress2).toBeNull(); expect(crafting.designProgress2).toBeNull();
expect(crafting.enchantmentDesigns).toEqual([]); expect(crafting.completedEnchantmentDesigns).toEqual([]);
expect(crafting.unlockedEffects).toEqual([]); expect(crafting.unlockedEffects).toEqual([]);
expect(crafting.unlockedRecipes).toEqual([]); expect(crafting.unlockedRecipes).toEqual([]);
expect(crafting.lootInventory.materials).toEqual({}); expect(crafting.lootInventory.materials).toEqual({});
@@ -19,7 +19,7 @@ export function startApplying(
): boolean { ): boolean {
const state = get(); const state = get();
const instance = state.equipmentInstances[equipmentInstanceId]; 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( const validation = CraftingApply.canApplyEnchantment(
instance, instance,
@@ -97,12 +97,12 @@ export function saveDesign(
const state = get(); const state = get();
if (state.designProgress2 && state.designProgress2.designId === design.id) { if (state.designProgress2 && state.designProgress2.designId === design.id) {
set((s) => ({ set((s) => ({
enchantmentDesigns: [...s.enchantmentDesigns, design], completedEnchantmentDesigns: [...s.completedEnchantmentDesigns, design],
designProgress2: null, designProgress2: null,
})); }));
} else { } else {
set((s) => ({ set((s) => ({
enchantmentDesigns: [...s.enchantmentDesigns, design], completedEnchantmentDesigns: [...s.completedEnchantmentDesigns, design],
designProgress: null, designProgress: null,
})); }));
} }
@@ -113,6 +113,6 @@ export function deleteDesign(
set: (fn: (state: CraftingState) => Partial<CraftingState>) => void set: (fn: (state: CraftingState) => Partial<CraftingState>) => void
) { ) {
set((state) => ({ 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, preparationProgress: null,
applicationProgress: null, applicationProgress: null,
equipmentCraftingProgress: null, equipmentCraftingProgress: null,
enchantmentDesigns: [], completedEnchantmentDesigns: [],
unlockedEffects: [], unlockedEffects: [],
unlockedRecipes: [], unlockedRecipes: [],
equippedInstances: initial.equippedInstances, equippedInstances: initial.equippedInstances,
+1 -1
View File
@@ -293,7 +293,7 @@ export const useCraftingStore = create<CraftingStore>()(
preparationProgress: state.preparationProgress, preparationProgress: state.preparationProgress,
applicationProgress: state.applicationProgress, applicationProgress: state.applicationProgress,
equipmentCraftingProgress: state.equipmentCraftingProgress, equipmentCraftingProgress: state.equipmentCraftingProgress,
enchantmentDesigns: state.enchantmentDesigns, completedEnchantmentDesigns: state.completedEnchantmentDesigns,
unlockedEffects: state.unlockedEffects, unlockedEffects: state.unlockedEffects,
unlockedRecipes: state.unlockedRecipes, unlockedRecipes: state.unlockedRecipes,
equipmentInstances: state.equipmentInstances, equipmentInstances: state.equipmentInstances,
+1 -1
View File
@@ -24,7 +24,7 @@ export interface CraftingState {
preparationProgress: PreparationProgress | null; preparationProgress: PreparationProgress | null;
applicationProgress: ApplicationProgress | null; applicationProgress: ApplicationProgress | null;
equipmentCraftingProgress: EquipmentCraftingProgress | null; equipmentCraftingProgress: EquipmentCraftingProgress | null;
enchantmentDesigns: EnchantmentDesign[]; completedEnchantmentDesigns: EnchantmentDesign[];
unlockedEffects: string[]; unlockedEffects: string[];
unlockedRecipes: string[]; unlockedRecipes: string[];
equipmentInstances: Record<string, EquipmentInstance>; equipmentInstances: Record<string, EquipmentInstance>;
@@ -42,7 +42,7 @@ export function processEnchantingTicks(
writes.combat = { ...(writes.combat || {}), currentAction: 'meditate' }; writes.combat = { ...(writes.combat || {}), currentAction: 'meditate' };
} else { } else {
const activeProgress = designProgress || designProgress2!; const activeProgress = designProgress || designProgress2!;
const isRepeatDesign = ctx.crafting.enchantmentDesigns.some( const isRepeatDesign = ctx.crafting.completedEnchantmentDesigns.some(
(d) => d.name === activeProgress.name, (d) => d.name === activeProgress.name,
); );
const designResult = calculateDesignProgress( const designResult = calculateDesignProgress(
@@ -64,7 +64,7 @@ export function processEnchantingTicks(
); );
// Return write instead of calling store directly // Return write instead of calling store directly
mergeCrafting({ mergeCrafting({
enchantmentDesigns: [...ctx.crafting.enchantmentDesigns, completedDesign], completedEnchantmentDesigns: [...ctx.crafting.completedEnchantmentDesigns, completedDesign],
designProgress: designProgress ? null : undefined, designProgress: designProgress ? null : undefined,
designProgress2: designProgress2 ? null : undefined, designProgress2: designProgress2 ? null : undefined,
}); });
@@ -145,7 +145,7 @@ export function processEnchantingTicks(
} }
} else { } else {
const instance = ctx.crafting.equipmentInstances[appProgress.equipmentInstanceId]; 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) { if (!instance || !design) {
mergeCrafting({ applicationProgress: null }); mergeCrafting({ applicationProgress: null });
writes.combat = { ...(writes.combat || {}), currentAction: 'meditate' }; writes.combat = { ...(writes.combat || {}), currentAction: 'meditate' };
+1 -1
View File
@@ -239,7 +239,7 @@ export interface GameState {
// Equipment System (new instance-based system) // Equipment System (new instance-based system)
equippedInstances: Record<string, string | null>; // slot -> instanceId equippedInstances: Record<string, string | null>; // slot -> instanceId
equipmentInstances: Record<string, EquipmentInstance>; // instanceId -> instance equipmentInstances: Record<string, EquipmentInstance>; // instanceId -> instance
enchantmentDesigns: EnchantmentDesign[]; // Saved enchantment designs completedEnchantmentDesigns: EnchantmentDesign[]; // Saved enchantment designs
// Crafting Progress // Crafting Progress
designProgress: DesignProgress | null; designProgress: DesignProgress | null;