fix: handle duplicate component keys in conversion cost recipes
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m2s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m2s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# 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.
|
||||
|
||||
1. 1) stores/golem-combat-actions.ts > stores/golem-combat-helpers.ts
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"_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.",
|
||||
"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."
|
||||
},
|
||||
|
||||
@@ -39,37 +39,46 @@ function baseElementCost(element: string): ConversionCost {
|
||||
|
||||
/** Build a ConversionCost for a composite element (distance 2) */
|
||||
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 {
|
||||
element,
|
||||
distance: 2,
|
||||
rawCost: computeRawCost(2), // 1,000
|
||||
componentCosts: Object.fromEntries(
|
||||
components.map(c => [c, computeComponentCost(2)]), // 30 each
|
||||
),
|
||||
componentCosts,
|
||||
};
|
||||
}
|
||||
|
||||
/** Build a ConversionCost for an exotic element (distance 3) */
|
||||
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 {
|
||||
element,
|
||||
distance: 3,
|
||||
rawCost: computeRawCost(3), // 10,000
|
||||
componentCosts: Object.fromEntries(
|
||||
components.map(c => [c, computeComponentCost(3)]), // 40 each
|
||||
),
|
||||
componentCosts,
|
||||
};
|
||||
}
|
||||
|
||||
/** Build a ConversionCost for time (distance 4) */
|
||||
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 {
|
||||
element,
|
||||
distance: 4,
|
||||
rawCost: computeRawCost(4), // 100,000
|
||||
componentCosts: Object.fromEntries(
|
||||
components.map(c => [c, computeComponentCost(4)]), // 50 each
|
||||
),
|
||||
componentCosts,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user