Bug: Equipment spell kills don't advance floor (1-tick delay) #226

Closed
opened 2026-05-30 21:10:34 +02:00 by Anexim · 1 comment
Owner

Bug Description

When an equipment spell delivers the killing blow to a floor, the floor advance logic doesn't run. The equipment spell loop just breaks without:

  • Calling onFloorCleared
  • Advancing currentFloor
  • Resetting floorHP to the new floor's max
  • Resetting castProgress

The floor advance happens on the next tick when the primary spell loop sees floorHP <= 0, causing a 1-tick delay.

Code Location

src/lib/game/stores/combat-actions.ts lines ~155-158 (equipment spell loop):

if (floorHP <= 0) break; // Floor cleared, stop processing
// Missing: onFloorCleared, floor advance, etc.

Compare with the primary spell loop (lines ~107-117) which properly advances the floor and calls onFloorCleared.

Impact

Minor. Floor advancement is delayed by one tick when equipment spells deliver the killing blow. The onFloorCleared callback (which grants rewards) is also delayed. This creates an inconsistency between primary spell kills (instant) and equipment spell kills (delayed).

Fix Required

Add the same floor-clear logic in the equipment spell loop as the primary spell loop: call onFloorCleared, advance currentFloor, reset floorHP, and reset castProgress.

## Bug Description When an equipment spell delivers the killing blow to a floor, the floor advance logic doesn't run. The equipment spell loop just `break`s without: - Calling `onFloorCleared` - Advancing `currentFloor` - Resetting `floorHP` to the new floor's max - Resetting `castProgress` The floor advance happens on the **next tick** when the primary spell loop sees `floorHP <= 0`, causing a 1-tick delay. ## Code Location `src/lib/game/stores/combat-actions.ts` lines ~155-158 (equipment spell loop): ```typescript if (floorHP <= 0) break; // Floor cleared, stop processing // Missing: onFloorCleared, floor advance, etc. ``` Compare with the primary spell loop (lines ~107-117) which properly advances the floor and calls `onFloorCleared`. ## Impact **Minor.** Floor advancement is delayed by one tick when equipment spells deliver the killing blow. The `onFloorCleared` callback (which grants rewards) is also delayed. This creates an inconsistency between primary spell kills (instant) and equipment spell kills (delayed). ## Fix Required Add the same floor-clear logic in the equipment spell loop as the primary spell loop: call `onFloorCleared`, advance `currentFloor`, reset `floorHP`, and reset `castProgress`.
Anexim added the ai:todo label 2026-05-30 21:10:34 +02:00
n8n-gitea was assigned by Anexim 2026-05-30 21:10:34 +02:00
Author
Owner

Fixed: Equipment spell loop now includes floor-clear logic (onFloorCleared, floor advance, HP reset, castProgress reset) matching the primary spell loop.

Fixed: Equipment spell loop now includes floor-clear logic (onFloorCleared, floor advance, HP reset, castProgress reset) matching the primary spell loop.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#226