[priority: highest] Remove skill system leftovers — migrate click mana to discipline perk #174

Closed
opened 2026-05-28 10:49:03 +02:00 by Anexim · 3 comments
Owner

Summary

The old skill system (skills: Record<string, number>, skillUpgrades, skillTiers, skillProgress, studyQueue, etc.) was removed, but significant dead code remains scattered across the codebase. This issue tracks the full cleanup and one migration.

What needs to happen

1. Scrap meditation-tier skills completely

The getMeditationBonus() function in src/lib/game/utils/mana-utils.ts:127-166 checks three skill flags — skills.meditation, skills.deepTrance, skills.voidMeditation — that are always undefined because skills is always {} at runtime. The multi-tier ramp (base 1.5× → 2.5× → 3.0× → 5.0×) is dead code.

Change: Simplify getMeditationBonus() to a single continuous ramp: 1 + (hours / 8) * 4, capped at 5.0 * meditationEfficiency. Remove the skills parameter entirely. The function signature becomes:

export function getMeditationBonus(
  meditateTicks: number,
  meditationEfficiency: number = 1,
  disciplineMeditationCap: number = 0,
): number

See: src/lib/game/utils/mana-utils.ts:127-166

2. Replace meditation cap discipline perk

The Mana Circulation discipline in src/lib/game/data/disciplines/base.ts:62-69 has a capped perk:

"Every 100 XP: +0.5 max meditation cap (7 tiers, up to +3.5). Raises Void Meditation ceiling."

This should be changed to a direct multiplier bonus instead:

"Every 100 XP: +0.5 to meditation multiplier (7 tiers, up to +3.5). Adds directly to the meditation multiplier cap."

The stat key stays meditationCapBonus — it still adds to the cap value, which is now just 5.0 + disciplineMeditationCap. No plumbing changes needed in discipline-effects.ts.

See: src/lib/game/data/disciplines/base.ts:62-69

3. Remove mana skills (manaWell, manaFlow, manaSpring)

These skills are read in computeMaxMana() and computeRegen() in src/lib/game/utils/mana-utils.ts:

  • skills.manaWell+100 max mana per level (line 41)
  • skills.manaFlow+1 regen per level (line 62)
  • skills.manaSpring+2 regen per level (line 63)

Replaced by discipline stat bonuses (maxManaBonus, regenBonus, regenMultiplier) from Raw Mana Mastery and Mana Circulation. Remove these three skill reads from computeMaxMana() and computeRegen().

Remove manaWell and manaFlow prestige upgrade handling too — they are still defined in src/lib/game/constants/prestige.ts and consumed in effects.ts:189 and mana-utils.ts:42,64. The prestige upgrade table and its references in effects.ts and mana-utils.ts need removal.

See:

  • src/lib/game/utils/mana-utils.ts:38-43 (computeMaxMana)
  • src/lib/game/utils/mana-utils.ts:60-64 (computeRegen)
  • src/lib/game/effects.ts:184-190 (computeTotalMaxMana)
  • src/lib/game/effects.ts:196-210 (computeTotalRegen)
  • src/lib/game/constants/prestige.ts (prestige upgrade definitions)

4. Add click-mana capped perk to Mana Circulation discipline

The old manaTap (+1 click/level) and manaSurge (+3 click/level) skills are removed, but click-mana progression needs to exist. Add a capped perk to the Mana Circulation discipline in src/lib/game/data/disciplines/base.ts:

{
  id: 'mana-circulation-click',
  type: 'capped',
  threshold: 500,
  value: 500,
  description: 'Every 500 XP: +1 mana per click (5 tiers, up to +5).',
  bonus: { stat: 'clickManaBonus', amount: 1 },
  maxTier: 5,
},

Wire the clickManaBonus stat into computeDisciplineEffects() → already handled by KNOWN_BONUS_STATS in src/lib/game/effects/discipline-effects.ts — verify clickManaBonus is in the set (it flows through the generic bonuses path to computeClickMana).

Then remove all skills.manaTap and skills.manaSurge reads from computeClickMana():

// After:
export function computeClickMana(
  discipline?: DisciplineBonuses,
): number {
  const discClickMult = discipline?.bonuses?.clickManaMultiplier || 0;
  return 1 + discClickMult;
}

