From 1c1bbf8017fe355016247d812867c47c1957aa11 Mon Sep 17 00:00:00 2001 From: n8n-gitea Date: Tue, 26 May 2026 18:39:54 +0200 Subject: [PATCH] feat: practicing disciplines set currentAction to block meditation/crafting --- docs/circular-deps.txt | 4 ++-- docs/dependency-graph.json | 2 +- src/components/game/ActionButtons.tsx | 3 ++- src/lib/game/stores/combat-state.types.ts | 2 ++ src/lib/game/stores/combatStore.ts | 12 ++++++++++++ src/lib/game/stores/discipline-slice.ts | 22 ++++++++++++++++------ src/lib/game/types/game.ts | 2 +- 7 files changed, 36 insertions(+), 11 deletions(-) diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index 686eb30..e23949e 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,8 +1,8 @@ # Circular Dependencies -Generated: 2026-05-26T16:00:34.993Z +Generated: 2026-05-26T16:28:29.780Z Found: 6 circular chain(s) — these MUST be fixed before modifying involved files. -1. Processed 135 files (1.6s) (2 warnings) +1. Processed 135 files (1.5s) (2 warnings) 2. 1) utils/floor-utils.ts > utils/room-utils.ts > utils/enemy-utils.ts 3. 2) utils/floor-utils.ts > utils/room-utils.ts 4. 3) stores/gameStore.ts > stores/gameActions.ts diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index 28f3787..937e8fa 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,6 +1,6 @@ { "_meta": { - "generated": "2026-05-26T16:00:33.141Z", + "generated": "2026-05-26T16:28:28.147Z", "description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.", "usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry." }, diff --git a/src/components/game/ActionButtons.tsx b/src/components/game/ActionButtons.tsx index 09e4cf0..264e8f3 100755 --- a/src/components/game/ActionButtons.tsx +++ b/src/components/game/ActionButtons.tsx @@ -1,6 +1,6 @@ 'use client'; -import { Sparkles, Swords, BookOpen, Target, FlaskConical, Cog, Hammer } from 'lucide-react'; +import { Sparkles, Swords, BookOpen, Target, FlaskConical, Cog, Hammer, Dumbbell } from 'lucide-react'; import type { GameAction } from '@/lib/game/types'; interface ActionButtonsProps { @@ -16,6 +16,7 @@ interface ActionButtonsProps { // Map action IDs to labels and icons const ACTION_CONFIG: Record = { meditate: { label: 'Meditating', icon: Sparkles, color: 'text-blue-400' }, + practicing: { label: 'Practicing Discipline', icon: Dumbbell, color: 'text-amber-400' }, climb: { label: 'Climbing', icon: Swords, color: 'text-green-400' }, study: { label: 'Studying', icon: BookOpen, color: 'text-yellow-400' }, design: { label: 'Designing Enchantment', icon: Target, color: 'text-purple-400' }, diff --git a/src/lib/game/stores/combat-state.types.ts b/src/lib/game/stores/combat-state.types.ts index da40832..25d3b03 100644 --- a/src/lib/game/stores/combat-state.types.ts +++ b/src/lib/game/stores/combat-state.types.ts @@ -76,6 +76,8 @@ export interface CombatActions { exitSpireMode: () => void; startClimbUp: () => void; startClimbDown: () => void; + startPracticing: () => void; + stopPracticing: () => void; // Golemancy toggleGolem: (golemId: string) => void; diff --git a/src/lib/game/stores/combatStore.ts b/src/lib/game/stores/combatStore.ts index 2e85f5d..20beb71 100644 --- a/src/lib/game/stores/combatStore.ts +++ b/src/lib/game/stores/combatStore.ts @@ -163,6 +163,18 @@ export const useCombatStore = create()( startClimbDown: () => set({ climbDirection: 'down', currentAction: 'climb' }), + startPracticing: () => set((s) => { + // Only override if the current action is 'meditate' — don't clobber climb/study/etc. + if (s.currentAction !== 'meditate') return s; + return { currentAction: 'practicing' }; + }), + + stopPracticing: () => set((s) => { + // Only restore to meditate if we're currently practicing (don't clobber other actions) + if (s.currentAction !== 'practicing') return s; + return { currentAction: 'meditate' }; + }), + // Golemancy toggleGolem: (golemId: string) => { set((s) => { diff --git a/src/lib/game/stores/discipline-slice.ts b/src/lib/game/stores/discipline-slice.ts index 04a4261..67848d0 100644 --- a/src/lib/game/stores/discipline-slice.ts +++ b/src/lib/game/stores/discipline-slice.ts @@ -21,6 +21,7 @@ import { enchanterSpecialDisciplines } from '../data/disciplines/enchanter-speci import { fabricatorDisciplines } from '../data/disciplines/fabricator'; import { invokerDisciplines } from '../data/disciplines/invoker'; import { MAX_CONCURRENT_DISCIPLINES } from '../types/disciplines'; +import { useCombatStore } from './combatStore'; const ALL_DISCIPLINES = [ ...baseDisciplines, @@ -92,6 +93,8 @@ export const useDisciplineStore = create()( if (!prereqCheck.canProceed) return s; const discState = existing || { id, xp: 0, paused: false }; + // Set currentAction to 'practicing' (only overrides 'meditate') + useCombatStore.getState().startPracticing(); return { disciplines: { ...s.disciplines, [id]: { ...discState, paused: false } }, activeIds: [...s.activeIds, id], @@ -100,12 +103,19 @@ export const useDisciplineStore = create()( }, deactivate(id) { - set((s) => ({ - activeIds: s.activeIds.filter((aid) => aid !== id), - disciplines: s.disciplines[id] - ? { ...s.disciplines, [id]: { ...s.disciplines[id], paused: true } } - : s.disciplines, - })); + set((s) => { + const newActiveIds = s.activeIds.filter((aid) => aid !== id); + // If no more active disciplines, restore currentAction to 'meditate' + if (newActiveIds.length === 0) { + useCombatStore.getState().stopPracticing(); + } + return { + activeIds: newActiveIds, + disciplines: s.disciplines[id] + ? { ...s.disciplines, [id]: { ...s.disciplines[id], paused: true } } + : s.disciplines, + }; + }); }, processTick(mana) { diff --git a/src/lib/game/types/game.ts b/src/lib/game/types/game.ts index 2e3aeb8..d1a4aa7 100644 --- a/src/lib/game/types/game.ts +++ b/src/lib/game/types/game.ts @@ -95,7 +95,7 @@ export interface AchievementState { // ─── Game Actions and Scheduling ───────────────────────────────────────── -export type GameAction = 'meditate' | 'climb' | 'study' | 'craft' | 'repair' | 'convert' | 'design' | 'prepare' | 'enchant'; +export type GameAction = 'meditate' | 'practicing' | 'climb' | 'study' | 'craft' | 'repair' | 'convert' | 'design' | 'prepare' | 'enchant'; export interface ScheduleBlock { id: string;