Fix Bug 8: Replace direct setState calls with proper store actions in debug components
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m8s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m8s
- SkillDebug.tsx: Use useSkillStore.getState().incrementSkillLevel() and setSkillLevel() instead of direct setState - ElementDebug.tsx: Use getState() for consistency - AttunementDebug.tsx: When unlocking Enchanter, also unlock transference element - GameStateDebug.tsx: Use proper store actions (debugSetFloor, resetFloorHP, debugSetTime) and fix Switch component usage
This commit is contained in:
@@ -8,16 +8,15 @@ import { ELEMENTS } from '@/lib/game/constants';
|
||||
|
||||
export function ElementDebug() {
|
||||
const elements = useManaStore((s) => s.elements);
|
||||
const unlockElement = useManaStore((s) => s.unlockElement);
|
||||
const addElementMana = useManaStore((s) => s.addElementMana);
|
||||
|
||||
const handleUnlockElement = (element: string) => {
|
||||
unlockElement(element, 500);
|
||||
useManaStore.getState().unlockElement(element, 500);
|
||||
};
|
||||
|
||||
const handleAddElementalMana = (element: string, amount: number) => {
|
||||
if (addElementMana) {
|
||||
addElementMana(element, amount, 100);
|
||||
const elem = elements?.[element];
|
||||
if (elem?.unlocked) {
|
||||
useManaStore.getState().addElementMana(element, amount, elem.max);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user