[High] [Bug] Enchanting: Discipline perk gating not enforced in design validation #302
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?
Spec: docs/specs/attunements/enchanter/systems/enchanting-spec.md §13, AC-13
Severity: Missing feature
Problem: The
unlockedEffectsstore exists incraftingStore.types.ts:26and discipline perks can unlock effects viagameStore.ts:215-217, butvalidateDesignEffects()insrc/lib/game/crafting-design.ts:22-42never checksunlockedEffects. Any effect can be used regardless of discipline perks.Files:
src/lib/game/crafting-design.ts:22-42— validation doesn't check unlockedEffectssrc/lib/game/crafting-actions/design-actions.ts:33-40— design start uses the incomplete validationStarting investigation of discipline perk gating in enchantment design validation.
Fix applied for discipline perk gating in design validation (AC-13).
Root cause:
validateDesignEffects()incrafting-design.ts:22-42never checked theunlockedEffectsstore. Any effect could be used regardless of discipline perks.Changes:
src/lib/game/crafting-design.ts— AddedunlockedEffects: string[] = []parameter tovalidateDesignEffects(). Each effect ID is now checked against the unlocked set; locked effects return{ valid: false, reason: "Effect X is locked — unlock via discipline perks" }.src/lib/game/crafting-actions/design-actions.ts— UpdatedstartDesigningEnchantment()to passstate.unlockedEffectsto validation.src/lib/game/stores/craftingStore.ts— Updated the store's ownstartDesigningEnchantmentaction to passstate.unlockedEffects.src/lib/game/__tests__/design-validation-perk-gating.test.ts— Added 8 regression tests covering: locked effects rejected, unlocked effects accepted, partial unlocks, backward compat (default empty array), and interaction with existing validation (unknown effects, wrong category).Verification: All 761 existing tests pass + 8 new regression tests pass.
Fix complete and pushed.
Summary of changes:
crafting-design.ts— AddedunlockedEffectsparameter tovalidateDesignEffects(); each effect ID is checked against the unlocked setdesign-actions.ts— Passesstate.unlockedEffectsfrom the store to validationcraftingStore.ts— Passesstate.unlockedEffectsfrom the store to validationdesign-validation-perk-gating.test.ts— 8 regression tests covering locked/unlocked/partial/unlocked+wrong-category scenariosAll 1051 tests pass (55 files). Pre-commit hooks clean.