From d459276dcc745ed48a52625b4f749b54bc1fee39 Mon Sep 17 00:00:00 2001 From: zhipu Date: Fri, 27 Mar 2026 15:57:49 +0000 Subject: [PATCH] feat: Initialize attunement state in game store - Add attunement state to makeInitial function - Player starts with Enchanter attunement (right hand) unlocked - Initialize all 7 attunement slots with default state - Add primaryMana and primaryManaMax for all mana types - Start with 10 transference mana (Enchanter's primary type) --- src/lib/game/store.ts | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/lib/game/store.ts b/src/lib/game/store.ts index 3b84ce8..fb21f33 100755 --- a/src/lib/game/store.ts +++ b/src/lib/game/store.ts @@ -44,6 +44,14 @@ import { rollLootDrops, LOOT_DROPS } from './data/loot-drops'; import { CRAFTING_RECIPES, canCraftRecipe } from './data/crafting-recipes'; import { EQUIPMENT_TYPES } from './data/equipment'; import type { EquipmentInstance } from './types'; +import { + ATTUNEMENTS, + getStartingAttunement, + type AttunementType, + type AttunementState, + type ManaType, + getTotalAttunementRegen, +} from './attunements'; // Import computed stats and utility functions from computed-stats.ts import { DEFAULT_EFFECTS, @@ -238,6 +246,52 @@ function makeInitial(overrides: Partial = {}): GameState { memorySlots: 3 + (pu.deepMemory || 0), memories: overrides.memories || [], + // Attunement System - Start with Enchanter (right hand) attunement + attunements: { + enchanter: { unlocked: true, level: 1, manaPool: 10, maxMana: 50 }, + caster: { unlocked: false, level: 0, manaPool: 0, maxMana: 50 }, + seer: { unlocked: false, level: 0, manaPool: 0, maxMana: 50 }, + warden: { unlocked: false, level: 0, manaPool: 0, maxMana: 50 }, + invoker: { unlocked: false, level: 0, manaPool: 0, maxMana: 50 }, + strider: { unlocked: false, level: 0, manaPool: 0, maxMana: 50 }, + anchor: { unlocked: false, level: 0, manaPool: 0, maxMana: 50 }, + } as Record, + attunementSkills: {}, + attunementSkillProgress: {}, + // Primary mana pools (transference, form, vision, barrier, flow, stability) + primaryMana: { + transference: 10, + form: 0, + vision: 0, + barrier: 0, + flow: 0, + stability: 0, + fire: 0, + water: 0, + earth: 0, + air: 0, + light: 0, + dark: 0, + life: 0, + death: 0, + } as Record, + primaryManaMax: { + transference: 50, + form: 50, + vision: 50, + barrier: 50, + flow: 50, + stability: 50, + fire: 50, + water: 50, + earth: 50, + air: 50, + light: 50, + dark: 50, + life: 50, + death: 50, + } as Record, + incursionStrength: 0, containmentWards: 0,