fix: getUnlockedAttunements filter logic shows inactive-but-unlocked attunements #50
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Major
File:
src/lib/game/data/attunements.ts(line 100)Problem: The filter
state.active || ATTUNEMENTS_DEF[id]?.unlockedwill include attunements that are inactive but unlocked by default (likeenchanter). The function is namedgetUnlockedAttunementsbut 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:
Or if the intent is to show both active and available-to-activate attunements, rename the function and document the behavior clearly.
[priority: 4] BROKEN FEATURE — getUnlockedAttunements filter logic shows inactive-but-unlocked attunements.
Starting work on #50. Reading attunements.ts to understand the filter logic bug.
Fixed. Changed the filter in getUnlockedAttunements from
state.active || ATTUNEMENTS_DEF[id]?.unlockedto juststate.active. This ensures only actively selected attunements are returned, not ones that are merely unlocked by default.