fix: lootInventory, prestige, golemancy, attunementStore export, debug components
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
This commit is contained in:
@@ -11,16 +11,16 @@ import { CRAFTING_RECIPES, canCraftRecipe } from '@/lib/game/data/crafting-recip
|
|||||||
import { LOOT_DROPS, RARITY_COLORS } from '@/lib/game/data/loot-drops';
|
import { LOOT_DROPS, RARITY_COLORS } from '@/lib/game/data/loot-drops';
|
||||||
import type { EquipmentInstance, AppliedEnchantment, LootInventory, EquipmentCraftingProgress } from '@/lib/game/types';
|
import type { EquipmentInstance, AppliedEnchantment, LootInventory, EquipmentCraftingProgress } from '@/lib/game/types';
|
||||||
import { fmt } from '@/lib/game/stores';
|
import { fmt } from '@/lib/game/stores';
|
||||||
import { useGameStore } from '@/lib/game/stores';
|
import { useGameStore, useCraftingStore } from '@/lib/game/stores';
|
||||||
|
|
||||||
export function EquipmentCrafter() {
|
export function EquipmentCrafter() {
|
||||||
const lootInventory = useGameStore((s) => s.lootInventory);
|
const lootInventory = useCraftingStore((s) => s.lootInventory);
|
||||||
const equipmentCraftingProgress = useGameStore((s) => s.equipmentCraftingProgress);
|
const equipmentCraftingProgress = useGameStore((s) => s.equipmentCraftingProgress);
|
||||||
const rawMana = useGameStore((s) => s.rawMana);
|
const rawMana = useGameStore((s) => s.rawMana);
|
||||||
const currentAction = useGameStore((s) => s.currentAction);
|
const currentAction = useGameStore((s) => s.currentAction);
|
||||||
const startCraftingEquipment = useGameStore((s) => s.startCraftingEquipment);
|
const startCraftingEquipment = useGameStore((s) => s.startCraftingEquipment);
|
||||||
const cancelEquipmentCrafting = useGameStore((s) => s.cancelEquipmentCrafting);
|
const cancelEquipmentCrafting = useGameStore((s) => s.cancelEquipmentCrafting);
|
||||||
const deleteMaterial = useGameStore((s) => s.deleteMaterial);
|
const deleteMaterial = useCraftingStore((s) => s.deleteMaterial);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
RotateCcw, AlertTriangle, Zap, Clock, Settings, Eye,
|
RotateCcw, AlertTriangle, Zap, Clock, Settings, Eye,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { useDebug } from '@/lib/game/debug-context';
|
import { useDebug } from '@/lib/game/debug-context';
|
||||||
import { useGameStore, useManaStore } from '@/lib/game/stores';
|
import { useGameStore, useManaStore, useUIStore, useCombatStore } from '@/lib/game/stores';
|
||||||
import { computeMaxMana } from '@/lib/game/stores';
|
import { computeMaxMana } from '@/lib/game/stores';
|
||||||
|
|
||||||
export function GameStateDebug() {
|
export function GameStateDebug() {
|
||||||
@@ -24,14 +24,14 @@ export function GameStateDebug() {
|
|||||||
const gatherMana = useGameStore((s) => s.gatherMana);
|
const gatherMana = useGameStore((s) => s.gatherMana);
|
||||||
const day = useGameStore((s) => s.day);
|
const day = useGameStore((s) => s.day);
|
||||||
const hour = useGameStore((s) => s.hour);
|
const hour = useGameStore((s) => s.hour);
|
||||||
const paused = useGameStore((s) => s.paused);
|
const paused = useUIStore((s) => s.paused);
|
||||||
const togglePause = useGameStore((s) => s.togglePause);
|
const togglePause = useUIStore((s) => s.togglePause);
|
||||||
|
|
||||||
// Get actions from stores
|
// Get actions from stores
|
||||||
const resetGame = useGameStore((s) => s.resetGame);
|
const resetGame = useGameStore((s) => s.resetGame);
|
||||||
const setTime = useGameStore((s) => s.debugSetTime);
|
const setTime = useCombatStore((s) => s.debugSetTime);
|
||||||
const setFloor = useGameStore((s) => s.debugSetFloor);
|
const setFloor = useCombatStore((s) => s.debugSetFloor);
|
||||||
const resetHP = useGameStore((s) => s.resetFloorHP);
|
const resetHP = useCombatStore((s) => s.resetFloorHP);
|
||||||
|
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
if (confirmReset) {
|
if (confirmReset) {
|
||||||
|
|||||||
@@ -3,25 +3,29 @@
|
|||||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Bug } from 'lucide-react';
|
import { Bug } from 'lucide-react';
|
||||||
import { useGameStore } from '@/lib/game/stores';
|
import { usePrestigeStore, useManaStore, useUIStore } from '@/lib/game/stores';
|
||||||
import { GUARDIANS, ELEMENTS } from '@/lib/game/constants';
|
import { GUARDIANS, ELEMENTS } from '@/lib/game/constants';
|
||||||
|
|
||||||
export function PactDebug() {
|
export function PactDebug() {
|
||||||
// Get state from the main game store where pacts are stored
|
// Get state from modular stores
|
||||||
const store = useGameStore();
|
const signedPacts = usePrestigeStore((s) => s.signedPacts);
|
||||||
const signedPacts = useGameStore((s) => s.signedPacts);
|
const signedPactDetails = usePrestigeStore((s) => s.signedPactDetails);
|
||||||
const signedPactDetails = useGameStore((s) => s.signedPactDetails);
|
const elements = useManaStore((s) => s.elements);
|
||||||
const elements = useGameStore((s) => s.elements);
|
const prestigeUpgrades = usePrestigeStore((s) => s.prestigeUpgrades);
|
||||||
const prestigeUpgrades = useGameStore((s) => s.prestigeUpgrades);
|
|
||||||
|
// Get actions
|
||||||
|
const addSignedPact = usePrestigeStore((s) => s.addSignedPact);
|
||||||
|
const removePact = usePrestigeStore((s) => s.removePact);
|
||||||
|
const debugSetSignedPacts = usePrestigeStore((s) => s.debugSetSignedPacts);
|
||||||
|
const debugSetPactDetails = usePrestigeStore((s) => s.debugSetPactDetails);
|
||||||
|
const unlockElement = useManaStore((s) => s.unlockElement);
|
||||||
|
|
||||||
|
// Get log function from uiStore
|
||||||
|
const addLog = useUIStore((s) => s.addLog);
|
||||||
|
|
||||||
// Get all guardian floors
|
// Get all guardian floors
|
||||||
const guardianFloors = Object.keys(GUARDIANS).map(Number).sort((a, b) => a - b);
|
const guardianFloors = Object.keys(GUARDIANS).map(Number).sort((a, b) => a - b);
|
||||||
|
|
||||||
// Helper to add log messages
|
|
||||||
const addLog = (message: string) => {
|
|
||||||
store.log.unshift(message);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Force sign a pact with a guardian (bypass costs and time)
|
// Force sign a pact with a guardian (bypass costs and time)
|
||||||
const forcePact = (floor: number) => {
|
const forcePact = (floor: number) => {
|
||||||
const guardian = GUARDIANS[floor];
|
const guardian = GUARDIANS[floor];
|
||||||
@@ -41,7 +45,7 @@ export function PactDebug() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Force sign the pact
|
// Force sign the pact
|
||||||
const newSignedPacts = [...signedPacts, floor];
|
addSignedPact(floor);
|
||||||
|
|
||||||
// Add pact details
|
// Add pact details
|
||||||
const newSignedPactDetails = {
|
const newSignedPactDetails = {
|
||||||
@@ -49,74 +53,59 @@ export function PactDebug() {
|
|||||||
[floor]: {
|
[floor]: {
|
||||||
floor,
|
floor,
|
||||||
guardianId: guardian.element,
|
guardianId: guardian.element,
|
||||||
signedAt: { day: store.day, hour: store.hour },
|
signedAt: { day: useGameStore.getState().day, hour: useGameStore.getState().hour },
|
||||||
skillLevels: {} as Record<string, number>,
|
skillLevels: {} as Record<string, number>,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
debugSetPactDetails(newSignedPactDetails);
|
||||||
|
|
||||||
// Unlock mana types
|
// Unlock mana types
|
||||||
let newElements = { ...elements };
|
|
||||||
for (const elemId of guardian.unlocksMana) {
|
for (const elemId of guardian.unlocksMana) {
|
||||||
if (newElements[elemId]) {
|
if (!elements[elemId]?.unlocked) {
|
||||||
newElements = {
|
unlockElement(elemId, 500);
|
||||||
...newElements,
|
|
||||||
[elemId]: { ...newElements[elemId], unlocked: true },
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for compound element unlocks
|
// Check for compound element unlocks
|
||||||
|
const currentElements = useManaStore.getState().elements;
|
||||||
const unlockedSet = new Set(
|
const unlockedSet = new Set(
|
||||||
Object.entries(newElements)
|
Object.entries(currentElements)
|
||||||
.filter(([, e]) => e.unlocked)
|
.filter(([, e]) => e.unlocked)
|
||||||
.map(([id]) => id)
|
.map(([id]) => id)
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const [elemId, elemDef] of Object.entries(ELEMENTS)) {
|
for (const [elemId, elemDef] of Object.entries(ELEMENTS)) {
|
||||||
if (elemDef.recipe && !newElements[elemId]?.unlocked) {
|
if (elemDef.recipe && !currentElements[elemId]?.unlocked) {
|
||||||
const canUnlock = elemDef.recipe.every((comp: string) => unlockedSet.has(comp));
|
const canUnlock = elemDef.recipe.every((comp: string) => unlockedSet.has(comp));
|
||||||
if (canUnlock) {
|
if (canUnlock) {
|
||||||
newElements = {
|
unlockElement(elemId, 500);
|
||||||
...newElements,
|
|
||||||
[elemId]: { ...newElements[elemId], unlocked: true },
|
|
||||||
};
|
|
||||||
addLog(`🔮 ${elemDef.name} mana unlocked through component synergy!`);
|
addLog(`🔮 ${elemDef.name} mana unlocked through component synergy!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addLog(`📜 DEBUG: Pact with ${guardian.name} force-signed! ${guardian.unlocksMana.map(e => ELEMENTS[e]?.name || e).join(', ')} mana unlocked!`);
|
addLog(`📜 DEBUG: Pact with ${guardian.name} force-signed! ${guardian.unlocksMana.map(e => ELEMENTS[e]?.name || e).join(', ')} mana unlocked!`);
|
||||||
|
|
||||||
// Update store
|
|
||||||
store.setState({
|
|
||||||
signedPacts: newSignedPacts,
|
|
||||||
signedPactDetails: newSignedPactDetails,
|
|
||||||
elements: newElements,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Remove a pact
|
// Remove a pact
|
||||||
const removePact = (floor: number) => {
|
const removePactHandler = (floor: number) => {
|
||||||
const guardian = GUARDIANS[floor];
|
const guardian = GUARDIANS[floor];
|
||||||
const newSignedPacts = signedPacts.filter(f => f !== floor);
|
|
||||||
|
removePact(floor);
|
||||||
|
|
||||||
|
// Remove pact details
|
||||||
const newSignedPactDetails = { ...signedPactDetails };
|
const newSignedPactDetails = { ...signedPactDetails };
|
||||||
delete newSignedPactDetails[floor];
|
delete newSignedPactDetails[floor];
|
||||||
|
debugSetPactDetails(newSignedPactDetails);
|
||||||
|
|
||||||
addLog(`📜 DEBUG: Removed pact with ${guardian?.name || 'Unknown'}!`);
|
addLog(`📜 DEBUG: Removed pact with ${guardian?.name || 'Unknown'}!`);
|
||||||
|
|
||||||
store.setState({
|
|
||||||
signedPacts: newSignedPacts,
|
|
||||||
signedPactDetails: newSignedPactDetails,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Clear all pacts
|
// Clear all pacts
|
||||||
const clearAllPacts = () => {
|
const clearAllPacts = () => {
|
||||||
addLog(`📜 DEBUG: Cleared all pacts!`);
|
addLog(`📜 DEBUG: Cleared all pacts!`);
|
||||||
store.setState({
|
debugSetSignedPacts([]);
|
||||||
signedPacts: [],
|
debugSetPactDetails({});
|
||||||
signedPactDetails: {},
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -162,7 +151,7 @@ export function PactDebug() {
|
|||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
onClick={() => removePact(floor)}
|
onClick={() => removePactHandler(floor)}
|
||||||
className="text-xs"
|
className="text-xs"
|
||||||
>
|
>
|
||||||
Remove
|
Remove
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import {
|
|||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { GOLEMS_DEF, getGolemSlots, isGolemUnlocked, getGolemDamage, getGolemAttackSpeed, getGolemFloorDuration } from '@/lib/game/data/golems';
|
import { GOLEMS_DEF, getGolemSlots, isGolemUnlocked, getGolemDamage, getGolemAttackSpeed, getGolemFloorDuration } from '@/lib/game/data/golems';
|
||||||
import { ELEMENTS } from '@/lib/game/constants';
|
import { ELEMENTS } from '@/lib/game/constants';
|
||||||
import { useGameStore, useManaStore, useSkillStore, useCombatStore } from '@/lib/game/stores';
|
import { useGameStore, useManaStore, useSkillStore, useCombatStore, useAttunementStore } from '@/lib/game/stores';
|
||||||
|
|
||||||
export function GolemancyTab() {
|
export function GolemancyTab() {
|
||||||
const attunements = useGameStore((s) => s.attunements);
|
const attunements = useAttunementStore((s) => s.attunements);
|
||||||
const elements = useManaStore((s) => s.elements);
|
const elements = useManaStore((s) => s.elements);
|
||||||
const skills = useSkillStore((s) => s.skills);
|
const skills = useSkillStore((s) => s.skills);
|
||||||
const golemancy = useGameStore((s) => s.golemancy);
|
const golemancy = useGameStore((s) => s.golemancy);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useGameStore, useCraftingStore } from '@/lib/game/stores';
|
import { useCraftingStore, useManaStore } from '@/lib/game/stores';
|
||||||
import { LootInventoryDisplay } from '@/components/game/LootInventory';
|
import { LootInventoryDisplay } from '@/components/game/LootInventory';
|
||||||
|
|
||||||
export function LootTab() {
|
export function LootTab() {
|
||||||
const lootInventory = useGameStore((s) => s.lootInventory);
|
const lootInventory = useCraftingStore((s) => s.lootInventory);
|
||||||
const elements = useGameStore((s) => s.elements);
|
const elements = useManaStore((s) => s.elements);
|
||||||
const equipmentInstances = useCraftingStore((s) => s.equipmentInstances);
|
const equipmentInstances = useCraftingStore((s) => s.equipmentInstances);
|
||||||
const deleteMaterial = useGameStore((s) => s.deleteMaterial);
|
const deleteMaterial = useCraftingStore((s) => s.deleteMaterial);
|
||||||
const deleteEquipmentInstance = useGameStore((s) => s.deleteEquipmentInstance);
|
const deleteEquipmentInstance = useCraftingStore((s) => s.deleteEquipmentInstance);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useGameStore, usePrestigeStore, useSkillStore, useManaStore } from '@/lib/game/stores';
|
import { usePrestigeStore, useSkillStore, useManaStore, useCraftingStore } from '@/lib/game/stores';
|
||||||
import { useGameLoop } from '@/lib/game/stores/gameHooks';
|
import { useGameLoop } from '@/lib/game/stores/gameHooks';
|
||||||
import { getUnifiedEffects } from '@/lib/game/effects';
|
import { getUnifiedEffects } from '@/lib/game/effects';
|
||||||
import {
|
import {
|
||||||
@@ -21,19 +21,28 @@ import { fmt } from '@/lib/game/stores';
|
|||||||
export function PrestigeTab() {
|
export function PrestigeTab() {
|
||||||
const [selectedManaType, setSelectedManaType] = useState<string>('');
|
const [selectedManaType, setSelectedManaType] = useState<string>('');
|
||||||
|
|
||||||
const store = useGameStore();
|
|
||||||
useGameLoop();
|
useGameLoop();
|
||||||
|
|
||||||
const skills = useSkillStore((s) => s.skills);
|
const skills = useSkillStore((s) => s.skills);
|
||||||
const prestigeUpgrades = usePrestigeStore((s) => s.prestigeUpgrades);
|
const prestigeUpgrades = usePrestigeStore((s) => s.prestigeUpgrades);
|
||||||
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 skillUpgrades = useSkillStore((s) => s.skillUpgrades);
|
||||||
|
const skillTiers = useSkillStore((s) => s.skillTiers);
|
||||||
|
const equipmentInstances = useCraftingStore((s) => s.equipmentInstances);
|
||||||
|
const equippedInstances = useCraftingStore((s) => s.equippedInstances);
|
||||||
|
const doPrestige = usePrestigeStore((s) => s.doPrestige);
|
||||||
|
|
||||||
const upgradeEffects = getUnifiedEffects(store);
|
const upgradeEffects = getUnifiedEffects({
|
||||||
|
skillUpgrades,
|
||||||
|
skillTiers,
|
||||||
|
equipmentInstances,
|
||||||
|
equippedInstances,
|
||||||
|
});
|
||||||
|
|
||||||
// Get unlocked elements for mana type selector
|
// Get unlocked elements for mana type selector
|
||||||
const unlockedElements = Object.entries(ELEMENTS)
|
const unlockedElements = Object.entries(ELEMENTS)
|
||||||
.filter(([id]) => store.elements[id]?.unlocked)
|
.filter(([id]) => elements[id]?.unlocked)
|
||||||
.map(([id, elem]) => ({
|
.map(([id, elem]) => ({
|
||||||
id,
|
id,
|
||||||
name: elem.name,
|
name: elem.name,
|
||||||
@@ -66,7 +75,7 @@ export function PrestigeTab() {
|
|||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
disabled={!canAfford || level >= def.maxLevel}
|
disabled={!canAfford || level >= def.maxLevel}
|
||||||
onClick={() => store.doPrestige(id)}
|
onClick={() => doPrestige(id)}
|
||||||
>
|
>
|
||||||
{level >= def.maxLevel ? 'Maxed' : `Upgrade (${fmt(def.cost)})`}
|
{level >= def.maxLevel ? 'Maxed' : `Upgrade (${fmt(def.cost)})`}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
} from '@/lib/game/skill-evolution';
|
} from '@/lib/game/skill-evolution';
|
||||||
import { getUnifiedEffects } from '@/lib/game/effects';
|
import { getUnifiedEffects } from '@/lib/game/effects';
|
||||||
import { getAvailableSkillCategories } from '@/lib/game/data/attunements';
|
import { getAvailableSkillCategories } from '@/lib/game/data/attunements';
|
||||||
import { fmt, fmtDec } from '@/lib/game/stores';
|
import { fmt, fmtDec, useAttunementStore } from '@/lib/game/stores';
|
||||||
import type { SkillUpgradeChoice } from '@/lib/game/types';
|
import type { SkillUpgradeChoice } from '@/lib/game/types';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
@@ -166,7 +166,7 @@ export function SkillsTab() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Get available skill categories based on attunements
|
// Get available skill categories based on attunements
|
||||||
const attunements = useGameStore((s) => s.attunements);
|
const attunements = useAttunementStore((s) => s.attunements);
|
||||||
const availableCategories = getAvailableSkillCategories(attunements || {});
|
const availableCategories = getAvailableSkillCategories(attunements || {});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { SPELLS_DEF, GUARDIANS, HOURS_PER_TICK } from '../constants';
|
|||||||
import type { GameAction, SpellState } from '../types';
|
import type { GameAction, SpellState } from '../types';
|
||||||
import { getFloorMaxHP, getFloorElement, calcDamage, canAffordSpellCost, deductSpellCost } from '../utils';
|
import { getFloorMaxHP, getFloorElement, calcDamage, canAffordSpellCost, deductSpellCost } from '../utils';
|
||||||
import { usePrestigeStore } from './prestigeStore';
|
import { usePrestigeStore } from './prestigeStore';
|
||||||
|
import { useGameStore } from './gameStore';
|
||||||
|
|
||||||
export interface CombatState {
|
export interface CombatState {
|
||||||
// Floor state
|
// Floor state
|
||||||
@@ -56,6 +57,11 @@ export interface CombatState {
|
|||||||
|
|
||||||
// Reset
|
// Reset
|
||||||
resetCombat: (startFloor: number, spellsToKeep?: string[]) => void;
|
resetCombat: (startFloor: number, spellsToKeep?: string[]) => void;
|
||||||
|
|
||||||
|
// Debug helpers
|
||||||
|
debugSetFloor: (floor: number) => void;
|
||||||
|
resetFloorHP: () => void;
|
||||||
|
debugSetTime: (day: number, hour: number) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useCombatStore = create<CombatState>()(
|
export const useCombatStore = create<CombatState>()(
|
||||||
@@ -244,6 +250,25 @@ export const useCombatStore = create<CombatState>()(
|
|||||||
spells: startSpells,
|
spells: startSpells,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Debug helpers
|
||||||
|
debugSetFloor: (floor: number) => {
|
||||||
|
set({
|
||||||
|
currentFloor: floor,
|
||||||
|
floorHP: getFloorMaxHP(floor),
|
||||||
|
floorMaxHP: getFloorMaxHP(floor),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
resetFloorHP: () => {
|
||||||
|
set((state) => ({
|
||||||
|
floorHP: state.floorMaxHP,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
debugSetTime: (day: number, hour: number) => {
|
||||||
|
useGameStore.setState({ day, hour });
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'mana-loop-combat',
|
name: 'mana-loop-combat',
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ export interface CraftingState {
|
|||||||
equipmentInstances: Record<string, EquipmentInstance>;
|
equipmentInstances: Record<string, EquipmentInstance>;
|
||||||
// Equipped instances (slot -> instanceId or null)
|
// Equipped instances (slot -> instanceId or null)
|
||||||
equippedInstances: Record<string, string | null>;
|
equippedInstances: Record<string, string | null>;
|
||||||
|
// Loot inventory
|
||||||
|
lootInventory: {
|
||||||
|
materials: Record<string, number>;
|
||||||
|
blueprints: string[];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CraftingActions {
|
export interface CraftingActions {
|
||||||
@@ -68,6 +73,10 @@ export interface CraftingActions {
|
|||||||
// Enchantment preparation actions
|
// Enchantment preparation actions
|
||||||
startPreparing: (equipmentInstanceId: string) => boolean;
|
startPreparing: (equipmentInstanceId: string) => boolean;
|
||||||
cancelPreparation: () => void;
|
cancelPreparation: () => void;
|
||||||
|
|
||||||
|
// Loot inventory actions
|
||||||
|
deleteMaterial: (materialId: string, amount: number) => void;
|
||||||
|
deleteEquipmentInstance: (instanceId: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CraftingStore = CraftingState & CraftingActions;
|
export type CraftingStore = CraftingState & CraftingActions;
|
||||||
@@ -85,6 +94,10 @@ export const useCraftingStore = create<CraftingStore>()(
|
|||||||
unlockedEffects: [],
|
unlockedEffects: [],
|
||||||
equipmentInstances: {},
|
equipmentInstances: {},
|
||||||
equippedInstances: {},
|
equippedInstances: {},
|
||||||
|
lootInventory: {
|
||||||
|
materials: {},
|
||||||
|
blueprints: [],
|
||||||
|
},
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
setDesignProgress: (progress) => set({ designProgress: progress }),
|
setDesignProgress: (progress) => set({ designProgress: progress }),
|
||||||
@@ -221,6 +234,47 @@ export const useCraftingStore = create<CraftingStore>()(
|
|||||||
PreparationActions.cancelPreparation(set);
|
PreparationActions.cancelPreparation(set);
|
||||||
useGameStore.setState({ currentAction: 'meditate' });
|
useGameStore.setState({ currentAction: 'meditate' });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Loot inventory actions
|
||||||
|
deleteMaterial: (materialId: string, amount: number) => {
|
||||||
|
set((state) => {
|
||||||
|
const newMaterials = { ...state.lootInventory.materials };
|
||||||
|
const currentAmount = newMaterials[materialId] || 0;
|
||||||
|
const newAmount = Math.max(0, currentAmount - amount);
|
||||||
|
|
||||||
|
if (newAmount <= 0) {
|
||||||
|
delete newMaterials[materialId];
|
||||||
|
} else {
|
||||||
|
newMaterials[materialId] = newAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
lootInventory: {
|
||||||
|
...state.lootInventory,
|
||||||
|
materials: newMaterials,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteEquipmentInstance: (instanceId: string) => {
|
||||||
|
set((state) => {
|
||||||
|
let newEquipped = { ...state.equippedInstances };
|
||||||
|
for (const [slot, id] of Object.entries(newEquipped)) {
|
||||||
|
if (id === instanceId) {
|
||||||
|
newEquipped[slot as any] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const newInstances = { ...state.equipmentInstances };
|
||||||
|
delete newInstances[instanceId];
|
||||||
|
|
||||||
|
return {
|
||||||
|
equippedInstances: newEquipped,
|
||||||
|
equipmentInstances: newInstances,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'mana-loop-crafting',
|
name: 'mana-loop-crafting',
|
||||||
@@ -234,6 +288,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
|||||||
unlockedEffects: state.unlockedEffects,
|
unlockedEffects: state.unlockedEffects,
|
||||||
equipmentInstances: state.equipmentInstances,
|
equipmentInstances: state.equipmentInstances,
|
||||||
equippedInstances: state.equippedInstances,
|
equippedInstances: state.equippedInstances,
|
||||||
|
lootInventory: state.lootInventory,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ export interface PrestigeState {
|
|||||||
// Guardian pacts
|
// Guardian pacts
|
||||||
defeatedGuardians: number[];
|
defeatedGuardians: number[];
|
||||||
signedPacts: number[];
|
signedPacts: number[];
|
||||||
|
signedPactDetails: Record<number, {
|
||||||
|
floor: number;
|
||||||
|
guardianId: string;
|
||||||
|
signedAt: { day: number; hour: number };
|
||||||
|
skillLevels: Record<string, number>;
|
||||||
|
}>;
|
||||||
pactRitualFloor: number | null;
|
pactRitualFloor: number | null;
|
||||||
pactRitualProgress: number;
|
pactRitualProgress: number;
|
||||||
|
|
||||||
@@ -73,6 +79,12 @@ const initialState = {
|
|||||||
memories: [] as Memory[],
|
memories: [] as Memory[],
|
||||||
defeatedGuardians: [] as number[],
|
defeatedGuardians: [] as number[],
|
||||||
signedPacts: [] as number[],
|
signedPacts: [] as number[],
|
||||||
|
signedPactDetails: {} as Record<number, {
|
||||||
|
floor: number;
|
||||||
|
guardianId: string;
|
||||||
|
signedAt: { day: number; hour: number };
|
||||||
|
skillLevels: Record<string, number>;
|
||||||
|
}>,
|
||||||
pactRitualFloor: null as number | null,
|
pactRitualFloor: null as number | null,
|
||||||
pactRitualProgress: 0,
|
pactRitualProgress: 0,
|
||||||
};
|
};
|
||||||
@@ -249,6 +261,19 @@ export const usePrestigeStore = create<PrestigeState>()(
|
|||||||
resetPrestige: () => {
|
resetPrestige: () => {
|
||||||
set(initialState);
|
set(initialState);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Debug helpers
|
||||||
|
debugSetSignedPacts: (pacts: number[]) => {
|
||||||
|
set({ signedPacts: pacts });
|
||||||
|
},
|
||||||
|
debugSetPactDetails: (details: Record<number, {
|
||||||
|
floor: number;
|
||||||
|
guardianId: string;
|
||||||
|
signedAt: { day: number; hour: number };
|
||||||
|
skillLevels: Record<string, number>;
|
||||||
|
}>) => {
|
||||||
|
set({ signedPactDetails: details });
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'mana-loop-prestige',
|
name: 'mana-loop-prestige',
|
||||||
|
|||||||
Reference in New Issue
Block a user