Wait — the stat name is clickManaBonus (additive) not clickManaMultiplier. The computeClickMana function uses discipline?.bonuses?.clickManaMultiplier. Perk bonus stat should be clickManaBonus and should be added: 1 + discipline?.bonuses?.clickManaBonus || 0.

See:

  • src/lib/game/utils/mana-utils.ts:114-120 (computeClickMana)
  • src/lib/game/data/disciplines/base.ts:49-69 (Mana Circulation perks)

5. Remove all remaining skill leftover types/fields

Remove the following from GameState in src/lib/game/types/game.ts:170-173:

skills: Record<string, number>;
skillProgress: Record<string, number>;
skillUpgrades: Record<string, string[]>;
skillTiers: Record<string, number>;

Remove from GameActionType in src/lib/game/types/game.ts:293-294:

| { type: 'START_STUDYING_SKILL'; skillId: string }
| { type: 'SELECT_SKILL_UPGRADE'; skillId: string; upgradeId: string }
| { type: 'TIER_UP_SKILL'; skillId: string }

Remove from ManaComputeParams / RegenComputeParams interfaces in src/lib/game/utils/mana-utils.ts:20-24:

skills?: Record<string, number>;
skillUpgrades?: Record<string, string[]>;
skillTiers?: Record<string, number>;

Remove skillUpgrades and skillTiers parameters from computeAllEffects() and related function signatures in src/lib/game/effects.ts.

Remove skillUpgrades / skillTiers from manaStore.ts resetMana() signature.

Remove skillUpgrades / skillTiers from all call sites in:

  • src/lib/game/stores/gameStore.ts (lines 108, 113, 132)
  • src/lib/game/stores/gameHooks.ts (lines 36-37, 58-59, 65, 71)
  • src/lib/game/stores/gameActions.ts (lines 56-57)
  • src/lib/game/hooks/useGameDerived.ts (lines 42, 47)

6. Update tests

The following test files reference removed skill keys and need updating:

  • src/lib/game/__tests__/mana-utils.test.ts — Remove tests for manaWell, manaFlow, manaSpring, manaTap, manaSurge skills; remove meditation tier skill tests; update getMeditationBonus signature
  • src/lib/game/__tests__/computed-stats.test.ts — Remove skill-based assertions
  • src/lib/game/__tests__/cross-module-combat-meditation.test.ts — Update meditation multiplier expectations to match new simplified ramp
  • src/lib/game/__tests__/tick-integration.test.ts — Remove skill references

Files affected (confirmed)

