From 0894ee8c5536f24331a0ffcc6c96badd9bd2dc37 Mon Sep 17 00:00:00 2001 From: n8n-gitea Date: Mon, 8 Jun 2026 13:13:57 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20material=20cancellation=20refund=20uses?= =?UTF-8?q?=20flat=2050%=20per=20spec=20=C2=A76.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/circular-deps.txt | 2 +- docs/dependency-graph.json | 2 +- src/lib/game/stores/pipelines/equipment-crafting.ts | 11 ++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index f03482c..8f53dd8 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,5 +1,5 @@ # Circular Dependencies -Generated: 2026-06-08T10:43:31.572Z +Generated: 2026-06-08T10:56:12.135Z Found: 1 circular chain(s) — these MUST be fixed before modifying involved files. 1. 1) stores/golem-combat-actions.ts > stores/golem-combat-helpers.ts diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index f781906..5e1e4aa 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,6 +1,6 @@ { "_meta": { - "generated": "2026-06-08T10:43:29.519Z", + "generated": "2026-06-08T10:56:10.139Z", "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/src/lib/game/stores/pipelines/equipment-crafting.ts b/src/lib/game/stores/pipelines/equipment-crafting.ts index 6a11e29..deb7adc 100644 --- a/src/lib/game/stores/pipelines/equipment-crafting.ts +++ b/src/lib/game/stores/pipelines/equipment-crafting.ts @@ -74,13 +74,13 @@ export function cancelEquipmentCrafting(get: GetFn, set: SetFn): void { const refunded = refundFabricatorMana(recipe, manaRefund, rawMana, elements); useManaStore.setState({ rawMana: refunded.rawMana, elements: refunded.elements }); - // Refund materials — use reduced amounts (what player actually paid) + // Refund materials — flat 50% per spec §6.3 const reduction = getCraftingCostReduction(); const currentMaterials = get().lootInventory.materials; const refundedMaterials = { ...currentMaterials }; for (const [matId, rawAmount] of Object.entries(recipe.materials)) { const reducedAmount = applyCostReduction(rawAmount, reduction); - const refundAmount = Math.floor(reducedAmount * remainingFraction); + const refundAmount = Math.floor(reducedAmount * 0.5); if (refundAmount > 0) { refundedMaterials[matId] = (refundedMaterials[matId] || 0) + refundAmount; } @@ -98,16 +98,13 @@ export function cancelEquipmentCrafting(get: GetFn, set: SetFn): void { progress.progress, progress.required, ); - // Refund materials proportionally to remaining progress + // Refund materials — flat 50% per spec §6.3 const recipe = CraftingEquipment.getRecipe(progress.blueprintId); if (recipe) { - const remainingFraction = progress.required > 0 - ? Math.max(0, (progress.required - progress.progress) / progress.required) - : 1; const currentMaterials = get().lootInventory.materials; const refundedMaterials = { ...currentMaterials }; for (const [matId, amount] of Object.entries(recipe.materials)) { - const refundAmount = Math.floor(amount * remainingFraction); + const refundAmount = Math.floor(amount * 0.5); if (refundAmount > 0) { refundedMaterials[matId] = (refundedMaterials[matId] || 0) + refundAmount; }