fix: getUnlockedAttunements filter logic shows inactive-but-unlocked attunements #50

Closed
opened 2026-05-18 16:02:34 +02:00 by Anexim · 3 comments
Owner

Severity: Major

File: src/lib/game/data/attunements.ts (line 100)

Problem: The filter state.active || ATTUNEMENTS_DEF[id]?.unlocked will include attunements that are inactive but unlocked by default (like enchanter). The function is named getUnlockedAttunements but the filter logic mixes "active" with "unlocked by default" — an inactive-but-unlocked attunement would be included even though the player hasn't activated it.

Impact: UI may show attunements the player hasn't chosen yet, confusing the player and potentially breaking attunement selection flows.

Fix: Change the filter to only include active attunements:

.filter(([id, state]) => state.active)

Or if the intent is to show both active and available-to-activate attunements, rename the function and document the behavior clearly.

**Severity:** Major **File:** `src/lib/game/data/attunements.ts` (line 100) **Problem:** The filter `state.active || ATTUNEMENTS_DEF[id]?.unlocked` will include attunements that are **inactive but unlocked by default** (like `enchanter`). The function is named `getUnlockedAttunements` but the filter logic mixes "active" with "unlocked by default" — an inactive-but-unlocked attunement would be included even though the player hasn't activated it. **Impact:** UI may show attunements the player hasn't chosen yet, confusing the player and potentially breaking attunement selection flows. **Fix:** Change the filter to only include active attunements: ```ts .filter(([id, state]) => state.active) ``` Or if the intent is to show both active and available-to-activate attunements, rename the function and document the behavior clearly.
Anexim added the ai:todo label 2026-05-18 16:02:34 +02:00
n8n-gitea was assigned by Anexim 2026-05-18 16:02:34 +02:00
Author
Owner

[priority: 4] BROKEN FEATURE — getUnlockedAttunements filter logic shows inactive-but-unlocked attunements.

[priority: 4] BROKEN FEATURE — getUnlockedAttunements filter logic shows inactive-but-unlocked attunements.
Author
Owner

Starting work on #50. Reading attunements.ts to understand the filter logic bug.

Starting work on #50. Reading attunements.ts to understand the filter logic bug.
Author
Owner

Fixed. Changed the filter in getUnlockedAttunements from state.active || ATTUNEMENTS_DEF[id]?.unlocked to just state.active. This ensures only actively selected attunements are returned, not ones that are merely unlocked by default.

Fixed. Changed the filter in getUnlockedAttunements from `state.active || ATTUNEMENTS_DEF[id]?.unlocked` to just `state.active`. This ensures only actively selected attunements are returned, not ones that are merely unlocked by default.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#50