File Change
src/lib/game/types/game.ts Remove skill fields from GameState, skill actions from GameActionType
src/lib/game/utils/mana-utils.ts Simplify getMeditationBonus, remove skill reads from computeMaxMana/computeRegen/computeClickMana, remove skill params from interfaces
src/lib/game/data/disciplines/base.ts Update meditation cap perk description, add click-mana capped perk
src/lib/game/effects.ts Remove skillUpgrades/skillTiers params, remove skill reads
src/lib/game/stores/gameStore.ts Remove skills/skillUpgrades/skillTiers from all call sites
src/lib/game/stores/gameHooks.ts Remove skillUpgrades/skillTiers from all call sites
src/lib/game/stores/gameActions.ts Remove skillUpgrades/skillTiers
src/lib/game/stores/manaStore.ts Remove optional skill params from resetMana()
src/lib/game/hooks/useGameDerived.ts Remove skills/skillUpgrades/skillTiers from all call sites
src/lib/game/constants/core.ts Remove getStudySpeedMultiplier / getStudyCostMultiplier (use skills param)
src/lib/game/constants/prestige.ts Remove manaWell and manaFlow prestige upgrades
src/lib/game/__tests__/mana-utils.test.ts Remove skill tests, update meditation tests
src/lib/game/__tests__/computed-stats.test.ts Remove skill-based tests
src/lib/game/__tests__/cross-module-combat-meditation.test.ts Update meditation expectations
src/lib/game/__tests__/tick-integration.test.ts Clean up if skill references exist
## Summary The old skill system (`skills: Record<string, number>`, `skillUpgrades`, `skillTiers`, `skillProgress`, `studyQueue`, etc.) was removed, but significant dead code remains scattered across the codebase. This issue tracks the full cleanup and one migration. ## What needs to happen ### 1. Scrap meditation-tier skills completely The `getMeditationBonus()` function in `src/lib/game/utils/mana-utils.ts:127-166` checks three skill flags — `skills.meditation`, `skills.deepTrance`, `skills.voidMeditation` — that are always `undefined` because `skills` is always `{}` at runtime. The multi-tier ramp (base 1.5× → 2.5× → 3.0× → 5.0×) is dead code. **Change:** Simplify `getMeditationBonus()` to a single continuous ramp: `1 + (hours / 8) * 4`, capped at `5.0 * meditationEfficiency`. Remove the `skills` parameter entirely. The function signature becomes: ```ts export function getMeditationBonus( meditateTicks: number, meditationEfficiency: number = 1, disciplineMeditationCap: number = 0, ): number ``` See: `src/lib/game/utils/mana-utils.ts:127-166` ### 2. Replace meditation cap discipline perk The Mana Circulation discipline in `src/lib/game/data/disciplines/base.ts:62-69` has a capped perk: > "Every 100 XP: +0.5 max meditation cap (7 tiers, up to +3.5). Raises Void Meditation ceiling." This should be changed to a direct multiplier bonus instead: > "Every 100 XP: +0.5 to meditation multiplier (7 tiers, up to +3.5). Adds directly to the meditation multiplier cap." The stat key stays `meditationCapBonus` — it still adds to the cap value, which is now just `5.0 + disciplineMeditationCap`. No plumbing changes needed in `discipline-effects.ts`. See: `src/lib/game/data/disciplines/base.ts:62-69` ### 3. Remove mana skills (manaWell, manaFlow, manaSpring) These skills are read in `computeMaxMana()` and `computeRegen()` in `src/lib/game/utils/mana-utils.ts`: - `skills.manaWell` → `+100 max mana per level` (line 41) - `skills.manaFlow` → `+1 regen per level` (line 62) - `skills.manaSpring` → `+2 regen per level` (line 63) Replaced by discipline stat bonuses (`maxManaBonus`, `regenBonus`, `regenMultiplier`) from Raw Mana Mastery and Mana Circulation. **Remove these three skill reads from `computeMaxMana()` and `computeRegen()`.** Remove `manaWell` and `manaFlow` prestige upgrade handling too — they are still defined in `src/lib/game/constants/prestige.ts` and consumed in `effects.ts:189` and `mana-utils.ts:42,64`. The prestige upgrade table and its references in `effects.ts` and `mana-utils.ts` need removal. See: - `src/lib/game/utils/mana-utils.ts:38-43` (computeMaxMana) - `src/lib/game/utils/mana-utils.ts:60-64` (computeRegen) - `src/lib/game/effects.ts:184-190` (computeTotalMaxMana) - `src/lib/game/effects.ts:196-210` (computeTotalRegen) - `src/lib/game/constants/prestige.ts` (prestige upgrade definitions) ### 4. Add click-mana capped perk to Mana Circulation discipline The old `manaTap` (+1 click/level) and `manaSurge` (+3 click/level) skills are removed, but click-mana progression needs to exist. Add a capped perk to the **Mana Circulation** discipline in `src/lib/game/data/disciplines/base.ts`: ```ts { id: 'mana-circulation-click', type: 'capped', threshold: 500, value: 500, description: 'Every 500 XP: +1 mana per click (5 tiers, up to +5).', bonus: { stat: 'clickManaBonus', amount: 1 }, maxTier: 5, }, ``` Wire the `clickManaBonus` stat into `computeDisciplineEffects()` → already handled by `KNOWN_BONUS_STATS` in `src/lib/game/effects/discipline-effects.ts` — verify `clickManaBonus` is in the set (it flows through the generic `bonuses` path to `computeClickMana`). Then **remove all `skills.manaTap` and `skills.manaSurge` reads** from `computeClickMana()`: ```ts // After: export function computeClickMana( discipline?: DisciplineBonuses, ): number { const discClickMult = discipline?.bonuses?.clickManaMultiplier || 0; return 1 + discClickMult; } ``` Wait — the stat name is `clickManaBonus` (additive) not `clickManaMultiplier`. The `computeClickMana` function uses `discipline?.bonuses?.clickManaMultiplier`. Perk bonus stat should be `clickManaBonus` and should be added: `1 + discipline?.bonuses?.clickManaBonus || 0`. See: - `src/lib/game/utils/mana-utils.ts:114-120` (computeClickMana) - `src/lib/game/data/disciplines/base.ts:49-69` (Mana Circulation perks) ### 5. Remove all remaining skill leftover types/fields Remove the following from `GameState` in `src/lib/game/types/game.ts:170-173`: ```ts skills: Record<string, number>; skillProgress: Record<string, number>; skillUpgrades: Record<string, string[]>; skillTiers: Record<string, number>; ``` Remove from `GameActionType` in `src/lib/game/types/game.ts:293-294`: ```ts | { type: 'START_STUDYING_SKILL'; skillId: string } | { type: 'SELECT_SKILL_UPGRADE'; skillId: string; upgradeId: string } | { type: 'TIER_UP_SKILL'; skillId: string } ``` Remove from `ManaComputeParams` / `RegenComputeParams` interfaces in `src/lib/game/utils/mana-utils.ts:20-24`: ```ts skills?: Record<string, number>; skillUpgrades?: Record<string, string[]>; skillTiers?: Record<string, number>; ``` Remove `skillUpgrades` and `skillTiers` parameters from `computeAllEffects()` and related function signatures in `src/lib/game/effects.ts`. Remove `skillUpgrades` / `skillTiers` from `manaStore.ts` `resetMana()` signature. Remove `skillUpgrades` / `skillTiers` from all call sites in: - `src/lib/game/stores/gameStore.ts` (lines 108, 113, 132) - `src/lib/game/stores/gameHooks.ts` (lines 36-37, 58-59, 65, 71) - `src/lib/game/stores/gameActions.ts` (lines 56-57) - `src/lib/game/hooks/useGameDerived.ts` (lines 42, 47) ### 6. Update tests The following test files reference removed skill keys and need updating: - `src/lib/game/__tests__/mana-utils.test.ts` — Remove tests for `manaWell`, `manaFlow`, `manaSpring`, `manaTap`, `manaSurge` skills; remove meditation tier skill tests; update `getMeditationBonus` signature - `src/lib/game/__tests__/computed-stats.test.ts` — Remove skill-based assertions - `src/lib/game/__tests__/cross-module-combat-meditation.test.ts` — Update meditation multiplier expectations to match new simplified ramp - `src/lib/game/__tests__/tick-integration.test.ts` — Remove skill references ## Files affected (confirmed) | File | Change | |---|---| | `src/lib/game/types/game.ts` | Remove skill fields from GameState, skill actions from GameActionType | | `src/lib/game/utils/mana-utils.ts` | Simplify `getMeditationBonus`, remove skill reads from `computeMaxMana`/`computeRegen`/`computeClickMana`, remove skill params from interfaces | | `src/lib/game/data/disciplines/base.ts` | Update meditation cap perk description, add click-mana capped perk | | `src/lib/game/effects.ts` | Remove `skillUpgrades`/`skillTiers` params, remove skill reads | | `src/lib/game/stores/gameStore.ts` | Remove `skills`/`skillUpgrades`/`skillTiers` from all call sites | | `src/lib/game/stores/gameHooks.ts` | Remove `skillUpgrades`/`skillTiers` from all call sites | | `src/lib/game/stores/gameActions.ts` | Remove `skillUpgrades`/`skillTiers` | | `src/lib/game/stores/manaStore.ts` | Remove optional skill params from `resetMana()` | | `src/lib/game/hooks/useGameDerived.ts` | Remove `skills`/`skillUpgrades`/`skillTiers` from all call sites | | `src/lib/game/constants/core.ts` | Remove `getStudySpeedMultiplier` / `getStudyCostMultiplier` (use `skills` param) | | `src/lib/game/constants/prestige.ts` | Remove `manaWell` and `manaFlow` prestige upgrades | | `src/lib/game/__tests__/mana-utils.test.ts` | Remove skill tests, update meditation tests | | `src/lib/game/__tests__/computed-stats.test.ts` | Remove skill-based tests | | `src/lib/game/__tests__/cross-module-combat-meditation.test.ts` | Update meditation expectations | | `src/lib/game/__tests__/tick-integration.test.ts` | Clean up if skill references exist |
Anexim added the ai:todo label 2026-05-28 10:49:03 +02:00
n8n-gitea was assigned by Anexim 2026-05-28 10:49:03 +02:00
Author
Owner

