Fix skill study mana deduction in skillStore.ts
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m38s

- Added useManaStore import to skillStore.ts
- Added mana deduction logic in startStudyingSkill action
- Mana is now properly deducted when starting to study a skill (unless already paid)
This commit is contained in:
2026-05-08 11:01:01 +02:00
parent 58aa74486e
commit 0fadbfef4a
8 changed files with 22 additions and 187 deletions
+13 -4
View File
@@ -9,7 +9,7 @@ import { CalendarDisplay } from '@/components/game';
import { DebugName } from '@/lib/game/debug-context';
import { useGameStore, useManaStore, useSkillStore, useCombatStore, useCraftingStore } from '@/lib/game/stores';
import { getUnifiedEffects } from '@/lib/game/effects';
import { computeMaxMana, computeClickMana, getMeditationBonus } from '@/lib/game/stores';
import { computeMaxMana, computeRegen, computeClickMana, getMeditationBonus, getIncursionStrength } from '@/lib/game/stores';
export function LeftPanel() {
const [isGathering, setIsGathering] = useState(false);
@@ -23,6 +23,9 @@ export function LeftPanel() {
const skillTiers = useSkillStore((s) => s.skillTiers);
const skillUpgrades = useSkillStore((s) => s.skillUpgrades);
const equippedInstances = useCraftingStore((s) => s.equippedInstances);
const equipmentInstances = useCraftingStore((s) => s.equipmentInstances);
const gatherMana = useGameStore((s) => s.gatherMana);
const day = useGameStore((s) => s.day);
const hour = useGameStore((s) => s.hour);
@@ -70,20 +73,26 @@ export function LeftPanel() {
const upgradeEffects = getUnifiedEffects({
skillUpgrades,
skillTiers,
equippedInstances: {},
equipmentInstances: {}
equippedInstances,
equipmentInstances,
});
const maxMana = computeMaxMana(
{ skills, skillTiers, skillUpgrades },
upgradeEffects
);
const baseRegen = computeRegen(
{ skills, skillTiers, skillUpgrades },
upgradeEffects
);
const clickMana = computeClickMana({
skills,
skillTiers,
skillUpgrades,
});
const meditationMultiplier = getMeditationBonus(meditateTicks, skills, upgradeEffects.meditationEfficiency);
const incursionStrength = getIncursionStrength(day, hour);
const effectiveRegen = baseRegen * (1 - incursionStrength) * meditationMultiplier;
return (
<div className="md:w-80 space-y-4 flex-shrink-0">
@@ -91,7 +100,7 @@ export function LeftPanel() {
<ManaDisplay
rawMana={rawMana}
maxMana={maxMana}
effectiveRegen={0} // Now calculated in page.tsx and passed
effectiveRegen={effectiveRegen}
meditationMultiplier={meditationMultiplier}
clickMana={clickMana}
isGathering={isGathering}