feat: practicing disciplines set currentAction to block meditation/crafting
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m20s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m20s
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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."
|
||||
},
|
||||
|
||||
@@ -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<string, { label: string; icon: typeof Sparkles; color: string }> = {
|
||||
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' },
|
||||
|
||||
@@ -76,6 +76,8 @@ export interface CombatActions {
|
||||
exitSpireMode: () => void;
|
||||
startClimbUp: () => void;
|
||||
startClimbDown: () => void;
|
||||
startPracticing: () => void;
|
||||
stopPracticing: () => void;
|
||||
|
||||
// Golemancy
|
||||
toggleGolem: (golemId: string) => void;
|
||||
|
||||
@@ -163,6 +163,18 @@ export const useCombatStore = create<CombatStore>()(
|
||||
|
||||
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) => {
|
||||
|
||||
@@ -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<DisciplineStore>()(
|
||||
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<DisciplineStore>()(
|
||||
},
|
||||
|
||||
deactivate(id) {
|
||||
set((s) => ({
|
||||
activeIds: s.activeIds.filter((aid) => aid !== id),
|
||||
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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user