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:
@@ -3,25 +3,29 @@
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
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';
|
||||
|
||||
export function PactDebug() {
|
||||
// Get state from the main game store where pacts are stored
|
||||
const store = useGameStore();
|
||||
const signedPacts = useGameStore((s) => s.signedPacts);
|
||||
const signedPactDetails = useGameStore((s) => s.signedPactDetails);
|
||||
const elements = useGameStore((s) => s.elements);
|
||||
const prestigeUpgrades = useGameStore((s) => s.prestigeUpgrades);
|
||||
// Get state from modular stores
|
||||
const signedPacts = usePrestigeStore((s) => s.signedPacts);
|
||||
const signedPactDetails = usePrestigeStore((s) => s.signedPactDetails);
|
||||
const elements = useManaStore((s) => s.elements);
|
||||
const prestigeUpgrades = usePrestigeStore((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
|
||||
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)
|
||||
const forcePact = (floor: number) => {
|
||||
const guardian = GUARDIANS[floor];
|
||||
@@ -41,7 +45,7 @@ export function PactDebug() {
|
||||
}
|
||||
|
||||
// Force sign the pact
|
||||
const newSignedPacts = [...signedPacts, floor];
|
||||
addSignedPact(floor);
|
||||
|
||||
// Add pact details
|
||||
const newSignedPactDetails = {
|
||||
@@ -49,74 +53,59 @@ export function PactDebug() {
|
||||
[floor]: {
|
||||
floor,
|
||||
guardianId: guardian.element,
|
||||
signedAt: { day: store.day, hour: store.hour },
|
||||
signedAt: { day: useGameStore.getState().day, hour: useGameStore.getState().hour },
|
||||
skillLevels: {} as Record<string, number>,
|
||||
},
|
||||
};
|
||||
debugSetPactDetails(newSignedPactDetails);
|
||||
|
||||
// Unlock mana types
|
||||
let newElements = { ...elements };
|
||||
for (const elemId of guardian.unlocksMana) {
|
||||
if (newElements[elemId]) {
|
||||
newElements = {
|
||||
...newElements,
|
||||
[elemId]: { ...newElements[elemId], unlocked: true },
|
||||
};
|
||||
if (!elements[elemId]?.unlocked) {
|
||||
unlockElement(elemId, 500);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for compound element unlocks
|
||||
const currentElements = useManaStore.getState().elements;
|
||||
const unlockedSet = new Set(
|
||||
Object.entries(newElements)
|
||||
Object.entries(currentElements)
|
||||
.filter(([, e]) => e.unlocked)
|
||||
.map(([id]) => id)
|
||||
);
|
||||
|
||||
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));
|
||||
if (canUnlock) {
|
||||
newElements = {
|
||||
...newElements,
|
||||
[elemId]: { ...newElements[elemId], unlocked: true },
|
||||
};
|
||||
unlockElement(elemId, 500);
|
||||
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!`);
|
||||
|
||||
// Update store
|
||||
store.setState({
|
||||
signedPacts: newSignedPacts,
|
||||
signedPactDetails: newSignedPactDetails,
|
||||
elements: newElements,
|
||||
});
|
||||
};
|
||||
|
||||
// Remove a pact
|
||||
const removePact = (floor: number) => {
|
||||
const removePactHandler = (floor: number) => {
|
||||
const guardian = GUARDIANS[floor];
|
||||
const newSignedPacts = signedPacts.filter(f => f !== floor);
|
||||
|
||||
removePact(floor);
|
||||
|
||||
// Remove pact details
|
||||
const newSignedPactDetails = { ...signedPactDetails };
|
||||
delete newSignedPactDetails[floor];
|
||||
debugSetPactDetails(newSignedPactDetails);
|
||||
|
||||
addLog(`📜 DEBUG: Removed pact with ${guardian?.name || 'Unknown'}!`);
|
||||
|
||||
store.setState({
|
||||
signedPacts: newSignedPacts,
|
||||
signedPactDetails: newSignedPactDetails,
|
||||
});
|
||||
};
|
||||
|
||||
// Clear all pacts
|
||||
const clearAllPacts = () => {
|
||||
addLog(`📜 DEBUG: Cleared all pacts!`);
|
||||
store.setState({
|
||||
signedPacts: [],
|
||||
signedPactDetails: {},
|
||||
});
|
||||
debugSetSignedPacts([]);
|
||||
debugSetPactDetails({});
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -162,7 +151,7 @@ export function PactDebug() {
|
||||
<Button
|
||||
size="sm"
|
||||
variant="destructive"
|
||||
onClick={() => removePact(floor)}
|
||||
onClick={() => removePactHandler(floor)}
|
||||
className="text-xs"
|
||||
>
|
||||
Remove
|
||||
|
||||
Reference in New Issue
Block a user