[Medium] [Bug] Golemancy: Multi-type core upkeep not split across mana types #315
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 tocore.primaryManaTypeonly. 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-165Starting 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.
Fix committed and pushed. Summary of changes:
Files modified:
src/lib/game/stores/golem-combat-actions.ts(387 lines) — Core fix inprocessGolemMaintenance(): upkeep now split evenly across all core mana typessrc/lib/game/data/golems/utils.ts(186 lines) —computeGolemStats()now returns split upkeep costssrc/lib/game/stores/golem-combat-maintenance.test.ts(203 lines, new) — 6 regression tests for upkeep splittingsrc/lib/game/data/golems/golemancy-data.test.ts(384 lines) — 3 new tests forcomputeGolemStatssplit upkeepsrc/components/game/tabs/golemancy/GolemancyComponents.test.ts(282 lines) — Updated to match new split-upkeep behaviorRoot cause:
processGolemMaintenance()charged upkeep entirely tocore.primaryManaTypeinstead of splitting across allcore.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(orcore.manaTypesas 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.