[Medium] [Bug] Golemancy: Multi-type core upkeep not split across mana types #315

Closed
opened 2026-06-07 17:43:56 +02:00 by Anexim · 2 comments
Owner

Spec: docs/specs/attunements/fabricator/systems/golemancy-spec.md §13
Severity: Wrong formula

Problem: src/lib/game/stores/golem-combat-actions.ts:163-165 — Upkeep is charged entirely to core.primaryManaType only. The spec says "For multi-type cores, cost is split evenly across types." This means Intermediate, Advanced, and Guardian cores drain only one mana type instead of splitting the cost.

File: src/lib/game/stores/golem-combat-actions.ts:163-165

**Spec:** docs/specs/attunements/fabricator/systems/golemancy-spec.md §13 **Severity:** Wrong formula **Problem:** `src/lib/game/stores/golem-combat-actions.ts:163-165` — Upkeep is charged entirely to `core.primaryManaType` only. The spec says "For multi-type cores, cost is split evenly across types." This means Intermediate, Advanced, and Guardian cores drain only one mana type instead of splitting the cost. **File:** `src/lib/game/stores/golem-combat-actions.ts:163-165`
Anexim added the ai:todo label 2026-06-07 17:43:56 +02:00
n8n-gitea was assigned by Anexim 2026-06-07 17:43:56 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-08 13:16:58 +02:00
Author
Owner

Starting work on multi-type core upkeep fix. The bug is in processGolemMaintenance() — upkeep is charged entirely to core.primaryManaType instead of being split across all core.manaTypes.

Starting work on multi-type core upkeep fix. The bug is in processGolemMaintenance() — upkeep is charged entirely to core.primaryManaType instead of being split across all core.manaTypes.
Anexim added ai:done and removed ai:in-progress labels 2026-06-08 13:30:32 +02:00
Author
Owner

Fix committed and pushed. Summary of changes:

Files modified:

  • src/lib/game/stores/golem-combat-actions.ts (387 lines) — Core fix in processGolemMaintenance(): upkeep now split evenly across all core mana types
  • src/lib/game/data/golems/utils.ts (186 lines) — computeGolemStats() now returns split upkeep costs
  • src/lib/game/stores/golem-combat-maintenance.test.ts (203 lines, new) — 6 regression tests for upkeep splitting
  • src/lib/game/data/golems/golemancy-data.test.ts (384 lines) — 3 new tests for computeGolemStats split upkeep
  • src/components/game/tabs/golemancy/GolemancyComponents.test.ts (282 lines) — Updated to match new split-upkeep behavior

Root cause: processGolemMaintenance() charged upkeep entirely to core.primaryManaType instead of splitting across all core.manaTypes. For multi-type cores (Intermediate, Advanced, Guardian), this meant only one mana type was drained.

Fix: Upkeep is now split evenly across design.selectedManaTypes (or core.manaTypes as fallback). The check is atomic — if any type can't pay its share, the golem is dismissed and no mana is deducted.

Test results: 1069 tests passing (58 files), including 9 new regression tests.

**Fix committed and pushed.** Summary of changes: **Files modified:** - `src/lib/game/stores/golem-combat-actions.ts` (387 lines) — Core fix in `processGolemMaintenance()`: upkeep now split evenly across all core mana types - `src/lib/game/data/golems/utils.ts` (186 lines) — `computeGolemStats()` now returns split upkeep costs - `src/lib/game/stores/golem-combat-maintenance.test.ts` (203 lines, new) — 6 regression tests for upkeep splitting - `src/lib/game/data/golems/golemancy-data.test.ts` (384 lines) — 3 new tests for `computeGolemStats` split upkeep - `src/components/game/tabs/golemancy/GolemancyComponents.test.ts` (282 lines) — Updated to match new split-upkeep behavior **Root cause:** `processGolemMaintenance()` charged upkeep entirely to `core.primaryManaType` instead of splitting across all `core.manaTypes`. For multi-type cores (Intermediate, Advanced, Guardian), this meant only one mana type was drained. **Fix:** Upkeep is now split evenly across `design.selectedManaTypes` (or `core.manaTypes` as fallback). The check is atomic — if any type can't pay its share, the golem is dismissed and no mana is deducted. **Test results:** 1069 tests passing (58 files), including 9 new regression tests.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#315