[feature: fabricator-discipline] Add discipline for unlocking fabricator recipes #206
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?
FEATURE: Fabricator recipes should be gated behind a discipline, similar to how enchantment effects are gated behind enchanter disciplines.
Current State
Fabricator recipes in
src/components/game/tabs/CraftingTab/FabricatorSubTab.tsxare shown to the player purely based on mana type filter — ALL recipes for a given mana type are visible immediately once that mana type is unlocked. There is no progression gating.Desired Behavior
Add a new discipline (or disciplines) that gates fabricator recipes behind XP thresholds, following the exact same pattern used by enchanter disciplines for enchantment effect unlocks.
Reference Pattern: Enchanter Discipline Unlocks
The existing infrastructure works as follows:
Discipline perks define
unlocksEffects: string[]— e.g. indata/disciplines/enchanter.tsline 70-96, thestudy-basic-weapon-enchantmentsdiscipline unlocks['sword_fire', 'sword_frost', 'sword_lightning']at thresholds 50/100/150.Tick processing collects unlocks —
stores/discipline-slice.ts~line 192-220: duringprocessTick(), newly unlocked perks withunlocksEffectsare collected intonewUnlockedEffects[].GameStore passes unlocks to CraftingStore —
stores/gameStore.ts~line 270-274: callsuseCraftingStore.getState().unlockEffects(disciplineResult.unlockedEffects).UI filters by unlock status —
crafting/EnchantmentDesigner/utils.tsline 12-25:getAvailableEffects()filters to only effects whereunlockedEffects.includes(effect.id).Implementation Plan
Option A (simplest): Reuse the
unlocksEffectsfield on discipline perks to also hold fabricator recipe IDs. The unlock pipeline already works — just add recipe IDs to the array and filter recipes inFabricatorSubTab.tsxusing the sameunlockedEffectscheck.Option B (cleaner): Add a new
unlocksRecipes?: string[]field toDisciplinePerk(intypes/disciplines.tsline 26) and mirror the unlock pipeline: collect during tick processing, pass to a newunlockRecipes()action on the crafting store, filter in the UI.Files to Modify
src/lib/game/types/disciplines.ts— AddunlocksRecipes?: string[]toDisciplinePerk(if going with Option B)src/lib/game/data/disciplines/fabricator.ts— Add new discipline(s) with recipe-unlocking perkssrc/lib/game/data/disciplines/index.ts— Re-export new discipline(s)src/lib/game/stores/discipline-slice.ts— CollectunlocksRecipesduring tick (Option B only)src/lib/game/stores/gameStore.ts— Pass recipe unlocks to crafting store (Option B only)src/lib/game/stores/craftingStore.ts— AddunlockRecipes()action (Option B only)src/components/game/tabs/CraftingTab/FabricatorSubTab.tsx— Filter recipes by unlock statusPriority
MEDIUM — Affects game balance and progression pacing.
Starting work on fabricator discipline for unlocking recipes.
Implementation Complete ✅
Implemented Option B (cleaner approach with separate
unlocksRecipesfield on discipline perks).Changes Made (10 files, +216/-8)
src/lib/game/types/disciplines.ts— AddedunlocksRecipes?: string[]toDisciplinePerkinterfacesrc/lib/game/data/disciplines/fabricator.ts— Added 3 new disciplines:study-fabricator-recipes— Unlocks elemental recipes (earth/metal/sand/crystal) at thresholds 50/100/150/200study-wizard-branch— Unlocks wizard equipment recipes (oak/arcanist/battlestaff/arcanist set/void catalyst/pendant) at thresholds 50-300, requiresstudy-fabricator-recipesstudy-physical-branch— Unlocks physical combat recipes (crystal/arcanist/void blade/battle set) at thresholds 50-300, requiresstudy-fabricator-recipessrc/lib/game/stores/discipline-slice.ts— CollectsunlocksRecipesduringprocessTick()alongsideunlocksEffects, returnsunlockedRecipesin resultsrc/lib/game/stores/gameStore.ts— PassesdisciplineResult.unlockedRecipestocraftingStore.unlockRecipes()with log messagessrc/lib/game/stores/craftingStore.types.ts— AddedunlockedRecipes: string[]to state andunlockRecipes()to actionssrc/lib/game/stores/craftingStore.ts— ImplementedunlockRecipes()action, added to persistencesrc/lib/game/stores/crafting-initial-state.ts— AddedunlockedRecipes: []to default statesrc/components/game/tabs/CraftingTab/FabricatorSubTab.tsx— Filters recipes byunlockedRecipes.includes(r.id)so only unlocked recipes are visibleVerification
Implementation complete. All tests passing, committed and pushed.