[Medium] [Bug] Spire Climbing: Guardian rooms not re-initialized when not cleared on ascent #300

Closed
opened 2026-06-07 17:41:01 +02:00 by Anexim · 2 comments
Owner

Spec: docs/specs/spire-climbing-spec.md §4.7
Severity: Medium

Problem: src/lib/game/stores/combat-descent-actions.ts:193-203onEnterRoomDescend() only re-initializes guardian defensive state when didReset === true. If the room was never cleared on ascent (!wasCleared), it returns early without re-initializing guardian state. This could lead to stale/missing shield/barrier values for guardian rooms that weren't cleared on ascent.

File: src/lib/game/stores/combat-descent-actions.ts:170-203

**Spec:** docs/specs/spire-climbing-spec.md §4.7 **Severity:** Medium **Problem:** `src/lib/game/stores/combat-descent-actions.ts:193-203` — `onEnterRoomDescend()` only re-initializes guardian defensive state when `didReset === true`. If the room was never cleared on ascent (`!wasCleared`), it returns early without re-initializing guardian state. This could lead to stale/missing shield/barrier values for guardian rooms that weren't cleared on ascent. **File:** `src/lib/game/stores/combat-descent-actions.ts:170-203`
Anexim added the ai:todo label 2026-06-07 17:41:01 +02:00
n8n-gitea was assigned by Anexim 2026-06-07 17:41:02 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-08 14:37:46 +02:00
Author
Owner

Starting work on guardian room re-initialization bug. Investigating combat-descent-actions.ts:170-203.

Starting work on guardian room re-initialization bug. Investigating combat-descent-actions.ts:170-203.
Anexim added ai:done and removed ai:in-progress labels 2026-06-08 14:41:34 +02:00
Author
Owner

Fix applied and pushed. Added guardian defensive state initialization for uncleared guardian rooms during descent in onEnterRoomDescend().

Root cause: When a room wasn't cleared on ascent (!wasCleared), the function returned early without checking if it was a guardian room. This meant guardian shield/barrier values were never initialized for these rooms, leading to stale/missing defensive state.

Fix: Before the early return in the !wasCleared branch, added a check: if the current room is a guardian room, initialize guardianShield, guardianShieldMax, guardianBarrier, and guardianBarrierMax from the guardian definition. This mirrors the same initialization that happens in the didReset branch.

Tests: 1069 passed (58 files), all pre-commit checks pass. File size: 276 lines (under 400 limit).

**Fix applied and pushed.** Added guardian defensive state initialization for uncleared guardian rooms during descent in `onEnterRoomDescend()`. **Root cause:** When a room wasn't cleared on ascent (`!wasCleared`), the function returned early without checking if it was a guardian room. This meant guardian shield/barrier values were never initialized for these rooms, leading to stale/missing defensive state. **Fix:** Before the early return in the `!wasCleared` branch, added a check: if the current room is a guardian room, initialize `guardianShield`, `guardianShieldMax`, `guardianBarrier`, and `guardianBarrierMax` from the guardian definition. This mirrors the same initialization that happens in the `didReset` branch. **Tests:** 1069 passed (58 files), all pre-commit checks pass. File size: 276 lines (under 400 limit).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#300