[priority: high] feat: Practicing disciplines should set currentAction to "practicing" to block meditation/crafting #141

Closed
opened 2026-05-26 15:26:06 +02:00 by Anexim · 0 comments
Owner

Problem

Activating a discipline does not change currentAction in combatStore. This means the player can:

  • Meditate while disciplines are active (gaining meditation bonuses while draining mana for disciplines)
  • Craft/enchant/prep while disciplines are active (also draining mana)

This is exploitative — discipline practice should be exclusive, not stackable with meditation or crafting.

Current Behavior

  • discipline-slice.ts activate() / deactivate() never touches currentAction
  • The tick in gameStore.ts checks currentAction === 'meditate' to accumulate meditateTicks and compute meditationMultiplier. Any non-meditate action resets meditateTicks to 0.
  • Crafting guards (crafting-apply.ts, crafting-equipment.ts) check currentAction !== 'meditate' to block crafting.

Desired Behavior

  • When any discipline is active, currentAction should become 'practicing'
  • 'practicing' is NOT 'meditate', so meditation ticks reset naturally
  • 'practicing' is NOT 'meditate', so crafting/enchanting guards naturally block crafting
  • When all disciplines are deactivated (and no other action is set), return to 'meditate'

What Needs to Change

Types

  1. src/lib/game/types/game.ts — Add 'practicing' to the GameAction union:
    export type GameAction = 'meditate' | 'practicing' | 'climb' | 'study' | 'craft' | 'repair' | 'convert' | 'design' | 'prepare' | 'enchant';
    

Discipline Store

  1. src/lib/game/stores/discipline-slice.ts — In activate():
    • After successfully activating, set currentAction to 'practicing' via useCombatStore
    • In deactivate(): after deactivating, if no active disciplines remain, set currentAction back to 'meditate'
    • Must handle edge case: if player was in another action (e.g. climb) and activates a discipline, don't override — only set 'practicing' if action was 'meditate'

Combat State

  1. src/lib/game/stores/combat-state.types.ts — Add startPracticing and stopPracticing action signatures
  2. src/lib/game/stores/combatStore.ts — Implement startPracticing / stopPracticing (following startClimbUp pattern)

Tick Pipeline

  1. src/lib/game/stores/gameStore.ts — No changes needed! The existing if (ctx.combat.currentAction === 'meditate') check naturally excludes 'practicing', so meditateTicks resets automatically. Non-meditate actions already reset ticks to 0.

UI

  1. Update any UI components that display the current action to handle/show 'practicing'
  2. Disable the meditate button while disciplines are active (or show that you're practicing)

Files

  • src/lib/game/types/game.ts — add 'practicing' to GameAction
  • src/lib/game/stores/combat-state.types.ts — add action signatures
  • src/lib/game/stores/combatStore.ts — implement actions
  • src/lib/game/stores/discipline-slice.ts — wire activate/deactivate to set/restore action
  • UI components that display/action buttons

Test References

  • src/lib/game/__tests__/discipline-math.test.ts — existing discipline tests
  • src/lib/game/__tests__/cross-module-prestige-discipline.test.ts — cross-module tests
## Problem Activating a discipline does **not** change `currentAction` in `combatStore`. This means the player can: - Meditate while disciplines are active (gaining meditation bonuses while draining mana for disciplines) - Craft/enchant/prep while disciplines are active (also draining mana) This is exploitative — discipline practice should be exclusive, not stackable with meditation or crafting. ## Current Behavior - `discipline-slice.ts activate()` / `deactivate()` never touches `currentAction` - The tick in `gameStore.ts` checks `currentAction === 'meditate'` to accumulate `meditateTicks` and compute `meditationMultiplier`. Any non-meditate action resets `meditateTicks` to 0. - Crafting guards (`crafting-apply.ts`, `crafting-equipment.ts`) check `currentAction !== 'meditate'` to block crafting. ## Desired Behavior - When any discipline is active, `currentAction` should become `'practicing'` - `'practicing'` is NOT `'meditate'`, so meditation ticks reset naturally - `'practicing'` is NOT `'meditate'`, so crafting/enchanting guards naturally block crafting - When all disciplines are deactivated (and no other action is set), return to `'meditate'` ## What Needs to Change ### Types 1. `src/lib/game/types/game.ts` — Add `'practicing'` to the `GameAction` union: ```typescript export type GameAction = 'meditate' | 'practicing' | 'climb' | 'study' | 'craft' | 'repair' | 'convert' | 'design' | 'prepare' | 'enchant'; ``` ### Discipline Store 2. `src/lib/game/stores/discipline-slice.ts` — In `activate()`: - After successfully activating, set `currentAction` to `'practicing'` via `useCombatStore` - In `deactivate()`: after deactivating, if no active disciplines remain, set `currentAction` back to `'meditate'` - Must handle edge case: if player was in another action (e.g. `climb`) and activates a discipline, don't override — only set `'practicing'` if action was `'meditate'` ### Combat State 3. `src/lib/game/stores/combat-state.types.ts` — Add `startPracticing` and `stopPracticing` action signatures 4. `src/lib/game/stores/combatStore.ts` — Implement `startPracticing` / `stopPracticing` (following `startClimbUp` pattern) ### Tick Pipeline 5. `src/lib/game/stores/gameStore.ts` — No changes needed! The existing `if (ctx.combat.currentAction === 'meditate')` check naturally excludes `'practicing'`, so `meditateTicks` resets automatically. Non-meditate actions already reset ticks to 0. ### UI 6. Update any UI components that display the current action to handle/show `'practicing'` 7. Disable the meditate button while disciplines are active (or show that you're practicing) ## Files - `src/lib/game/types/game.ts` — add `'practicing'` to GameAction - `src/lib/game/stores/combat-state.types.ts` — add action signatures - `src/lib/game/stores/combatStore.ts` — implement actions - `src/lib/game/stores/discipline-slice.ts` — wire activate/deactivate to set/restore action - UI components that display/action buttons ## Test References - `src/lib/game/__tests__/discipline-math.test.ts` — existing discipline tests - `src/lib/game/__tests__/cross-module-prestige-discipline.test.ts` — cross-module tests
Anexim added the ai:todo label 2026-05-26 15:26:06 +02:00
n8n-gitea was assigned by Anexim 2026-05-26 15:26:06 +02:00
Anexim changed title from feat: Practicing disciplines should set currentAction to "practicing" to block meditation/crafting to [priority: high] feat: Practicing disciplines should set currentAction to "practicing" to block meditation/crafting 2026-05-26 15:29:48 +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#141