Starting work on issue #174: Remove skill system leftovers and migrate click mana to discipline perk. I'll work through the 6 steps in order.

Starting work on issue #174: Remove skill system leftovers and migrate click mana to discipline perk. I'll work through the 6 steps in order.
Author
Owner

All 6 steps completed. 916 tests passing across 48 test files.

Summary of changes:

  1. Simplified getMeditationBonus() — removed skills param, replaced multi-tier ramp (1.5×→2.5×→3.0×→5.0×) with single continuous ramp: 1 + (hours/8)*4, capped at 5.0 + disciplineMeditationCap

  2. Updated Mana Circulation discipline — changed meditation cap perk description from "Raises Void Meditation ceiling" to "Adds directly to the meditation multiplier cap"; added new capped perk: mana-circulation-click (Every 500 XP: +1 mana per click, 5 tiers up to +5)

  3. Removed mana skill reads — removed skills.manaWell from computeMaxMana(), skills.manaFlow/skills.manaSpring from computeRegen(); removed manaWell and manaFlow prestige upgrades from PRESTIGE_DEF

  4. Migrated click-mana to discipline perkcomputeClickMana() no longer takes skills param, uses discipline.bonuses.clickManaBonus instead; removed skills.manaTap/skills.manaSurge reads

  5. Removed all skill leftover types/fields — removed skills, skillProgress, skillUpgrades, skillTiers from GameState; removed START_STUDYING_SKILL, SELECT_SKILL_UPGRADE, TIER_UP_SKILL from GameActionType; removed skills/skillUpgrades/skillTiers from ManaComputeParams, RegenComputeParams, DamageCalcParams, DPSCalcParams, InsightCalcParams; updated all call sites across stores, hooks, and derived state

  6. Updated tests — removed skill-based test cases; updated signatures; all 916 tests passing

