fix: SpireTab store props, mana regen display, skill cost deduction, grimoire cost format, unequip store, add test suite
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m34s

This commit is contained in:
2026-05-08 11:45:31 +02:00
parent 0fadbfef4a
commit 71fbc7c964
12 changed files with 354 additions and 22 deletions
+13 -7
View File
@@ -7,10 +7,12 @@ import { Zap, Shield, ShieldCheck, Wind, Heart, Mountain, BookOpen } from 'lucid
import { ELEMENTS } from '@/lib/game/constants';
import { GOLEMS_DEF, getGolemDamage, getGolemAttackSpeed } from '@/lib/game/data/golems';
import type { CombatStatsPanelProps } from '@/lib/game/types';
import { useCombatStore } from '@/lib/game/stores';
import { useSkillStore } from '@/lib/game/stores';
import { usePrestigeStore } from '@/lib/game/stores';
export function CombatStatsPanel({
activeEquipmentSpells,
store,
totalDPS,
calcDamage,
formatSpellCost,
@@ -21,7 +23,11 @@ export function CombatStatsPanel({
studySpeedMult,
storeCurrentAction,
}: CombatStatsPanelProps) {
const activeGolems = store.golemancy.summonedGolems;
const golemancy = useCombatStore((s) => s.golemancy);
const equipmentSpellStates = useCombatStore((s) => s.equipmentSpellStates);
const skills = useSkillStore((s) => s.skills);
const signedPacts = usePrestigeStore((s) => s.signedPacts);
const activeGolems = golemancy.summonedGolems;
return (
<Card className="bg-gray-900/80 border-gray-700">
@@ -39,7 +45,7 @@ export function CombatStatsPanel({
{activeEquipmentSpells.map(({ spellId, equipmentId }) => {
const spellDef = SPELLS_DEF[spellId];
if (!spellDef) return null;
const spellState = store.equipmentSpellStates?.find(
const spellState = equipmentSpellStates?.find(
s => s.spellId === spellId && s.sourceEquipment === equipmentId
);
const progress = spellState?.castProgress || 0;
@@ -58,11 +64,11 @@ export function CombatStatsPanel({
</span>
</div>
<div className="text-xs text-gray-400 mb-1">
{fmt(calcDamage(store, spellId))} dmg {' '}
{fmt(calcDamage({ skills, signedPacts }, spellId))} dmg {' '}
<span style={{ color: getSpellCostColor(spellDef.cost) }}>
{formatSpellCost(spellDef.cost)}
</span>
{' '} {fmt(Math.floor(calcDamage(store, spellId) * (spellDef.castSpeed || 1)))} dmg/hr
{' '} {fmt(Math.floor(calcDamage({ skills, signedPacts }, spellId) * (spellDef.castSpeed || 1)))} dmg/hr
</div>
{storeCurrentAction === 'climb' && (
<div className="space-y-0.5">
@@ -97,8 +103,8 @@ export function CombatStatsPanel({
const golemDef = GOLEMS_DEF[summoned.golemId];
if (!golemDef) return null;
const elemColor = ELEMENTS[golemDef.baseManaType]?.color || '#888';
const damage = getGolemDamage(summoned.golemId, store.skills);
const attackSpeed = getGolemAttackSpeed(summoned.golemId, store.skills);
const damage = getGolemDamage(summoned.golemId, skills);
const attackSpeed = getGolemAttackSpeed(summoned.golemId, skills);
return (
<div key={summoned.golemId} className="p-2 bg-gray-800/50 rounded border border-gray-700">
+2 -2
View File
@@ -160,7 +160,7 @@ export function EquipmentTab() {
const handleUnequip = (slot: EquipmentSlot) => {
const instanceId = equippedInstances[slot];
const instance = instanceId ? equipmentInstances[instanceId] : null;
unequipItem(slot, useCombatStore.getState, (fn) => useCombatStore.setState(fn));
unequipItem(slot, (fn) => useCraftingStore.setState(fn as any));
showToast('success', 'Item Unequipped', `${instance?.name || 'Item'} removed from ${SLOT_NAMES[slot]}`);
};
@@ -224,7 +224,7 @@ export function EquipmentTab() {
const confirmDelete = () => {
if (deleteConfirm) {
deleteEquipmentInstance(deleteConfirm.instanceId, useCombatStore.getState, (fn) => useCombatStore.setState(fn));
deleteEquipmentInstance(deleteConfirm.instanceId, useCraftingStore.getState, (fn) => useCraftingStore.setState(fn));
showToast('success', 'Item Discarded', `${deleteConfirm.name} has been removed from inventory`);
setDeleteConfirm(null);
}