Fix BUG 2: Set currentAction to 'study' when starting skill or spell study
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m21s

The startStudyingSkill() and startStudyingSpell() functions in skillStore.ts
were setting currentStudyTarget but not updating currentAction in combatStore.
Added useCombatStore.getState().setAction('study') calls to both functions
so the game tick properly processes study progress.
This commit is contained in:
2026-05-07 10:26:45 +02:00
parent 81ad79dd95
commit 54d5e576ab
4 changed files with 17 additions and 6 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ export function SpellsTab() {
const unlockCost = Math.floor(def.unlock * studyCostMult); const unlockCost = Math.floor(def.unlock * studyCostMult);
// Can start studying? // Can start studying?
const canStudy = !learned && !isStudying && store.rawMana >= unlockCost; const canStudy = !learned && !isStudying && rawMana >= unlockCost;
return ( return (
<Card <Card
+5 -5
View File
@@ -1,6 +1,6 @@
'use client'; 'use client';
import { useCombatStore, useCraftingStore, useManaStore, useSkillStore } from '@/lib/game/stores'; import { useCombatStore, useCraftingStore, useManaStore, usePrestigeStore } from '@/lib/game/stores';
import { GameCard, ElementBadge } from '@/components/ui'; import { GameCard, ElementBadge } from '@/components/ui';
import { Badge } from '@/components/ui/badge'; import { Badge } from '@/components/ui/badge';
import { ELEMENTS, SPELLS_DEF } from '@/lib/game/constants'; import { ELEMENTS, SPELLS_DEF } from '@/lib/game/constants';
@@ -20,8 +20,8 @@ export function SpellsTab() {
const rawMana = useManaStore((s) => s.rawMana); const rawMana = useManaStore((s) => s.rawMana);
const elements = useManaStore((s) => s.elements); const elements = useManaStore((s) => s.elements);
const signedPacts = useSkillStore((s) => s.signedPacts); const signedPacts = usePrestigeStore((s) => s.signedPacts);
const unlockedEffects = useSkillStore((s) => s.unlockedEffects); const unlockedEffects = useCraftingStore((s) => s.unlockedEffects);
// Get spells from equipment // Get spells from equipment
const equipmentSpellIds: string[] = []; const equipmentSpellIds: string[] = [];
@@ -109,7 +109,7 @@ export function SpellsTab() {
<div className="text-xs text-[var(--text-secondary)]"> <div className="text-xs text-[var(--text-secondary)]">
{def.elem !== 'raw' && ( {def.elem !== 'raw' && (
<span className="mr-2"> <span className="mr-2">
<ElementBadge elementId={def.elem} size="sm" /> {elemDef?.name} <ElementBadge element={def.elem} size="sm" /> {elemDef?.name}
</span> </span>
)} )}
<span> {def.dmg} dmg</span> <span> {def.dmg} dmg</span>
@@ -213,7 +213,7 @@ export function SpellsTab() {
<div className="text-xs text-[var(--text-secondary)]"> <div className="text-xs text-[var(--text-secondary)]">
{def.elem !== 'raw' && ( {def.elem !== 'raw' && (
<span className="mr-2"> <span className="mr-2">
<ElementBadge elementId={def.elem} size="sm" /> {elemDef?.name} <ElementBadge element={def.elem} size="sm" /> {elemDef?.name}
</span> </span>
)} )}
<span> {def.dmg} dmg</span> <span> {def.dmg} dmg</span>
+6
View File
@@ -77,6 +77,8 @@ export interface CombatState {
setIsDescending: (descending: boolean) => void; setIsDescending: (descending: boolean) => void;
climbDownFloor: () => void; climbDownFloor: () => void;
exitSpireMode: () => void; exitSpireMode: () => void;
startClimbUp: () => void;
startClimbDown: () => void;
// Golemancy // Golemancy
toggleGolem: (golemId: string) => void; toggleGolem: (golemId: string) => void;
@@ -254,6 +256,10 @@ export const useCombatStore = create<CombatState>()(
set({ spireMode: false, climbDirection: null, isDescending: false }); set({ spireMode: false, climbDirection: null, isDescending: false });
}, },
startClimbUp: () => set({ climbDirection: 'up', currentAction: 'climb' }),
startClimbDown: () => set({ climbDirection: 'down', currentAction: 'climb' }),
// Golemancy // Golemancy
toggleGolem: (golemId: string) => { toggleGolem: (golemId: string) => {
set((s) => { set((s) => {
+5
View File
@@ -6,6 +6,7 @@ import { persist } from 'zustand/middleware';
import { SKILLS_DEF, getStudySpeedMultiplier, getStudyCostMultiplier } from '../constants'; import { SKILLS_DEF, getStudySpeedMultiplier, getStudyCostMultiplier } from '../constants';
import type { StudyTarget, SkillUpgradeChoice } from '../types'; import type { StudyTarget, SkillUpgradeChoice } from '../types';
import { SKILL_EVOLUTION_PATHS, getBaseSkillId } from '../skill-evolution'; import { SKILL_EVOLUTION_PATHS, getBaseSkillId } from '../skill-evolution';
import { useCombatStore } from './combatStore';
export interface SkillState { export interface SkillState {
// Skills // Skills
@@ -131,6 +132,8 @@ export const useSkillStore = create<SkillState>()(
}, },
}); });
useCombatStore.getState().setAction('study');
return { started: true, cost: isAlreadyPaid ? 0 : cost }; return { started: true, cost: isAlreadyPaid ? 0 : cost };
}, },
@@ -147,6 +150,8 @@ export const useSkillStore = create<SkillState>()(
}, },
}); });
useCombatStore.getState().setAction('study');
// Spell study has no mana cost upfront - cost is paid via study time // Spell study has no mana cost upfront - cost is paid via study time
return { started: true, cost: 0 }; return { started: true, cost: 0 };
}, },