fix: gameStore.ts passes empty object to processCombatTick as first argument #29

Closed
opened 2026-05-18 15:56:07 +02:00 by Anexim · 2 comments
Owner

Severity: Critical

File: src/lib/game/stores/gameStore.ts (line 199)

Problem: The call useCombatStore.getState().processCombatTick({}, rawMana, elements, ...) passes an empty object {} as the first argument. The combatStore.ts wrapper at line 226 expects (rawMana, elements, maxMana, attackSpeedMult, onFloorCleared, onDamageDealt) — 6 parameters after get and set are already bound. The {} becomes rawMana (a number), rawMana becomes elements (a record), etc. — all arguments are shifted.

Impact: Combat tick processing receives completely wrong argument types. rawMana will be {} (an object, not a number), elements will be a number, etc. This will cause runtime errors or silent data corruption during combat.

Fix: The call should be:

useCombatStore.getState().processCombatTick(rawMana, elements, maxMana, 1, onFloorCleared, onDamageDealt)

Remove the {} first argument — the wrapper already binds get and set internally.

**Severity:** Critical **File:** `src/lib/game/stores/gameStore.ts` (line 199) **Problem:** The call `useCombatStore.getState().processCombatTick({}, rawMana, elements, ...)` passes an empty object `{}` as the first argument. The `combatStore.ts` wrapper at line 226 expects `(rawMana, elements, maxMana, attackSpeedMult, onFloorCleared, onDamageDealt)` — 6 parameters after `get` and `set` are already bound. The `{}` becomes `rawMana` (a number), `rawMana` becomes `elements` (a record), etc. — all arguments are shifted. **Impact:** Combat tick processing receives completely wrong argument types. `rawMana` will be `{}` (an object, not a number), `elements` will be a number, etc. This will cause runtime errors or silent data corruption during combat. **Fix:** The call should be: ```ts useCombatStore.getState().processCombatTick(rawMana, elements, maxMana, 1, onFloorCleared, onDamageDealt) ``` Remove the `{}` first argument — the wrapper already binds `get` and `set` internally.
Anexim added the ai:todo label 2026-05-18 15:56:07 +02:00
n8n-gitea was assigned by Anexim 2026-05-18 15:56:07 +02:00
Author
Owner

Starting work on gameStore.ts passes empty object to processCombatTick

Starting work on gameStore.ts passes empty object to processCombatTick
Author
Owner

Fixed: Removed empty object {} first argument from processCombatTick call in gameStore.ts. The wrapper already binds get/set internally.

Fixed: Removed empty object `{}` first argument from processCombatTick call in gameStore.ts. The wrapper already binds get/set internally.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#29