fix: handle duplicate component keys in conversion cost recipes
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m2s

This commit is contained in:
2026-06-10 22:55:49 +02:00
parent 092e6a3d52
commit 51710e2e1b
3 changed files with 20 additions and 11 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
# Circular Dependencies # Circular Dependencies
Generated: 2026-06-10T19:48:45.847Z Generated: 2026-06-10T19:51:19.886Z
Found: 3 circular chain(s) — these MUST be fixed before modifying involved files. Found: 3 circular chain(s) — these MUST be fixed before modifying involved files.
1. 1) stores/golem-combat-actions.ts > stores/golem-combat-helpers.ts 1. 1) stores/golem-combat-actions.ts > stores/golem-combat-helpers.ts
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"_meta": { "_meta": {
"generated": "2026-06-10T19:48:43.733Z", "generated": "2026-06-10T19:51:17.712Z",
"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."
}, },
+18 -9
View File
@@ -39,37 +39,46 @@ function baseElementCost(element: string): ConversionCost {
/** Build a ConversionCost for a composite element (distance 2) */ /** Build a ConversionCost for a composite element (distance 2) */
function compositeElementCost(element: string, components: string[]): ConversionCost { function compositeElementCost(element: string, components: string[]): ConversionCost {
const costPerComponent = computeComponentCost(2); // 30 each
const componentCosts: Record<string, number> = {};
for (const c of components) {
componentCosts[c] = (componentCosts[c] || 0) + costPerComponent;
}
return { return {
element, element,
distance: 2, distance: 2,
rawCost: computeRawCost(2), // 1,000 rawCost: computeRawCost(2), // 1,000
componentCosts: Object.fromEntries( componentCosts,
components.map(c => [c, computeComponentCost(2)]), // 30 each
),
}; };
} }
/** Build a ConversionCost for an exotic element (distance 3) */ /** Build a ConversionCost for an exotic element (distance 3) */
function exoticElementCost(element: string, components: string[]): ConversionCost { function exoticElementCost(element: string, components: string[]): ConversionCost {
const costPerComponent = computeComponentCost(3); // 40 each
const componentCosts: Record<string, number> = {};
for (const c of components) {
componentCosts[c] = (componentCosts[c] || 0) + costPerComponent;
}
return { return {
element, element,
distance: 3, distance: 3,
rawCost: computeRawCost(3), // 10,000 rawCost: computeRawCost(3), // 10,000
componentCosts: Object.fromEntries( componentCosts,
components.map(c => [c, computeComponentCost(3)]), // 40 each
),
}; };
} }
/** Build a ConversionCost for time (distance 4) */ /** Build a ConversionCost for time (distance 4) */
function timeElementCost(element: string, components: string[]): ConversionCost { function timeElementCost(element: string, components: string[]): ConversionCost {
const costPerComponent = computeComponentCost(4); // 50 each
const componentCosts: Record<string, number> = {};
for (const c of components) {
componentCosts[c] = (componentCosts[c] || 0) + costPerComponent;
}
return { return {
element, element,
distance: 4, distance: 4,
rawCost: computeRawCost(4), // 100,000 rawCost: computeRawCost(4), // 100,000
componentCosts: Object.fromEntries( componentCosts,
components.map(c => [c, computeComponentCost(4)]), // 50 each
),
}; };
} }