[Medium] [Bug] Invoker attunement: no guardian-defeat-gated unlock logic — only debug bypass exists #330

Closed
opened 2026-06-08 16:02:46 +02:00 by Anexim · 2 comments
Owner

Spec: docs/specs/attunements/invoker/invoker-spec.md

Discrepancy found:

DISCREPANCY #1 [MEDIUM] — Missing guardian-defeat-gated unlock logic

  • Spec §3: "Defeat the first Guardian (floor 10)" — Invoker should unlock only after defeating floor 10
  • Code (attunementStore.ts): Only has debugUnlockAttunement (unconditional bypass). No conditional unlock action that checks for a guardian defeat.
  • Impact: The unlockCondition string exists on the data definition but is never evaluated by the store. Players can unlock the Invoker without defeating a guardian.
  • Fix: Implement unlockAttunement action that validates the unlock condition (checks defeatedGuardians or similar state) before allowing activation

All other fields verified as 100% match:

  • Attunement definition (id, slot, icon, color, primaryMana, regen, conversionRate, capabilities, skillCategories)
  • Both disciplines (pact-attunement, guardians-boon) with all fields
  • All perk thresholds, types, intervals, and bonus amounts
  • requires: ['signed_pact'] on both disciplines
  • Discipline effects wiring
**Spec:** `docs/specs/attunements/invoker/invoker-spec.md` **Discrepancy found:** ### DISCREPANCY #1 [MEDIUM] — Missing guardian-defeat-gated unlock logic - **Spec §3:** "Defeat the first Guardian (floor 10)" — Invoker should unlock only after defeating floor 10 - **Code (`attunementStore.ts`):** Only has `debugUnlockAttunement` (unconditional bypass). No conditional unlock action that checks for a guardian defeat. - **Impact:** The `unlockCondition` string exists on the data definition but is never evaluated by the store. Players can unlock the Invoker without defeating a guardian. - **Fix:** Implement `unlockAttunement` action that validates the unlock condition (checks `defeatedGuardians` or similar state) before allowing activation **All other fields verified as 100% match:** - Attunement definition (id, slot, icon, color, primaryMana, regen, conversionRate, capabilities, skillCategories) ✅ - Both disciplines (`pact-attunement`, `guardians-boon`) with all fields ✅ - All perk thresholds, types, intervals, and bonus amounts ✅ - `requires: ['signed_pact']` on both disciplines ✅ - Discipline effects wiring ✅
Anexim added the ai:todo label 2026-06-08 16:02:46 +02:00
n8n-gitea was assigned by Anexim 2026-06-08 16:02:46 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-09 11:31:57 +02:00
Author
Owner

Fix implemented for Discrepancy #1 — Missing guardian-defeat-gated unlock logic

Changes made:

  1. src/lib/game/stores/attunementStore.ts — Added unlockAttunement(attunementId, defeatedGuardians) action:

    • For invoker: checks if floor 10 is in defeatedGuardians before allowing unlock
    • For fabricator: returns false (no specific gating condition implemented)
    • Returns true on success, false if conditions not met or already unlocked
    • Prevents unlocking if attunement already exists in state
  2. src/lib/game/stores/pipelines/combat-tick.ts — Wired auto-unlock into onFloorCleared:

    • When floor 10 guardian is defeated, automatically calls unlockAttunement('invoker', defeatedGuardians)
    • Logs a message when the Invoker path becomes available
  3. src/components/game/tabs/AttunementsTab.tsx — Added manual unlock UI:

    • Added isUnlockConditionMet() helper that checks if defeated guardians include floor 10
    • Shows an "Unlock" button on locked attunement cards when their condition is met
    • Button calls unlockAttunement with current defeatedGuardians from prestige store

The debugUnlockAttunement action is preserved for debug/testing use.

**Fix implemented for Discrepancy #1 — Missing guardian-defeat-gated unlock logic** ### Changes made: 1. **`src/lib/game/stores/attunementStore.ts`** — Added `unlockAttunement(attunementId, defeatedGuardians)` action: - For `invoker`: checks if floor 10 is in `defeatedGuardians` before allowing unlock - For `fabricator`: returns false (no specific gating condition implemented) - Returns `true` on success, `false` if conditions not met or already unlocked - Prevents unlocking if attunement already exists in state 2. **`src/lib/game/stores/pipelines/combat-tick.ts`** — Wired auto-unlock into `onFloorCleared`: - When floor 10 guardian is defeated, automatically calls `unlockAttunement('invoker', defeatedGuardians)` - Logs a message when the Invoker path becomes available 3. **`src/components/game/tabs/AttunementsTab.tsx`** — Added manual unlock UI: - Added `isUnlockConditionMet()` helper that checks if defeated guardians include floor 10 - Shows an "Unlock" button on locked attunement cards when their condition is met - Button calls `unlockAttunement` with current `defeatedGuardians` from prestige store The `debugUnlockAttunement` action is preserved for debug/testing use.
Anexim added ai:done and removed ai:in-progress labels 2026-06-09 11:36:52 +02:00
Author
Owner

Fix complete. All 1090 tests pass. See previous comment for detailed changes summary.

Fix complete. All 1090 tests pass. See previous comment for detailed changes summary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#330