TASK-007: Duplicate stat functions across multiple modules — consolidate into computeStats() #4

Closed
opened 2026-05-12 14:13:34 +02:00 by Anexim · 1 comment
Owner

Duplicate Stat Functions Need Consolidation

Multiple functions are duplicated across 3-4 locations. The new computeStats() in skills-v2.ts should be the single source, but old copies still exist and are used.

Duplicated functions:

Function Locations
computeMaxMana utils/mana-utils.ts, store-modules/computed-stats.ts, store/computed.ts, constants/skills-v2.ts (4 copies!)
computeRegen utils/mana-utils.ts, store-modules/computed-stats.ts, store/computed.ts (3 copies)
calcDamage utils/combat-utils.ts, store-modules/computed-stats.ts, store/computed.ts (3 copies)
getMeditationBonus utils/mana-utils.ts, store-modules/computed-stats.ts, store/computed.ts (3 copies)
getFloorMaxHP utils/floor-utils.ts, store/computed.ts (2 copies)
getFloorElement utils/floor-utils.ts, store/computed.ts (2 copies)
canAffordSpellCost utils/combat-utils.ts, store-modules/computed-stats.ts, store/computed.ts (3 copies)
fmt/fmtDec utils/formatting.ts, store/computed.ts (2 copies)

Plan:

  1. Make computeStats() in skills-v2.ts the single computation entry point
  2. computeMaxMana, computeRegen, computeClickMana should all come from applying computeStats() + prestige
  3. calcDamage, getMeditationBonus, etc. should read from ComputedStats output
  4. store/computed.ts should import from utils/ (not duplicate)
  5. store-modules/computed-stats.ts should import from utils/ (not duplicate)
  6. Delete duplicate functions once all callers are migrated

Acceptance criteria:

  • Each stat function exists in exactly one location
  • computeStats() is the foundation for mana/regen/click calculations
  • All tests pass with no regressions
## Duplicate Stat Functions Need Consolidation Multiple functions are duplicated across 3-4 locations. The new `computeStats()` in `skills-v2.ts` should be the single source, but old copies still exist and are used. ### Duplicated functions: | Function | Locations | |----------|----------| | `computeMaxMana` | `utils/mana-utils.ts`, `store-modules/computed-stats.ts`, `store/computed.ts`, `constants/skills-v2.ts` (4 copies!) | | `computeRegen` | `utils/mana-utils.ts`, `store-modules/computed-stats.ts`, `store/computed.ts` (3 copies) | | `calcDamage` | `utils/combat-utils.ts`, `store-modules/computed-stats.ts`, `store/computed.ts` (3 copies) | | `getMeditationBonus` | `utils/mana-utils.ts`, `store-modules/computed-stats.ts`, `store/computed.ts` (3 copies) | | `getFloorMaxHP` | `utils/floor-utils.ts`, `store/computed.ts` (2 copies) | | `getFloorElement` | `utils/floor-utils.ts`, `store/computed.ts` (2 copies) | | `canAffordSpellCost` | `utils/combat-utils.ts`, `store-modules/computed-stats.ts`, `store/computed.ts` (3 copies) | | `fmt`/`fmtDec` | `utils/formatting.ts`, `store/computed.ts` (2 copies) | ### Plan: 1. Make `computeStats()` in `skills-v2.ts` the single computation entry point 2. `computeMaxMana`, `computeRegen`, `computeClickMana` should all come from applying `computeStats()` + prestige 3. `calcDamage`, `getMeditationBonus`, etc. should read from `ComputedStats` output 4. `store/computed.ts` should import from `utils/` (not duplicate) 5. `store-modules/computed-stats.ts` should import from `utils/` (not duplicate) 6. Delete duplicate functions once all callers are migrated ### Acceptance criteria: - Each stat function exists in exactly one location - `computeStats()` is the foundation for mana/regen/click calculations - All tests pass with no regressions
Anexim added the ai:todo label 2026-05-12 14:13:34 +02:00
n8n-gitea was assigned by Anexim 2026-05-12 14:13:34 +02:00
Author
Owner

Closed and replaced by Issue #15: Migrate Legacy Skills System to Active Disciplines. TASK-007 skill evolution consolidation is superseded by the new system.

Closed and replaced by Issue #15: Migrate Legacy Skills System to Active Disciplines. TASK-007 skill evolution consolidation is superseded by the new system.
Anexim removed the ai:todo label 2026-05-18 10:19:21 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#4