All 6 steps completed. 916 tests passing across 48 test files. **Summary of changes:** 1. **Simplified `getMeditationBonus()`** — removed `skills` param, replaced multi-tier ramp (1.5×→2.5×→3.0×→5.0×) with single continuous ramp: `1 + (hours/8)*4`, capped at `5.0 + disciplineMeditationCap` 2. **Updated Mana Circulation discipline** — changed meditation cap perk description from "Raises Void Meditation ceiling" to "Adds directly to the meditation multiplier cap"; added new capped perk: `mana-circulation-click` (Every 500 XP: +1 mana per click, 5 tiers up to +5) 3. **Removed mana skill reads** — removed `skills.manaWell` from `computeMaxMana()`, `skills.manaFlow`/`skills.manaSpring` from `computeRegen()`; removed `manaWell` and `manaFlow` prestige upgrades from `PRESTIGE_DEF` 4. **Migrated click-mana to discipline perk** — `computeClickMana()` no longer takes `skills` param, uses `discipline.bonuses.clickManaBonus` instead; removed `skills.manaTap`/`skills.manaSurge` reads 5. **Removed all skill leftover types/fields** — removed `skills`, `skillProgress`, `skillUpgrades`, `skillTiers` from `GameState`; removed `START_STUDYING_SKILL`, `SELECT_SKILL_UPGRADE`, `TIER_UP_SKILL` from `GameActionType`; removed `skills`/`skillUpgrades`/`skillTiers` from `ManaComputeParams`, `RegenComputeParams`, `DamageCalcParams`, `DPSCalcParams`, `InsightCalcParams`; updated all call sites across stores, hooks, and derived state 6. **Updated tests** — removed skill-based test cases; updated signatures; all 916 tests passing
Author
Owner

Issue #174 completed. All 6 steps done, 916 tests passing. Committing and pushing now.

Issue #174 completed. All 6 steps done, 916 tests passing. Committing and pushing now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#174