From 20c2ebd7b561c2c2ed8d4240411b55865be1c217 Mon Sep 17 00:00:00 2001 From: n8n-gitea Date: Mon, 18 May 2026 11:26:24 +0200 Subject: [PATCH] Updated docs --- AGENTS.md | 38 +- docs/GAME_BRIEFING.md | 886 ++++++++++++------------------------- docs/circular-deps.txt | 2 +- docs/dependency-graph.json | 2 +- docs/project-structure.txt | 3 +- docs/skills.md | 726 ------------------------------ 6 files changed, 308 insertions(+), 1349 deletions(-) delete mode 100644 docs/skills.md diff --git a/AGENTS.md b/AGENTS.md index f414738..af2250a 100755 --- a/AGENTS.md +++ b/AGENTS.md @@ -43,26 +43,42 @@ Use for 3+ sequential independent calls. Zero context from parent — paste ever ## Architecture - **Stack:** Next.js 16, TS 5, Tailwind 4 + shadcn/ui, Zustand+persist, Vitest/Playwright, Bun -- **Active stores:** `src/lib/game/stores/{game,mana,combat,prestige,skill,ui}Store.ts` +- **Active stores:** `src/lib/game/stores/{game,mana,combat,prestige,discipline,ui}Store.ts` - **Legacy (migrating):** `src/lib/game/store/` and `store-modules/` - **Crafting:** 3-step flow — Design → Prepare → Apply via `crafting-actions/` -- **Skills v2:** `constants/skills-v2.ts` + `computeStats()` in effects -- **Effects:** All stat mods through `getUnifiedEffects()` — never read skill levels directly +- **Disciplines:** `data/disciplines/` + `stores/discipline-slice.ts` + `utils/discipline-math.ts` +- **Effects:** All stat mods through `getUnifiedEffects()` — discipline bonuses enter via `computeDisciplineEffects()` ### Adding Effects 1. `data/enchantment-effects.ts` 2. `effects.ts` → `computeEquipmentEffects()` 3. Access via `getUnifiedEffects(state)` -### Adding Skills -1. `constants/skills-v2.ts` -2. `computeStats()` mapping +### Adding Disciplines +1. Choose the correct data file under `data/disciplines/`: + - `base.ts` — available to all attunements + - `enchanter.ts` — requires Enchanter attunement + - `invoker.ts` — requires Invoker attunement + - `fabricator.ts` — requires Fabricator attunement +2. Define a `DisciplineDefinition` (see `types/disciplines.ts`): + - `statBonus.stat` must match a key consumed by `computeDisciplineEffects()` + - Set `difficultyFactor` and `scalingFactor` to control growth rate + - Add perks (`once`, `capped`, or `infinite`) +3. Re-export from `data/disciplines/index.ts` so it appears in `ALL_DISCIPLINES` +4. Add any new `statBonus.stat` keys to `discipline-effects.ts` → `computeDisciplineEffects()` + +### Discipline Math (quick reference) +``` +StatBonus = baseValue × (XP / scalingFactor)^0.65 +ManaDrainPerTick = drainBase × (1 + (XP / difficultyFactor)^0.4) +``` +- XP accrues every tick the discipline is active and mana drain is met +- `concurrentLimit` starts at 1 and expands by 1 per 500 total XP (max +3) ### Adding Spells 1. `constants/spells.ts` 2. `data/enchantment-effects.ts` -3. `constants/skills-v2.ts` research skill -4. `EFFECT_RESEARCH_MAPPING` +3. `EFFECT_RESEARCH_MAPPING` ## Banned @@ -74,7 +90,7 @@ Lifesteal/healing, scroll crafting, ascension skills, LabTab, pause, mana types: ## Mana Types -**Base (7):** Fire 🔥 Water 💧 Air 🌬️ Earth ⛰️ Light ☀️ Dark 🌑 Death 💀 -**Utility (1):** Transference 🔗 -**Compound (3):** Fire+Earth=Metal, Earth+Water=Sand, Fire+Air=Lightning +**Base (7):** Fire 🔥 Water 💧 Air 🌬️ Earth ⛰️ Light ☀️ Dark 🌑 Death 💀 +**Utility (1):** Transference 🔗 +**Compound (3):** Fire+Earth=Metal, Earth+Water=Sand, Fire+Air=Lightning **Exotic (3):** Sand+Sand+Light=Crystal, Fire+Fire+Light=Stellar, Dark+Dark+Death=Void \ No newline at end of file diff --git a/docs/GAME_BRIEFING.md b/docs/GAME_BRIEFING.md index 93ea532..94f7c01 100644 --- a/docs/GAME_BRIEFING.md +++ b/docs/GAME_BRIEFING.md @@ -1,8 +1,7 @@ # Mana-Loop: Comprehensive Game Briefing Document -**Document Version:** 1.2 -**Generated:** Game Systems Analysis -**Updated:** After Modular Refactoring (stores/, crafting-actions/, skill-evolution-modules/, constants/) +**Document Version:** 2.0 +**Updated:** Disciplines Refactor (skills system removed; disciplines replace it entirely) --- @@ -16,7 +15,7 @@ 6. [Combat System](#combat-system) 7. [Guardian & Pact System](#guardian--pact-system) 8. [Attunement System](#attunement-system) -9. [Skill System](#skill-system) +9. [Discipline System](#discipline-system) 10. [Equipment & Enchantment System](#equipment--enchantment-system) 11. [Golemancy System](#golemancy-system) 12. [Prestige/Loop System](#prestigeloop-system) @@ -29,16 +28,16 @@ ## Executive Summary -**Mana-Loop** is a browser-based incremental/idle game with a 30-day time loop mechanic. Players gather mana, study skills, climb a 100-floor spire, defeat guardians, sign pacts, enchant equipment, and prestige for permanent progression. +**Mana-Loop** is a browser-based incremental/idle game with a 30-day time loop mechanic. Players gather mana, practice disciplines, climb a 100-floor spire, defeat guardians, sign pacts, enchant equipment, and prestige for permanent progression. **Key Differentiators:** - 3-class Attunement system (Enchanter, Invoker, Fabricator) - Equipment-based spell system (spells come from enchanted gear) -- 5-tier skill evolution with milestone upgrade choices -- Time pressure through incursion mechanic +- Practice-based Discipline system — no discrete skill levels, only continuous XP growth +- Time pressure through the incursion mechanic - Guardian pacts provide permanent multipliers -**Code Architecture:** The codebase has been refactored into a modular architecture with specialized directories for stores, crafting actions, skill evolution modules, constants, and game data. +**Code Architecture:** Modular stores, crafting actions, discipline data, and constants. The old skill system (study, skill tiers, milestone upgrades) has been fully removed and replaced by the Discipline system. --- @@ -50,14 +49,16 @@ ┌─────────────────────────────────────────────────────────────┐ │ TIME LOOP (30 Days) │ ├─────────────────────────────────────────────────────────────┤ -│ ┌─────────┐ ┌──────────┐ ┌───────────┐ ┌───────┐ │ -│ │ GATHER │───▶│ STUDY │───▶│ CLIMB │───▶│ CRAFT │ │ -│ │ MANA │ │ SKILLS │ │ SPIRE │ │ GEAR │ │ -│ └─────────┘ └──────────┘ └───────────┘ └───────┘ │ -│ │ │ │ │ │ -│ ▼ ▼ ▼ ▼ │ +│ ┌─────────┐ ┌────────────┐ ┌───────────┐ ┌──────┐ │ +│ │ GATHER │───▶│ PRACTICE │───▶│ CLIMB │───▶│CRAFT │ │ +│ │ MANA │ │ DISCIPLINES│ │ SPIRE │ │ GEAR │ │ +│ └─────────┘ └────────────┘ └───────────┘ └──────┘ │ +│ │ │ │ │ │ +│ └───────────────┴────────────────┴───────────────┘ │ +│ │ │ +│ ▼ │ │ ┌─────────────────────────────────────────────────────┐ │ -│ │ DEFEAT GUARDIANS → SIGN PACTS │ │ +│ │ DEFEAT GUARDIANS → SIGN PACTS │ │ │ └─────────────────────────────────────────────────────┘ │ │ │ │ │ ▼ │ @@ -73,25 +74,18 @@ |--------|--------|-----------| | **Meditate** | Regen mana with meditation bonus multiplier | Passive (auto-selected after actions) | | **Climb** | Progress through spire floors, cast spells | Active combat | -| **Study** | Learn skills/spells, requires mana cost | Hours per level | +| **Practice** | Run active disciplines, consuming mana each tick | Continuous | | **Craft** | Create/enchant equipment | Hours per stage | | **Convert** | Auto-convert raw mana to elements | Per tick | | **Design** | Create enchantment designs (limited to owned gear types) | Hours | -| **Prepare** | Ready equipment for enchanting (disabled for non-enchanted items) | Hours + mana | +| **Prepare** | Ready equipment for enchanting | Hours + mana | | **Enchant** | Apply enchantment to equipment | Hours + mana | -### ActionButtons Rework (Task 2) +### Action Transitions -**Changes Made:** -- **Manual action selection removed**: Players can no longer manually select actions from a list -- **Auto-transition to Meditate**: After completing Design, Prepare, Enchant, or Craft actions, the game automatically transitions to **Meditate** state -- **Simplified UI**: The ActionButtons component now displays only the current action with a progress indicator -- **Spire Mode integration**: Action buttons are hidden when in Spire Mode (climbing simplified UI) - -**Implementation:** -- `currentAction` state tracks the active action (now in `stores/gameStore.ts`) -- Crafting actions set `currentAction: 'meditate'` when actions complete (in `crafting-actions/`) -- `ACTION_CONFIG` maps actions to display configs (label, icon, color) +- After completing Design, Prepare, Enchant, or Craft the game automatically transitions to **Meditate** +- Action buttons are hidden when in Spire Mode +- `currentAction` state lives in `stores/gameStore.ts` --- @@ -111,16 +105,16 @@ Raw Mana (Base Resource) │ │ ├──▶ Compound Elements (3) ── Created from 2 base ──────────┤ │ Metal = Fire + Earth │ - │ Sand = Earth + Water │ + │ Sand = Earth + Water │ │ Lightning = Fire + Air │ │ │ └──▶ Exotic Elements (3) ── Created from advanced recipes ──┤ Crystal = Sand + Sand + Light │ Stellar = Fire + Fire + Light │ - Void = Dark + Dark + Death │ + Void = Dark + Dark + Death │ ``` -**Note:** Fire, Water, Air, and Earth elements are **locked at start**. Only Transference is unlocked initially. Players must unlock the base elements through gameplay (element unlocking system). +Fire, Water, Air, and Earth are **locked at start**. Only Transference is unlocked initially. ### Mana Formulas @@ -136,16 +130,13 @@ elementMax = (10 + (elemAttuneLevel × 50) + (prestigeElemAttune × 25)) × elem **Base Regeneration (per hour):** ``` -baseRegen = 2 + (manaFlowLevel × 1) + (manaSpringLevel × 2) + (prestigeManaFlow × 0.5) -effectiveRegen = baseRegen × (1 - incursionStrength) × meditationMultiplier +baseRegen = 2 + (manaFlowLevel × 1) + (manaSpringLevel × 2) + (prestigeManaFlow × 0.5) +effectiveRegen = baseRegen × (1 - incursionStrength) × meditationMultiplier ``` **Meditation Bonus:** ``` -Base: 1 + min(hours/4, 0.5) = up to 1.5x after 4 hours -With Meditation Focus skill: 2.5x after 4 hours -With Deep Trance skill: 3.0x after 6 hours -With Void Meditation skill: 5.0x after 8 hours +Base: 1 + min(hours/4, 0.5) → up to 1.5× after 4 hours ``` **Attunement Mana Conversion:** @@ -189,16 +180,12 @@ With Void Meditation skill: 5.0x after 8 hours ### Incursion Mechanic -**Incursion Strength Formula:** ``` if (day < 20): incursionStrength = 0 -else: incursionStrength = min(0.95, (totalHours / maxHours) × 0.95) +else: incursionStrength = min(0.95, (totalHours / maxHours) × 0.95) ``` -**Effects:** -- Reduces mana regeneration by `(1 - incursionStrength)` -- Starts at 0% on Day 20, reaches 95% by Day 30 -- Creates urgency to complete objectives before loop ends +Reduces mana regeneration by `(1 - incursionStrength)`. Starts at 0% on Day 20, reaches 95% by Day 30. --- @@ -214,8 +201,8 @@ element = FLOOR_ELEM_CYCLE[(floor - 1) % 7] **Floor HP Formula:** ``` -normalFloorHP = floor(100 + floor × 50 + floor^1.7) -guardianFloorHP = GUARDIANS[floor].hp // Fixed values (in constants/guardians.ts) +normalFloorHP = floor(100 + floor × 50 + floor^1.7) +guardianFloorHP = GUARDIANS[floor].hp // in constants/guardians.ts ``` **Guardian Floors:** 10, 20, 30, 40, 50, 60, 80, 90, 100 @@ -225,39 +212,19 @@ guardianFloorHP = GUARDIANS[floor].hp // Fixed values (in constants/guardians.ts | Room Type | Chance | Description | |-----------|--------|-------------| | **Combat** | Default | Single enemy, normal combat | -| **Guardian** | Fixed | Boss floor, always on guardian floors | -| **Swarm** | 15% | 3-6 enemies with 40% HP each | +| **Guardian** | Fixed | Boss floor | +| **Swarm** | 15% | 3–6 enemies with 40% HP each | | **Speed** | 10% | Enemy with dodge chance (25% base + 0.5%/floor) | | **Puzzle** | 20% on puzzle floors | Progress-based, faster with relevant attunement | -### Swarm Room Configuration -```javascript -SWARM_CONFIG = { - minEnemies: 3, - maxEnemies: 6, - hpMultiplier: 0.4, // Each enemy has 40% of normal HP - armorBase: 0, - armorPerFloor: 0.01 // +1% armor per 10 floors -} -``` - -### Speed Room Configuration -```javascript -SPEED_ROOM_CONFIG = { - baseDodgeChance: 0.25, // 25% base - dodgePerFloor: 0.005, // +0.5% per floor - maxDodge: 0.50 // Cap at 50% -} -``` - ### Armor Scaling ```javascript FLOOR_ARMOR_CONFIG = { - baseChance: 0, // No armor before floor 10 - chancePerFloor: 0.01, // +1% chance per floor after 10 - maxArmorChance: 0.5, // Max 50% of floors have armor - minArmor: 0.05, // Min 5% damage reduction - maxArmor: 0.25 // Max 25% on non-guardians + baseChance: 0, // No armor before floor 10 + chancePerFloor: 0.01, // +1% chance per floor after 10 + maxArmorChance: 0.5, // Max 50% of floors have armor + minArmor: 0.05, // Min 5% damage reduction + maxArmor: 0.25 // Max 25% on non-guardians } ``` @@ -267,79 +234,56 @@ FLOOR_ARMOR_CONFIG = { ### Spell Casting Mechanics -**Cast Progress:** ``` progressPerTick = HOURS_PER_TICK × spellCastSpeed × totalAttackSpeed ``` -**Spell Cast Speed:** -- Each spell has a `castSpeed` value (casts per hour) -- Higher = faster casting -- Lightning spells get +30% effective cast speed +Lightning spells get +30% effective cast speed. -**Damage Calculation:** +### Damage Calculation ``` -baseDamage = spellDamage + (combatTrainLevel × 5) -pctBonus = 1 + (arcaneFuryLevel × 0.1) -elemMastery = 1 + (elementalMasteryLevel × 0.15) +baseDamage = spellDamage + disciplineBonus(combatStat) +pctBonus = 1 + disciplineMultiplier pactMultiplier = product of all signed pact multipliers elementalBonus = getElementalBonus(spellElement, floorElement) -finalDamage = baseDamage × pctBonus × pactMultiplier × elemMastery × elementalBonus +finalDamage = baseDamage × pctBonus × pactMultiplier × elementalBonus ``` ### Elemental Effectiveness | Condition | Multiplier | |-----------|------------| -| Spell same element as floor | 1.25x (25% bonus) | -| Spell is opposite of floor element | 1.50x (Super Effective) | -| Spell's opposite matches floor | 0.75x (Not Very Effective) | -| Raw mana spells | 1.00x (No bonus) | +| Spell same element as floor | 1.25× | +| Spell is opposite of floor element | 1.50× (Super Effective) | +| Spell's opposite matches floor | 0.75× (Not Very Effective) | +| Raw mana spells | 1.00× | **Element Opposites:** ``` -Fire ↔ Water -Air ↔ Earth -Light ↔ Dark -Lightning ↔ (none, but has armor pierce) +Fire ↔ Water Air ↔ Earth Light ↔ Dark +Lightning — no opposite (has armor pierce instead) ``` ### Armor & Damage Reduction -**Effective Damage:** ``` effectiveArmor = max(0, enemyArmor - armorPierce) -damageDealt = damage × (1 - effectiveArmor) +damageDealt = damage × (1 - effectiveArmor) ``` -**Armor Pierce Sources:** -- Lightning spells: 20-50% pierce -- Metal spells: 25-60% pierce -- Golems: 15-60% pierce - ### Critical Hits -``` -critChance = precisionLevel × 0.05 -critMultiplier = 1.5 (base) -``` - -### AOE Mechanics - -``` -aoeDamage = baseDamage × (1 - 0.1 × (numTargets - 1)) -// 10% less damage per additional target -``` +Critical chance and multiplier come from discipline bonuses (no fixed skill levels). ### Special Combat Effects | Effect | Description | |--------|-------------| | **Burn** | Damage over time | -| **Freeze** | Prevents dodge (100% freeze = no dodge) | +| **Freeze** | Prevents dodge | | **Stun** | Temporary disable | -| **Pierce** | Ignores percentage of armor | +| **Pierce** | Ignores % armor | | **Chain** | Hits multiple targets | | **AOE** | Area damage | | **Buff** | Damage multiplier | @@ -348,77 +292,45 @@ aoeDamage = baseDamage × (1 - 0.1 × (numTargets - 1)) ## Guardian & Pact System -### Spire Mode (Task 2) - -**New Feature:** A simplified UI mode for climbing the spire. - -**How it works:** -- Click **"Climb the Spire"** button (available when not already in Spire Mode) -- Enters simplified UI showing only essential spire info -- Hides ActionButtons and other tabs -- Focuses on combat progression -- Exit condition: Automatically exits when player chooses to stop climbing - -**Implementation:** -- `spireMode` boolean state in `stores/gameStore.ts` -- `enterSpireMode()` and `exitSpireMode()` actions in `stores/combatStore.ts` -- `simpleMode` prop passed to SpireTab for simplified rendering -- UI conditionally renders based on `store.spireMode` - ---- - ### Guardian Floors & Stats | Floor | Guardian | Element | HP | Pact Mult | Armor | Unique Perk | |-------|----------|---------|-----|-----------|-------|-------------| -| 10 | Ignis Prime | Fire | 5,000 | 1.5x | 10% | Fire spells cast 10% faster | -| 20 | Aqua Regia | Water | 15,000 | 1.75x | 15% | Water spells +15% damage | -| 30 | Ventus Rex | Air | 30,000 | 2.0x | 18% | Air spells 15% crit chance | -| 40 | Terra Firma | Earth | 50,000 | 2.25x | 25% | Earth spells +25% vs guardians | -| 50 | Lux Aeterna | Light | 80,000 | 2.5x | 20% | Light spells reveal weaknesses (+20% dmg) | -| 60 | Umbra Mortis | Dark | 120,000 | 2.75x | 22% | Dark spells +25% vs armored | -| 80 | Mors Ultima | Death | 250,000 | 3.25x | 25% | Death spells execute <20% HP | -| 90 | Primordialis | Void | 400,000 | 4.0x | 30% | Void spells ignore 30% resistance | -| 100 | The Awakened One | Stellar | 1,000,000 | 5.0x | 35% | All spells +50% dmg, 25% faster | +| 10 | Ignis Prime | Fire | 5,000 | 1.5× | 10% | Fire spells cast 10% faster | +| 20 | Aqua Regia | Water | 15,000 | 1.75× | 15% | Water spells +15% damage | +| 30 | Ventus Rex | Air | 30,000 | 2.0× | 18% | Air spells 15% crit chance | +| 40 | Terra Firma | Earth | 50,000 | 2.25× | 25% | Earth spells +25% vs guardians | +| 50 | Lux Aeterna | Light | 80,000 | 2.5× | 20% | Light spells reveal weaknesses | +| 60 | Umbra Mortis | Dark | 120,000 | 2.75× | 22% | Dark spells +25% vs armored | +| 80 | Mors Ultima | Death | 250,000 | 3.25× | 25% | Death spells execute <20% HP | +| 90 | Primordialis | Void | 400,000 | 4.0× | 30% | Void spells ignore 30% resistance | +| 100 | The Awakened One | Stellar | 1,000,000 | 5.0× | 35% | All spells +50% dmg, 25% faster | -### Guardian Boons +### Guardian Boons (on pact) -When a pact is signed, the guardian grants permanent boons: +| Boon Type | Effect | +|-----------|--------| +| `maxMana` | +Max raw mana | +| `manaRegen` | +Regen/hour | +| `castingSpeed` | +% cast speed | +| `elementalDamage` | +% element damage | +| `rawDamage` | +% all damage | +| `critChance` | +% crit chance | +| `critDamage` | +% crit multiplier | +| `insightGain` | +% insight | -| Boon Type | Effect | Example | -|-----------|--------|---------| -| `maxMana` | +Max raw mana | +50 to +500 | -| `manaRegen` | +Regen/hour | +0.5 to +2 | -| `castingSpeed` | +% cast speed | +5% | -| `elementalDamage` | +% element damage | +5% to +20% | -| `rawDamage` | +% all damage | +10% | -| `critChance` | +% crit chance | N/A | -| `critDamage` | +% crit multiplier | +15% | -| `insightGain` | +% insight | +10% to +25% | - -### Pact Ritual - -**Pact Costs:** -```javascript -pactCost: 500 to 150,000 (raw mana) -pactTime: 2 to 24 (hours for ritual) -``` - -**Victory Condition:** -- Defeat floor 100 guardian AND sign the pact -- Awards 3x normal insight +### Victory Condition +Defeat floor 100 guardian **and** sign the pact → 3× normal insight. --- ## Attunement System -### Overview - -Attunements are class-like specializations that grant unique capabilities and skill access. +Attunements are class-like specializations that unlock discipline pools and grant unique capabilities. ### The Three Attunements -#### 1. Enchanter (Right Hand) ✅ Fully Implemented +#### 1. Enchanter (Right Hand) ✅ | Property | Value | |----------|-------| @@ -428,18 +340,10 @@ Attunements are class-like specializations that grant unique capabilities and sk | **Conversion** | 0.2 raw→transference/hour | | **Unlock** | Starting attunement | -**Capabilities:** -- Enchanting equipment (see `crafting-actions/`) -- Disenchanting for mana recovery -- Access to enchanting skill tree (see `skill-evolution-modules/enchanting-skills.ts`) +**Disciplines Unlocked:** Enchanter discipline pool (`data/disciplines/enchanter.ts`) +**Capabilities:** Enchanting & disenchanting equipment -**Skill Categories Unlocked:** -- `enchant` - Enchanting efficiency -- `effectResearch` - Unlock enchantment effects - ---- - -#### 2. Invoker (Chest) ✅ IMPLEMENTED +#### 2. Invoker (Chest) ✅ | Property | Value | |----------|-------| @@ -449,21 +353,10 @@ Attunements are class-like specializations that grant unique capabilities and sk | **Conversion** | None | | **Unlock** | Defeat first guardian | -**Capabilities:** -- Form pacts with guardians -- Access guardian powers -- Elemental mastery through pacts -- Invocation skill tree (T1-T5 with perk choices at L5/L10) - see `skill-evolution-modules/invocation-skills.ts` -- Pact Mastery skill tree (T1-T5) -- Pact-Weaving hybrid skill (Invoker + Enchanter) - see `skill-evolution-modules/hybrid-skills.ts` +**Disciplines Unlocked:** Invoker discipline pool (`data/disciplines/invoker.ts`) +**Capabilities:** Form pacts with guardians, access guardian powers -**Skill Categories Unlocked:** -- `invocation` - ✅ Implemented (T1-T5 skill tree) -- `pact` - ✅ Implemented (T1-T5 skill tree) - ---- - -#### 3. Fabricator (Left Hand) ✅ Implemented +#### 3. Fabricator (Left Hand) ✅ | Property | Value | |----------|-------| @@ -473,216 +366,120 @@ Attunements are class-like specializations that grant unique capabilities and sk | **Conversion** | 0.25 raw→earth/hour | | **Unlock** | Prove crafting worth | -**Capabilities:** -- Golem crafting (see `data/golems/`) -- Gear crafting (see `data/equipment/`) -- Earth shaping - -**Skill Categories Unlocked:** -- `fabrication` - Crafting efficiency -- `golemancy` - Golem control +**Disciplines Unlocked:** Fabricator discipline pool (`data/disciplines/fabricator.ts`) +**Capabilities:** Golem crafting, gear crafting, Earth shaping ### Attunement Leveling -**XP Formula:** ```javascript Level 2: 1,000 XP Level 3: 2,500 XP Level 4: 5,000 XP Level 5: 10,000 XP -Each level: 2× previous (approximately) -Max Level: 10 -``` +// Each level ≈ 2× previous; Max Level: 10 -**Level Scaling:** -```javascript -regenMultiplier = 1.5^(level - 1) -conversionRate = baseRate × 1.5^(level - 1) +regenMultiplier = 1.5^(level - 1) +conversionRate = baseRate × 1.5^(level - 1) ``` -**XP Sources:** -- Enchanting: 1 XP per 10 capacity used - --- -## Skill System +## Discipline System -### Skill Categories +Disciplines replace the old skill system entirely. There are no discrete levels or study actions — disciplines grow **continuously** through practice. The player activates a discipline and it drains mana each tick in exchange for permanent stat growth. -| Category | Attunement | Description | Status | -|----------|------------|-------------|---------| -| `mana` | Core | Max mana, regen, element cap | ✅ Implemented | -| `study` | Core | Study speed, cost reduction | ✅ Implemented | -| `research` | Core | Click bonuses, advanced meditation | ✅ Implemented | -| `ascension` | Core | Insight, guardian damage | ✅ Implemented | -| `enchant` | Enchanter | Enchanting efficiency | ✅ Implemented (T1-T5) | -| `effectResearch` | Enchanter | Unlock enchantment effects | ✅ Implemented (max:1) | -| `invocation` | Invoker | Pact-based abilities | ✅ Implemented (T1-T5) | -| `pact` | Invoker | Guardian pact bonuses | ✅ Implemented (T1-T5) | -| `fabrication` | Fabricator | Crafting and construction | ✅ Implemented (T1-T5) | -| `golemancy` | Fabricator | Golem summoning and control | ✅ Implemented (T1-T5) | -| `craft` | Legacy | Basic crafting | ✅ Implemented | +### Core Concept -### Core Skills +> The more you practice a discipline, the stronger its effect — but the more mana it costs to maintain. -| Skill | Max | Effect | Study Time | -|-------|-----|--------|------------| -| Mana Well | 10 | +100 max mana/level | 4h | -| Mana Flow | 10 | +1 regen/level | 5h | -| Elemental Attunement | 10 | +50 element cap/level | 4h | -| Mana Overflow | 5 | +25% click mana/level | 6h | +- **XP** accumulates each tick the discipline is active and has enough mana to drain +- **Stat bonus** grows as a power curve of XP (never resets within a run) +- **Mana drain** also increases with XP — mastery has a cost +- **Perks** unlock at XP thresholds, granting bonus effects -**Prerequisites:** -- Mana Overflow: Mana Well 3 +### Disciplines vs Old Skills -### Skill Tier Evolution +| Old Skill System | Discipline System | +|-----------------|-------------------| +| Discrete levels (1–10 per tier) | Continuous XP accumulation | +| Mana cost paid once on study | Mana drained every tick | +| Required hours to level up | Grows passively while active | +| Milestone upgrades at L5/L10 | Perks unlock at XP thresholds | +| 5-tier evolution (T1–T5) | Single continuous curve per discipline | -**5-Tier System:** +### Formulas + +**Stat Bonus (continuous):** ``` -Tier 1: Base skill (multiplier ×1) -Tier 2: Enhanced (multiplier ×10) -Tier 3: Master (multiplier ×100) -Tier 4: Legendary (multiplier ×1,000) -Tier 5: Mythic (multiplier ×10,000) +StatBonus = baseValue × (XP / scalingFactor)^0.65 ``` -**Tier Up:** -- Requires max level (10) in current tier -- Unlocks new skill ID (e.g., `manaWell_t2`) +**Mana Drain Per Tick:** +``` +ManaDrainPerTick = drainBase × (1 + (XP / difficultyFactor)^0.4) +``` -### Milestone Upgrades +- `scalingFactor` controls how quickly stats grow +- `difficultyFactor` controls how quickly drain increases +- Higher `scalingFactor` → slower stat gain; higher `difficultyFactor` → slower drain increase -**At Level 5 and Level 10:** -- Choose 2 upgrades from 4+ options -- Upgrades can be stat multipliers, bonuses, or special effects -- Some upgrades have upgrade paths +### Concurrent Discipline Limit -**Example Mana Well Tier 1 Upgrades:** -| Level | Upgrade | Effect | -|-------|---------|--------| -| 5 | Expanded Capacity | +25% max mana | -| 5 | Natural Spring | +0.5 regen | -| 5 | Mana Threshold | +30% max, -10% regen | -| 10 | Deep Reservoir | +50% max (replaces Expanded) | -| 10 | Deep Wellspring | +50% meditation efficiency | +``` +concurrentLimit = 1 + floor(totalXP / 500) // capped at base + 3 +``` -### Enchanter Skills +Players start with 1 active discipline slot. As total XP across all disciplines grows, additional slots unlock (max 4 total). -| Skill | Max | Requirement | Effect | -|-------|-----|-------------|--------| -| Enchanting | 10 | Enchanter 1 | Unlocks enchantment design | -| Efficient Enchant | 5 | Enchanter 2, Enchanting 3 | -5% capacity cost/level | -| Disenchanting | 3 | Enchanter 1, Enchanting 2 | +20% mana recovery/level | -| Enchant Speed | 5 | Enchanter 1, Enchanting 2 | -10% time/level | -| Essence Refining | 1 | Enchanter 2, Enchanting 4 | +10% effect power | +### Perk Types -**Prerequisites:** -- Efficient Enchant: Enchanting 3 -- Disenchanting: Enchanting 2 -- Enchant Speed: Enchanting 2 -- Essence Refining: Enchanting 4 +| Type | Behaviour | +|------|-----------| +| `once` | Unlocks permanently when XP reaches `threshold` | +| `capped` | Grants stacking bonus tiers; each tier requires another `interval` XP beyond `threshold` | +| `infinite` | Repeating bonus — a new stack every `interval` XP past `threshold` (no cap) | -### Golemancy Skills +### Attunement Pools -| Skill | Max | Requirement | Effect | -|-------|-----|-------------|--------| -| Golem Mastery | 5 | Fabricator 2 | +10% golem damage/level | -| Golem Efficiency | 5 | Fabricator 2 | +5% attack speed/level | -| Golem Longevity | 3 | Fabricator 3 | +1 floor duration/level | -| Golem Siphon | 3 | Fabricator 3 | -10% maintenance/level | -| Advanced Golemancy | 1 | Fabricator 5, Mastery 3 | Unlock hybrid recipes | +| Pool | File | Requires | +|------|------|---------| +| Base | `data/disciplines/base.ts` | None (all attunements) | +| Enchanter | `data/disciplines/enchanter.ts` | Enchanter attunement | +| Invoker | `data/disciplines/invoker.ts` | Invoker attunement | +| Fabricator | `data/disciplines/fabricator.ts` | Fabricator attunement | ---- +### Example Disciplines -### Hybrid Skills +| Discipline | Attunement | Mana Type | Stat Bonus | Description | +|------------|------------|-----------|------------|-------------| +| Raw Mana Mastery | Base | Raw | `maxManaBonus` | More raw mana from practice | +| Elemental Attunement | Base | Fire | `elementCap_fire` | Expanded fire capacity | +| Lightning Surge | Invoker | Lightning | `lightningDamage` | Boosts lightning spell damage | +| Void Echo | Invoker | Void | `voidCastSpeed` | Increases void spell cast speed | +| Metalworking | Fabricator | Metal | `craftSpeed_metal` | Faster metal equipment crafting | +| Crystal Shaping | Fabricator | Crystal | `durability_crystal` | More durable crystal equipment | +| Soulforge | Enchanter | Light | `enchantPower` | Stronger enchantment effects | +| Mana Prism | Enchanter | Light | `manaReflect` | Prismatic mana focusing | -Hybrid Skills are advanced skills that require two attunements and combine their powers. +### Discipline Lifecycle -#### Pact-Weaving (Invoker + Enchanter) +``` +1. Player opens Disciplines tab → sees available disciplines for their attunements +2. Player activates discipline (costs nothing up-front; requires mana type unlocked) +3. Each game tick: + a. ManaDrain deducted from mana pool + b. If insufficient mana → discipline auto-pauses + c. If sufficient mana → disc.xp += 1; stat bonuses recomputed +4. Player can manually pause/resume disciplines +5. On loop end, XP resets (stat bonuses are per-run, not permanent) + — Prestige upgrades may eventually preserve some XP +``` -**Requirement:** Invoker 3 + Enchanter 3 -**Location:** `skill-evolution-modules/hybrid-skills.ts` +### Discipline UI -**Paths:** -- **Path A: The Weaver** - Enhanced enchantment power through pact bonuses -- **Path B: The Warp** - Unpredictable magic blending pacts and enchantments -- **Path C: The World-Weaver** - Ultimate hybrid combining all powers - -**Talent Tree (5 Tiers):** -| Tier | Effect | -|------|--------| -| 1 | +10% enchantment power when pact active | -| 2 | +25% enchantment power when pact active | -| 3 | Pact boons apply to enchanted equipment | -| 4 | +50% enchantment power when pact active | -| 5 | Elite Perk: World-Weaver (all pacts + enchants at max) | - -**Elite Perks (Choose at Tier 5):** -- **Eternal Weave:** Enchantments persist through loops -- **Pactbound Power:** All pact multipliers doubled for enchanted items -- **Weaver's Boon:** 25% chance to double enchantment effect - ---- - -#### Guardian Constructs (Fabricator + Invoker) - -**Requirement:** Fabricator 3 + Invoker 3 -**Location:** `skill-evolution-modules/hybrid-skills.ts` - -**Paths:** -- **Path A: The Architect** - Durable constructs with enhanced defenses -- **Path B: The Monumentalist** - Massive single construct with supreme power -- **Path C: The Eternal** - Constructs that never expire - -**Special Rules:** -- Only **1 active at a time** (replaces golems) -- **More durable** than golems (2x HP, 1.5x duration) -- Uses both Earth and Pact mana for summoning - -**Talent Tree (5 Tiers):** -| Tier | Effect | -|------|--------| -| 1 | +25% construct HP | -| 2 | Construct lasts +2 floors | -| 3 | Construct gains pact bonuses | -| 4 | +50% construct damage | -| 5 | Elite Perk: Eternal Construct | - -**Elite Perks (Choose at Tier 5):** -- **Living Monument:** Construct HP +500%, never expires -- **Guardian's Might:** Construct gains all pact multipliers -- **Architect's Dream:** Can have 2 constructs (reduces HP by 50% each) - ---- - -#### Enchanted Golemancy (Fabricator + Enchanter) - -**Requirement:** Fabricator 3 + Enchanter 3 -**Location:** `skill-evolution-modules/hybrid-skills.ts` - -**Paths:** -- **Path A: The Battle-Smith** - Combat-focused enchanted golems -- **Path B: The Enchanter-Smith** - Golems with powerful enchantments -- **Path C: The Spell-Smith** - Golems that cast elemental spells - -**Special Rules:** -- Imbues golems with **elemental spell logic** -- Golems gain spell abilities from enchantments -- Combines golem durability with spell power - -**Talent Tree (5 Tiers):** -| Tier | Effect | -|------|--------| -| 1 | Golems gain 1 spell slot | -| 2 | +25% golem spell damage | -| 3 | Golems gain 2 spell slots | -| 4 | +50% golem spell damage | -| 5 | Elite Perk: Spell-Smith | - -**Elite Perks (Choose at Tier 5):** -- **Arcane Golem:** Golems cast spells at 3x speed -- **Elemental Master:** Golem spells gain +100% elemental bonus -- **Living Spellforge:** Golems create temporary enchantments +`src/components/game/tabs/DisciplinesTab.tsx` +`src/lib/game/stores/discipline-slice.ts` — Zustand store (persisted) +`src/lib/game/effects/discipline-effects.ts` — integrates into `getUnifiedEffects()` --- @@ -703,70 +500,43 @@ accessory2 - Rings, Amulets ### Two-Handed Weapons -**Supported:** The game now supports **2-Handed Weapons** (e.g., Staves). - -**Mechanics:** -- 2-handed weapons occupy both the `mainHand` and `offHand` slots -- When a 2-handed weapon is equipped in `mainHand`, the `offHand` slot is **blocked** -- 2-handed weapons cannot be equipped to the `offHand` slot -- The UI displays a "2-Handed" badge on applicable items and shows "Blocked by 2-handed weapon" for blocked slots - -**Implementation:** -- Equipment types have a `twoHanded: true` property (see `data/equipment/`) -- `equipItem()` validates 2-handed weapon constraints (in `stores/gameStore.ts`) -- `isSlotBlocked()` function checks if offhand is blocked by main hand 2H weapon - -### Equipment Categories - -| Category | Slots | Description | -|----------|-------|-------------| -| Caster | Main Hand | Staves and wands for spellcasting | -| Sword | Main Hand | Magic swords with weapon enchants | -| Catalyst | Main Hand | Amplifies magical effects | -| Shield | Off Hand | Defensive equipment | -| Head/Body/Hands/Feet | Respective | Armor pieces | -| Accessory | Accessory1/2 | Rings and amulets | +2-handed weapons (Staves) occupy both `mainHand` and `offHand`. The offhand slot is **blocked** when a 2H weapon is equipped. The UI shows a "Blocked by 2-handed weapon" label on the offhand slot. ### Equipment Instance Structure ```typescript interface EquipmentInstance { - instanceId: string; // Unique ID - typeId: string; // Reference to EquipmentType (in data/equipment/) - name: string; - enchantments: AppliedEnchantment[]; - usedCapacity: number; // Current capacity used - totalCapacity: number; // Max capacity - rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary' | 'mythic'; - quality: number; // 0-100 + instanceId: string; + typeId: string; + name: string; + enchantments: AppliedEnchantment[]; + usedCapacity: number; + totalCapacity: number; + rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary' | 'mythic'; + quality: number; // 0–100 } ``` ### Enchantment Process (3 Stages) #### Stage 1: Design -- Create enchantment design -- Select effects from unlocked pool (see `data/enchantment-effects.ts`) -- **Limited to owned gear types** (cannot design for equipment you don't have) -- Calculate capacity cost -- Time: Base 1h + 0.5h per effect stack -- **Implementation:** `crafting-actions/design-actions.ts` +- Select effects from unlocked pool (`data/enchantment-effects.ts`) +- Limited to owned gear types +- Time: 1h base + 0.5h per effect stack +- Implemented in `crafting-actions/design-actions.ts` #### Stage 2: Prepare -- Prepare equipment for enchanting -- **Disabled for non-enchanted items** -- Mana cost: capacity × 10 -- Time: 2h + 1h per 50 capacity -- **Auto-transitions to Meditate** when complete -- **Implementation:** `crafting-actions/preparation-actions.ts` +- Mana cost: `capacity × 10` +- Time: `2h + 1h per 50 capacity` +- Auto-transitions to Meditate on complete +- Implemented in `crafting-actions/preparation-actions.ts` #### Stage 3: Apply -- Apply enchantment design -- Mana per hour: 20 + 5 per effect stack -- Time: 2h + 1h per effect stack +- Mana per hour: `20 + 5 per effect stack` +- Time: `2h + 1h per effect stack` - Grants Enchanter XP: 1 XP per 10 capacity -- **Auto-transitions to Meditate** when complete -- **Implementation:** `crafting-actions/application-actions.ts` +- Auto-transitions to Meditate on complete +- Implemented in `crafting-actions/application-actions.ts` ### Enchantment Effect Categories @@ -775,7 +545,7 @@ interface EquipmentInstance { | **Spell** | Grants spell ability | Casters only | | **Mana** | Max/regen/click bonuses | Casters, Catalysts, Head, Body, Accessories | | **Combat** | Damage, crit, speed | Casters, Hands | -| **Utility** | Study, meditation, insight | Most equipment | +| **Utility** | Meditation, insight | Most equipment | | **Special** | Unique effects | Various | | **Elemental** | Weapon enchantments | Swords, Casters | @@ -830,38 +600,11 @@ slots = floor(fabricatorLevel / 2) | Quicksilver Golem | Metal + Water | 8 | 4.0/h | 30% | Very fast | | Voidstone Golem | Earth + Void | 40 | 0.6/h | 60% | Ultimate | -### Golem Costs - -**Summon Cost (one-time per floor):** -``` -Earth Golem: 10 Earth -Steel Golem: 8 Metal + 5 Earth -Crystal Golem: 6 Crystal + 3 Earth -``` - -**Maintenance Cost (per tick):** -``` -Earth Golem: 0.5 Earth/hour -Steel Golem: 0.6 Metal + 0.2 Earth/hour -``` - -### Golem Duration - -``` -baseDuration = 1 floor -with Golem Longevity: +1 floor per level (max 4 floors) -``` - ### Golem Combat -**Attack Progress:** ``` progressPerTick = HOURS_PER_TICK × attackSpeed × efficiencyBonus -``` - -**Damage:** -``` -damage = baseDamage × (1 + golemMastery × 0.1) +damage = baseDamage × (1 + golemMasteryBonus) // bonus from discipline ``` --- @@ -878,8 +621,8 @@ damage = baseDamage × (1 + golemMastery × 0.1) ### Insight Formula ``` -baseInsight = floor(maxFloorReached × 15 + totalManaGathered / 500 + signedPacts.length × 150) -finalInsight = floor(baseInsight × (1 + insightAmpLevel × 0.25) × skillBonus) +baseInsight = floor(maxFloorReached × 15 + totalManaGathered / 500 + signedPacts.length × 150) +finalInsight = floor(baseInsight × (1 + insightAmpLevel × 0.25) × disciplineBonus) ``` ### Prestige Upgrades @@ -902,15 +645,15 @@ finalInsight = floor(baseInsight × (1 + insightAmpLevel × 0.25) × skillBonus) ### Memory System -- **Base slots:** 3 -- **Additional:** +1 per Deep Memory level -- **Memories:** Spells or skills preserved across loops +- **Base slots:** 3 +- **Additional:** +1 per Deep Memory prestige level +- **Memories:** Spells preserved across loops --- ## Achievement System -### Achievement Categories +### Categories | Category | Description | |----------|-------------| @@ -920,10 +663,10 @@ finalInsight = floor(baseInsight × (1 + insightAmpLevel × 0.25) × skillBonus) | `crafting` | Equipment and enchanting | | `prestige` | Loop and insight milestones | -### Achievement Rewards +### Reward Types -| Reward Type | Effect | -|-------------|--------| +| Reward | Effect | +|--------|--------| | `insight` | One-time insight bonus | | `manaBonus` | Permanent max mana | | `damageBonus` | Permanent damage increase | @@ -939,62 +682,41 @@ finalInsight = floor(baseInsight × (1 + insightAmpLevel × 0.25) × skillBonus) ```javascript function calcDamage(state, spellId, floorElement) { - const spell = SPELLS_DEF[spellId]; // Now in constants/spells.ts - - // Base damage - let damage = spell.dmg + (state.skills.combatTrain || 0) * 5; - - // Percentage multipliers - damage *= 1 + (state.skills.arcaneFury || 0) * 0.1; - - // Elemental mastery - damage *= 1 + (state.skills.elementalMastery || 0) * 0.15; - + const spell = SPELLS_DEF[spellId]; // constants/spells.ts + + // Base damage + discipline bonuses + let damage = spell.dmg + disciplineBonus('combatDamage'); + + // Discipline multiplier bonus + damage *= 1 + disciplineBonus('damagePct'); + // Guardian bane (vs guardians only) if (isGuardian) { - damage *= 1 + (state.skills.guardianBane || 0) * 0.2; + damage *= 1 + disciplineBonus('guardianBane'); } - + // Pact multiplier - damage *= state.signedPacts.reduce((m, f) => m * GUARDIANS[f].pact, 1); // GUARDIANS in constants/guardians.ts - + damage *= state.signedPacts.reduce((m, f) => m * GUARDIANS[f].pact, 1); + // Elemental effectiveness damage *= getElementalBonus(spell.elem, floorElement); - - // Critical hit - const critChance = (state.skills.precision || 0) * 0.05; - if (Math.random() < critChance) { - damage *= 1.5; - } - + + // Critical hit (from discipline crit bonus) + const critChance = disciplineBonus('critChance'); + if (Math.random() < critChance) damage *= 1.5; + // Equipment effects damage *= effects.baseDamageMultiplier; damage += effects.baseDamageBonus; - + // Armor reduction const effectiveArmor = Math.max(0, enemyArmor - armorPierce); damage *= (1 - effectiveArmor); - + return Math.floor(damage); } ``` -### Study Time Calculation - -```javascript -effectiveStudyTime = baseStudyTime × tier / studySpeedMultiplier - -studySpeedMultiplier = 1 + (quickLearnerLevel × 0.1) + equipmentBonus -``` - -### Study Cost Calculation - -```javascript -effectiveCost = floor(baseCost × (currentLevel + 1) × tier × costMultiplier) - -costMultiplier = 1 - (focusedMindLevel × 0.05) -``` - ### DPS Calculation ```javascript @@ -1012,31 +734,31 @@ dps = (damage × castSpeed × attackSpeedMultiplier) / hour │ CORE SYSTEM INTERACTIONS │ ├─────────────────────────────────────────────────────────────────────────┤ │ │ -│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ -│ │ MANA │────────▶│ SKILLS │────────▶│ COMBAT │ │ -│ └──────────┘ └──────────┘ └──────────┘ │ -│ │ │ │ │ -│ │ │ │ │ -│ ▼ ▼ ▼ │ -│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ -│ │ATTUNEMENT│────────▶│ENCHANTING│────────▶│ SPIRE │ │ -│ └──────────┘ └──────────┘ └──────────┘ │ -│ │ │ │ │ -│ │ │ │ │ -│ ▼ ▼ ▼ │ -│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ -│ │GOLEMANCY │ │EQUIPMENT │────────▶│ GUARDIAN │ │ -│ └──────────┘ └──────────┘ └──────────┘ │ -│ │ │ -│ ▼ │ -│ ┌──────────┐ │ -│ │ PACT │ │ -│ └──────────┘ │ -│ │ │ -│ ▼ │ -│ ┌──────────┐ │ -│ │ PRESTIGE │ │ -│ └──────────┘ │ +│ ┌──────────┐ ┌────────────┐ ┌──────────┐ │ +│ │ MANA │───────▶│ DISCIPLINES│───────▶│ COMBAT │ │ +│ └──────────┘ └────────────┘ └──────────┘ │ +│ │ │ │ │ +│ │ │ │ │ +│ ▼ ▼ ▼ │ +│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ +│ │ATTUNEMENT│───────▶│ENCHANTING│────────▶│ SPIRE │ │ +│ └──────────┘ └──────────┘ └──────────┘ │ +│ │ │ │ │ +│ │ │ │ │ +│ ▼ ▼ ▼ │ +│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ +│ │GOLEMANCY │ │EQUIPMENT │────────▶│ GUARDIAN │ │ +│ └──────────┘ └──────────┘ └──────────┘ │ +│ │ │ +│ ▼ │ +│ ┌──────────┐ │ +│ │ PACT │ │ +│ └──────────┘ │ +│ │ │ +│ ▼ │ +│ ┌──────────┐ │ +│ │ PRESTIGE │ │ +│ └──────────┘ │ └─────────────────────────────────────────────────────────────────────────┘ ``` @@ -1044,8 +766,8 @@ dps = (damage × castSpeed × attackSpeedMultiplier) / hour | System | Depends On | Unlocks/Enables | |--------|------------|-----------------| -| **Skills** | Mana (cost) | All combat/crafting bonuses | -| **Enchanting** | Enchanter attunement, Skills | Equipment spells, bonuses | +| **Disciplines** | Mana (drain cost), Attunement (pool access) | All combat/crafting stat bonuses | +| **Enchanting** | Enchanter attunement, Enchanter disciplines | Equipment spells, bonuses | | **Golemancy** | Fabricator attunement, Earth mana | Additional combat damage | | **Pacts** | Guardian defeat | Permanent multipliers, boons | | **Prestige** | Loop completion | Permanent upgrades, memories | @@ -1053,27 +775,10 @@ dps = (damage × castSpeed × attackSpeedMultiplier) / hour ### Progression Gates -1. **Early Game (Floors 1-10):** - - Mana gathering and regen - - Basic skills (mana, study categories) - - Starting equipment - -2. **Mid Game (Floors 10-40):** - - First guardian pacts - - Attunement unlocking - - Equipment enchanting - - Golemancy (Fabricator) - -3. **Late Game (Floors 40-80):** - - Compound/exotic elements - - Hybrid golems - - Skill tier evolution - - Advanced enchantments - -4. **End Game (Floors 80-100):** - - Void/Stellar/Crystal spells - - Ultimate golems - - Victory preparation +1. **Early Game (Floors 1–10):** Mana gathering and regen, base disciplines, starting equipment +2. **Mid Game (Floors 10–40):** First guardian pacts, attunement unlocking, attunement discipline pools, equipment enchanting, Golemancy +3. **Late Game (Floors 40–80):** Compound/exotic elements, hybrid golems, advanced discipline perks, advanced enchantments +4. **End Game (Floors 80–100):** Void/Stellar/Crystal spells, ultimate golems, victory preparation --- @@ -1081,97 +786,62 @@ dps = (damage × castSpeed × attackSpeedMultiplier) / hour ### Modular Structure Overview -The codebase has been refactored into a modular architecture for better maintainability: - #### Store Architecture -**New Modular Stores (`src/lib/game/stores/`):** -- **gameStore.ts**: Core state, tick logic, and main actions -- **manaStore.ts**: Mana gathering, elements, conversion -- **combatStore.ts**: Combat system, spells, floor progression -- **prestigeStore.ts**: Prestige/loop system, insight, upgrades -- **skillStore.ts**: Skill state, studying, evolution -- **uiStore.ts**: UI state, modals, debug settings +**Active Stores (`src/lib/game/stores/`):** +- **gameStore.ts** — Core state, tick logic, main actions +- **manaStore.ts** — Mana gathering, elements, conversion +- **combatStore.ts** — Combat system, spells, floor progression +- **prestigeStore.ts** — Prestige/loop system, insight, upgrades +- **discipline-slice.ts** — Discipline activation, XP ticking, perk evaluation +- **uiStore.ts** — UI state, modals, debug settings **Legacy Store (Migration in Progress):** -- **store.ts**: Legacy monolithic store (reduced from ~2812 lines to ~14KB) -- **store/**: Legacy store slices being migrated to `stores/` - - `combatSlice.ts`, `manaSlice.ts`, `skillSlice.ts`, etc. - - `computed.ts`: Computed stats utilities -- **store-modules/**: Legacy store utilities - - `computed-stats.ts`, `initial-state.ts`, `tick-logic.ts`, etc. +- **store.ts** — Legacy monolithic store (reduced) +- **store/** — Legacy store slices being migrated to `stores/` +- **store-modules/** — Legacy store utilities + +#### Discipline System (`src/lib/game/`) +- `data/disciplines/` — Per-attunement discipline definitions +- `types/disciplines.ts` — `DisciplineDefinition`, `DisciplineState`, perk types +- `utils/discipline-math.ts` — `calculateStatBonus`, `calculateManaDrain`, perk helpers +- `effects/discipline-effects.ts` — `computeDisciplineEffects()` → feeds `getUnifiedEffects()` +- `stores/discipline-slice.ts` — Zustand store for active discipline state #### Crafting System (`src/lib/game/crafting-actions/`) - Modular action files for each crafting stage - Design, preparation, application, equipment, disenchant actions -- See `crafting-actions/index.ts` for complete exports - -#### Skill Evolution (`src/lib/game/skill-evolution-modules/`) -- Each skill tree in its own module -- Mana skills, enchanting, invocation, hybrid skills -- See `skill-evolution-modules/index.ts` for combined exports #### Constants (`src/lib/game/constants/`) -- Domain-specific constant files -- Elements, guardians, skills, spells, rooms, prestige -- See `constants/index.ts` for barrel exports +- Domain-specific constant files: elements, guardians, spells, rooms, prestige +- Barrel exports via `constants/index.ts` #### Game Data (`src/lib/game/data/`) -- Enchantment effects, equipment types, golems -- Achievements, crafting recipes, loot tables +- Enchantment effects, equipment types, golems, disciplines, achievements, loot tables - Organized by domain for easy navigation ### File Size Guidelines -All files are kept under **400 lines** (enforced by pre-commit hook): -- Easier for AI agents to read and understand -- Better code organization and maintainability -- Faster linting and testing +All files kept under **400 lines** (enforced by pre-commit hook). --- -## Appendix: Known Issues +## Appendix: Removed Systems -### Task 2 Updates (Completed) +The following systems no longer exist and should not be re-introduced: -The following issues/enhancements were completed in Task 2: - -1. **Combat UI Casting Bar** - Fixed progress animation -2. **Mana Well Bug** - Fixed Deep Basin perk (+20% Max Mana, was incorrectly 0.20 instead of 1.20) -3. **LootTab** - Removed Transference from essence list (it's a utility element, not a loot drop) -4. **Ascension Skills** - Deleted from the game (were unused/game design change) -5. **Show Component Names** - Fixed debug option to properly display component names in UI -6. **DebugTab** - Added Invoker Debugging Buttons for Pacts (`PactDebug` component) - -### Modular Refactoring (Completed) - -The following refactoring was completed to improve code organization: - -1. **Store Modularization** - Split `store.ts` (~2812 lines) into `stores/` with 6 focused modules -2. **Crafting Actions** - Split `crafting-slice.ts` (~1100 lines) into `crafting-actions/` with 7 modules -3. **Skill Evolution** - Split `skill-evolution.ts` (~3400 lines) into `skill-evolution-modules/` with 15+ modules -4. **Constants** - Split `constants.ts` into `constants/` with 8+ domain-specific modules -5. **Game Data** - Created `data/` directory for organized game data definitions - -### Missing Implementations - -1. **Field Repair** - Skill exists, no repair system - -### Removed Content - -1. **Scroll Crafting** - Removed (violates NO INSTANT FINISHING pillar) -2. **Temporal Memory** - Removed (replaced by better mechanics) -3. **Ascension Skills** - Deleted (Task 2) -4. **Transference from LootTab** - Removed (Task 2, not a lootable essence) - -### Balance Concerns - -1. Exotic elements require extreme mana investment -2. Incursion creates hard time pressure without counterplay -3. Equipment progression limited after starting gear +| Removed | Replacement | +|---------|-------------| +| Skill System (study, tiers T1–T5, milestone upgrades) | Discipline System | +| `skillStore.ts` | `discipline-slice.ts` | +| `skill-evolution-modules/` | `data/disciplines/` + `discipline-math.ts` | +| `docs/skills.md` | This document (Discipline System section) | +| `docs/strategy/` | Fully implemented; folder removed | +| Ascension skills | Deleted (no replacement) | +| Scroll crafting | Deleted (violates no-instant-finishing pillar) | +| Lifesteal/healing | Banned permanently | --- -*Document Version: 1.2 (Updated after Modular Refactoring)* -*Game mechanics unchanged - only code organization improved* -*End of Game Briefing Document* +*Document Version: 2.0 — Disciplines Refactor* +*End of Game Briefing Document* \ No newline at end of file diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index e05f972..b814315 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,5 +1,5 @@ # Circular Dependencies -Generated: 2026-05-18T08:24:36.648Z +Generated: 2026-05-18T08:33:19.846Z Found: 7 circular chain(s) — these MUST be fixed before modifying involved files. 1. Processed 151 files (1.4s) (37 warnings) diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index 503c2ec..1bbc527 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,6 +1,6 @@ { "_meta": { - "generated": "2026-05-18T08:24:35.073Z", + "generated": "2026-05-18T08:33:18.234Z", "description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.", "usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry." }, diff --git a/docs/project-structure.txt b/docs/project-structure.txt index cc82175..78e739d 100644 --- a/docs/project-structure.txt +++ b/docs/project-structure.txt @@ -15,8 +15,7 @@ Mana-Loop/ │ ├── GAME_BRIEFING.md │ ├── circular-deps.txt │ ├── dependency-graph.json -│ ├── project-structure.txt -│ └── skills.md +│ └── project-structure.txt ├── e2e/ │ ├── combat.spec.ts │ ├── enchanting.spec.ts diff --git a/docs/skills.md b/docs/skills.md deleted file mode 100644 index 140a15a..0000000 --- a/docs/skills.md +++ /dev/null @@ -1,726 +0,0 @@ -# Mana Loop - Complete Skill System Documentation - -## Table of Contents -1. [Overview](#overview) -2. [Core Mechanics](#core-mechanics) -3. [Skill Categories](#skill-categories) -4. [All Skills Reference](#all-skills-reference) -5. [Upgrade Trees](#upgrade-trees) -6. [Tier System](#tier-system) -7. [Banned Content](#banned-content) -8. [Code Architecture](#code-architecture) - ---- - -## Overview - -The skill system in Mana Loop provides deep character customization through a branching upgrade tree system. Skills are organized by attunement, with each attunement granting access to specific skill categories. - -### Skill Level Types - -| Max Level | Description | Example Skills | -|-----------|-------------|----------------| -| 10 | Standard skills with full upgrade trees | Mana Well, Mana Flow, Enchanting | -| 5 | Specialized skills with limited upgrades | Efficient Enchant, Golem Mastery | -| 3 | Focused skills with no upgrades | Knowledge Retention, Golem Longevity | -| 1 | Effect research skills (unlock only) | All research skills | - ---- - -## Core Mechanics - -### Study System - -Leveling skills requires: -1. **Mana cost** - Paid upfront to begin study -2. **Study time** - Hours required to complete -3. **Active studying** - Must be in "study" action mode - -#### Study Cost Formula -``` -cost = baseCost × (currentLevel + 1) × tier × costMultiplier -``` - -#### Study Time Formula -``` -time = baseStudyTime × tier / studySpeedMultiplier -``` - -### Milestone Upgrades - -At **levels 5 and 10**, you choose **1 upgrade** from an upgrade tree: -- Each skill has its own unique upgrade tree -- Trees have branching paths with prerequisites -- Choices are permanent for that tier -- Upgrades persist when tiering up - ---- - -## Skill Categories - -### Core Categories (No Attunement Required) - -| Category | Icon | Description | -|----------|------|-------------| -| Mana | 💧 | Mana pool and regeneration | -| Study | 📚 | Learning speed and efficiency | -| Research | 🔮 | Permanent bonuses | - -### Attunement Categories - -| Category | Icon | Attunement | Description | Status | -|----------|------|------------|-------------|---------| -| Enchanting | ✨ | Enchanter | Enchantment design and efficiency | ✅ Implemented (T1-T5) | -| Effect Research | 🔬 | Enchanter | Unlock spell enchantments | ✅ Implemented (max:1) | -| Invocation | 💜 | Invoker | Pact-based abilities | ✅ Implemented (T1-T5) | -| Pact Mastery | 🤝 | Invoker | Guardian pact bonuses | ✅ Implemented (T1-T5) | -| Fabrication | ⚒️ | Fabricator | Crafting and construction | ✅ Implemented (T1-T5) | -| Golemancy | 🗿 | Fabricator | Golem summoning and control | ✅ Implemented (T1-T5) | -| Hybrid Skills | 🔮 | Dual Attunement | Cross-attunement powers | ✅ Implemented (T1-T5) | - ---- - -## All Skills Reference - -### Mana Skills (Core) - -| Skill | Max | Effect | Base Cost | Study Time | -|-------|-----|--------|-----------|------------| -| Mana Well | 10 | +100 max mana/level | 100 | 4h | -| Mana Flow | 10 | +1 regen/hour/level | 150 | 5h | -| Elemental Attunement | 10 | +50 element cap/level | 200 | 4h | -| Mana Overflow | 5 | +25% click mana/level | 400 | 6h | - -**Prerequisites:** -- Mana Overflow: Mana Well 3 - -### Study Skills (Core) - -| Skill | Max | Effect | Base Cost | Study Time | -|-------|-----|--------|-----------|------------| -| Quick Learner | 10 | +10% study speed/level | 250 | 4h | -| Focused Mind | 10 | -5% study cost/level | 300 | 5h | -| Meditation Focus | 1 | Up to 2.5x regen after 4hrs | 400 | 6h | -| Knowledge Retention | 3 | +20% progress saved on cancel/level | 350 | 5h | - -### Research Skills (Core) - -| Skill | Max | Effect | Base Cost | Study Time | -|-------|-----|--------|-----------|------------| -| Mana Tap | 1 | +1 mana/click | 300 | 12h | -| Mana Surge | 1 | +3 mana/click | 800 | 36h | -| Mana Spring | 1 | +2 mana regen | 600 | 24h | -| Deep Trance | 1 | 6hr meditation = 3x regen | 900 | 48h | -| Void Meditation | 1 | 8hr meditation = 5x regen | 1500 | 72h | - -**Prerequisites:** -- Mana Surge: Mana Tap 1 -- Deep Trance: Meditation 1 -- Void Meditation: Deep Trance 1 - -### Enchanting Skills (Enchanter) - -| Skill | Max | Effect | Base Cost | Study Time | Attunement Req | -|-------|-----|--------|-----------|------------|----------------| -| Enchanting | 10 | Unlocks enchantment design | 200 | 5h | Enchanter 1 | -| Efficient Enchant | 5 | -5% capacity cost/level | 350 | 6h | Enchanter 2 | -| Disenchanting | 3 | +20% mana recovery/level | 400 | 6h | Enchanter 1 | -| Enchant Speed | 5 | -10% enchant time/level | 300 | 4h | Enchanter 1 | -| Essence Refining | 1 | +10% effect power | 450 | 7h | Enchanter 2 | - -**Prerequisites:** -- Efficient Enchant: Enchanting 3 -- Disenchanting: Enchanting 2 -- Enchant Speed: Enchanting 2 -- Essence Refining: Enchanting 4 - -### Golemancy Skills (Fabricator) - -| Skill | Max | Effect | Base Cost | Study Time | Attunement Req | -|-------|-----|--------|-----------|------------|----------------| -| Golem Mastery | 5 | +10% golem damage/level | 300 | 6h | Fabricator 2 | -| Golem Efficiency | 5 | +5% attack speed/level | 350 | 6h | Fabricator 2 | -| Golem Longevity | 3 | +1 floor duration/level | 500 | 8h | Fabricator 3 | -| Golem Siphon | 3 | -10% maintenance/level | 400 | 8h | Fabricator 3 | -| Advanced Golemancy | 1 | Unlock hybrid recipes | 800 | 16h | Fabricator 5 | -| Golem Resonance | 1 | +1 golem slot | 1200 | 24h | Fabricator 8 | - -**Prerequisites:** -- Advanced Golemancy: Golem Mastery 3 -- Golem Resonance: Golem Mastery 5 - ---- - -## Hybrid Skills - -Hybrid Skills require two attunements and combine their powers into advanced abilities. - -**Code Location:** All hybrid skills are defined in `src/lib/game/skill-evolution-modules/hybrid-skills.ts` - -### Pact-Weaving (Invoker + Enchanter) - -**Requirement:** Invoker 3 + Enchanter 3 -**Max Level:** 5 (with Elite Perk at Level 5) -**Location:** `skill-evolution-modules/hybrid-skills.ts` - -**Paths:** -- **Path A: The Weaver** - Enhanced enchantment power through pact bonuses -- **Path B: The Warp** - Unpredictable magic blending pacts and enchantments -- **Path C: The World-Weaver** - Ultimate hybrid combining all powers - -**5-Tier Talent Tree:** - -| Tier | Level | Effect | -|------|-------|--------| -| 1 | 1-2 | +10% enchantment power when pact active | -| 2 | 3-4 | +25% enchantment power when pact active | -| 3 | 5-6 | Pact boons apply to enchanted equipment | -| 4 | 7-8 | +50% enchantment power when pact active | -| 5 | 9-10 | Elite Perk: Choose one | - -**Elite Perks (Choose at Tier 5 Level 10):** -- **Eternal Weave:** Enchantments persist through loops -- **Pactbound Power:** All pact multipliers doubled for enchanted items -- **Weaver's Boon:** 25% chance to double enchantment effect - -**Level 5 Upgrade Choices:** -- +50% enchantment power when pact active -- Pact boons apply to all equipment slots -- 10% chance to trigger pact effect on enchant - -**Level 10 Upgrade Choices:** -- Elite Perk (choose one from above) -- +100% enchantment power when pact active -- All pacts active simultaneously - ---- - -### Guardian Constructs (Fabricator + Invoker) - -**Requirement:** Fabricator 3 + Invoker 3 -**Max Level:** 5 (with Elite Perk at Level 5) -**Location:** `skill-evolution-modules/hybrid-skills.ts` - -**Paths:** -- **Path A: The Architect** - Durable constructs with enhanced defenses -- **Path B: The Monumentalist** - Massive single construct with supreme power -- **Path C: The Eternal** - Constructs that never expire - -**Special Rules:** -- Only **1 active at a time** (replaces golems) -- **More durable** than golems (2x HP, 1.5x duration) -- Uses both Earth and Pact mana for summoning - -**5-Tier Talent Tree:** - -| Tier | Level | Effect | -|------|-------|--------| -| 1 | 1-2 | +25% construct HP | -| 2 | 3-4 | Construct lasts +2 floors | -| 3 | 5-6 | Construct gains pact bonuses | -| 4 | 7-8 | +50% construct damage | -| 5 | 9-10 | Elite Perk: Choose one | - -**Elite Perks (Choose at Tier 5 Level 10):** -- **Living Monument:** Construct HP +500%, never expires -- **Guardian's Might:** Construct gains all pact multipliers -- **Architect's Dream:** Can have 2 constructs (reduces HP by 50% each) - -**Level 5 Upgrade Choices:** -- +50% construct HP -- Construct immune to floor effects -- +25% construct damage - -**Level 10 Upgrade Choices:** -- Elite Perk (choose one from above) -- Construct gains 100% of your pact multipliers -- +500% construct HP - ---- - -### Enchanted Golemancy (Fabricator + Enchanter) - -**Requirement:** Fabricator 3 + Enchanter 3 -**Max Level:** 5 (with Elite Perk at Level 5) -**Location:** `skill-evolution-modules/hybrid-skills.ts` - -**Paths:** -- **Path A: The Battle-Smith** - Combat-focused enchanted golems -- **Path B: The Enchanter-Smith** - Golems with powerful enchantments -- **Path C: The Spell-Smith** - Golems that cast elemental spells - -**Special Rules:** -- Imbues golems with **elemental spell logic** -- Golems gain spell abilities from enchantments -- Combines golem durability with spell power - -**5-Tier Talent Tree:** - -| Tier | Level | Effect | -|------|-------|--------| -| 1 | 1-2 | Golems gain 1 spell slot | -| 2 | 3-4 | +25% golem spell damage | -| 3 | 5-6 | Golems gain 2 spell slots | -| 4 | 7-8 | +50% golem spell damage | -| 5 | 9-10 | Elite Perk: Choose one | - -**Elite Perks (Choose at Tier 5 Level 10):** -- **Arcane Golem:** Golems cast spells at 3x speed -- **Elemental Master:** Golem spells gain +100% elemental bonus -- **Living Spellforge:** Golems create temporary enchantments - -**Level 5 Upgrade Choices:** -- +50% golem spell damage -- Golems gain 3 spell slots -- Golem spells gain pact bonuses - -**Level 10 Upgrade Choices:** -- Elite Perk (choose one from above) -- Golem spells deal +200% damage -- Golems permanently enchanted - ---- - -### Effect Research Skills (Enchanter) - -All effect research skills are **max level 1** and unlock specific enchantment effects. - -**Code Location:** Skill definitions in `src/lib/game/constants/skills.ts`, research logic in `src/lib/game/skill-evolution-modules/enchanting-skills.ts` - -#### Tier1 Research (Basic Spells) -| Skill | Unlocks | Study Time | -|-------|---------|------------| -| Mana Spell Research | Mana Strike enchantment | 4h | -| Fire Spell Research | Ember Shot, Fireball | 6h | -| Water Spell Research | Water Jet, Ice Shard | 6h | -| Air Spell Research | Gust, Wind Slash | 6h | -| Earth Spell Research | Stone Bullet, Rock Spike | 6h | -| Light Spell Research | Light Lance, Radiance | 8h | -| Dark Spell Research | Shadow Bolt, Dark Pulse | 8h | -| Death Research | Drain enchantment | 8h | - -#### Tier2 Research (Advanced Spells) -Requires Enchanter 3+ and parent element research. - -| Skill | Unlocks | Study Time | -|-------|---------|------------| -| Advanced Fire Research | Inferno, Flame Wave | 12h | -| Advanced Water Research | Tidal Wave, Ice Storm | 12h | -| Advanced Air Research | Hurricane, Wind Blade | 12h | -| Advanced Earth Research | Earthquake, Stone Barrage | 12h | -| Advanced Light Research | Solar Flare, Divine Smite | 14h | -| Advanced Dark Research | Void Rift, Shadow Storm | 14h | - -#### Tier3 Research (Master Spells) -Requires Enchanter 5+ and advanced research. - -| Skill | Unlocks | Study Time | -|-------|---------|------------| -| Master Fire Research | Pyroclasm | 24h | -| Master Water Research | Tsunami | 24h | -| Master Earth Research | Meteor Strike | 26h | - -#### Compound Element Research -Requires parent element research + Enchanter 3+. - -| Skill | Unlocks | Study Time | -|-------|---------|------------| -| Metal Spell Research | Metal Shard, Iron Fist | 6h | -| Sand Spell Research | Sand Blast, Sandstorm | 6h | -| Lightning Spell Research | Spark, Lightning Bolt | 6h | -| Advanced Metal Research | Steel Tempest | 12h | -| Advanced Sand Research | Desert Wind | 12h | -| Advanced Lightning Research | Chain Lightning, Storm Call | 12h | -| Master Metal Research | Furnace Blast | 26h | -| Master Sand Research | Dune Collapse | 26h | -| Master Lightning Research | Thunder Strike | 26h | - -#### Utility Research - -| Skill | Unlocks | Study Time | -|-------|---------|------------| -| Transference Spell Research | Transfer Strike, Mana Rip | 5h | -| Advanced Transference Research | Essence Drain | 12h | -| Master Transference Research | Soul Transfer | 26h | - -#### Effect Research - -| Skill | Unlocks | Study Time | -|-------|---------|------------| -| Damage Effect Research | Minor/Moderate Power, Amplification | 5h | -| Combat Effect Research | Sharp Edge, Swift Casting | 6h | -| Mana Effect Research | Mana Reserve, Trickle, Mana Tap | 4h | -| Advanced Mana Research | Mana Reservoir, Stream, River | 8h | -| Utility Effect Research | Meditative Focus, Quick Study | 6h | -| Special Effect Research | Echo Chamber, Siphoning, Bane | 10h | -| Overpower Research | Overpower effect | 12h | - ---- - -## Upgrade Trees - -**Code Location:** All upgrade trees are defined in `src/lib/game/skill-evolution-modules/`: -- `mana-well-flow.ts` - Mana Well and Mana Flow upgrades -- `enchanting-skills.ts` - Enchanting skill upgrades -- `quick-learner.ts` - Quick Learner upgrades -- `focused-mind.ts` - Focused Mind upgrades -- And more... - -### Mana Well Upgrade Tree - -#### Tier1 Upgrades - -**Level 5 Choices:** -``` -├── Expanded Capacity (+25% max mana) -│ └── Level 10: Deep Reservoir (+50% max mana) [replaces] -│ -├── Natural Spring (+0.5 regen/hour) -│ └── Level 10: Flowing Spring (+1.5 regen) [replaces] -│ -├── Mana Threshold (+30% max mana, -10% regen) -│ └── Level 10: Mana Conversion (5% max → click bonus) -│ -└── Desperate Wells (+50% regen when below 25% mana) - └── Level 10: Panic Reserve (+100% regen below 10%) -``` - -**Level 10 Additional Choices:** -- Mana Echo (10% chance double mana from clicks) -- Emergency Reserve (Keep 10% mana on loop reset) -- Deep Wellspring (+50% meditation efficiency) - -#### Tier2 Upgrades (Deep Reservoir) -- Abyssal Depth (+50% max mana) -- Ancient Well (+500 starting mana per loop) -- Mana Condense (+1% max per 1000 gathered) -- Deep Reserve (+0.5 regen per 100 max mana) -- Ocean of Mana (+1000 max mana) -- Mana Tide (Regen pulses ±50%) -- Void Storage (Store 150% max temporarily) -- Mana Core (0.5% max mana as regen) - ---- - -### Mana Flow Upgrade Tree - -#### Tier1 Upgrades - -**Level 5 Choices:** -``` -├── Rapid Flow (+25% regen speed) -│ └── Level 10: Mana Torrent (+50% regen above 75% mana) -│ -├── Steady Stream (Immune to incursion penalty) -│ └── Level 10: Eternal Flow (Immune to all penalties) -│ -├── Mana Cascade (+0.1 regen per 100 max mana) -│ └── Level 10: Mana Waterfall (+0.25 per 100 max) [replaces] -│ -└── Mana Overflow (Raw mana can exceed max by 20%) -``` - -**Level 10 Additional Choices:** -- Ambient Absorption (+1 permanent regen) -- Flow Surge (Clicks boost regen for 1 hour) -- Flow Mastery (+10% mana from all sources) - ---- - -### Elemental Attunement Upgrade Tree - -#### Tier1 Upgrades - -**Level 5 Choices:** -``` -├── Expanded Attunement (+25% element cap) -│ └── Level 10: Element Master (+50% element cap) [replaces] -│ -├── Elemental Surge (+15% elemental spell damage) -│ └── Level 10: Elemental Power (+30% damage) [replaces] -│ -└── Elemental Affinity (New elements start with 10 capacity) -``` - -**Level 10 Additional Choices:** -- Elemental Resonance (Spell use restores element) -- Exotic Mastery (+20% exotic element damage) - ---- - -### Quick Learner Upgrade Tree - -#### Tier1 Upgrades - -**Level 5 Choices:** -``` -├── Deep Focus (+25% study speed) -│ └── Level 10: Deep Concentration (+50% speed) [replaces] -│ -├── Quick Grasp (5% chance double study progress) -│ └── Level 10: Knowledge Echo (15% instant complete) -│ -├── Parallel Study (Study 2 things at 50% speed each) -│ -└── Quick Mastery (-20% time for final 3 levels) -``` - -**Level 10 Additional Choices:** -- Study Momentum (+5% speed per hour, max 50%) -- Knowledge Transfer (New skills start at 10% progress) - ---- - -### Focused Mind Upgrade Tree - -#### Tier1 Upgrades - -**Level 5 Choices:** -``` -├── Mind Efficiency (+25% cost reduction) -│ └── Level 10: Efficient Learning (-15% study cost) [replaces] -│ -├── Mental Clarity (+10% speed when mana > 75%) -│ └── Level 10: Study Rush (First hour 2x speed) -│ -└── Study Refund (25% mana back on completion) - └── Level 10: Deep Understanding (+10% skill bonuses) -``` - -**Level 10 Additional Choices:** -- Chain Study (-5% cost per maxed skill) - ---- - -### Enchanting Upgrade Tree - -#### Tier1 Upgrades - -**Level 5 Choices:** -``` -├── Enchantment Capacity (+20% equipment capacity) -├── Swift Enchanting (-15% design time) -│ -└── Quality Control (+10% effect power) - └── Level 10: Perfect Refinement (+25% power) [replaces] -``` - -**Level 10 Additional Choices:** -- Enchantment Mastery (2 designs in progress) -- Mana Preservation (25% chance free enchant) - ---- - -### Golem Mastery Upgrade Tree - -#### Tier1 Upgrades - -**Level 5 Choices:** -``` -├── Golem Power (+25% golem damage) -├── Golem Durability (+1 floor duration) -│ -└── Efficient Summons (-20% summon cost) - └── Level 10: Golem Siphon (-30% maintenance) -``` - -**Level 10 Additional Choices:** -- Golem Fury (+50% attack speed for first 2 floors) -- Golem Resonance (Golems share 10% damage) - ---- - -### Other Skill Upgrade Trees - -#### Mana Overflow (Max 5) -- **Level 5:** Click Surge (+50% click mana above 90% mana) -- **Tier 2 Level 5:** Mana Flood (+75% click mana above 75% mana) - -#### Efficient Enchant (Max 5) -- **Level 5:** Thrifty Enchanter (+10% free enchant chance) -- **Tier 2 Level 5:** Optimized Enchanting (+25% free chance) - -#### Enchant Speed (Max 5) -- **Level 5:** Hasty Enchanter (+25% speed for repeat designs) -- **Tier 2 Level 5:** Instant Designs (10% instant completion) - -#### Essence Refining (Max 1) -- Research skill (max level 1, no upgrades) - -#### Efficient Crafting (Max 5) -- **Level 5:** Batch Crafting (2 items at 75% speed each) -- **Tier 2 Level 5:** Mass Production (3 items at full speed) - -#### Field Repair (Max 5) -- **Level 5:** Scavenge (Recover 10% materials from broken items) -- **Tier 2 Level 5:** Reclaim (Recover 25% materials) - -#### Golem Efficiency (Max 5) -- **Level 5:** Rapid Strikes (+25% speed for first 3 floors) -- **Tier 2 Level 5:** Blitz Attack (+50% speed for first 5 floors) - ---- - -## Tier System - -### How Tiers Work - -1. **Reach max level** (10 for most skills, 5 for specialized) -2. **Meet attunement requirements** -3. **Tier up** - Skill resets to level 1 with 10x power multiplier - -### Tier Power Scaling - -| Tier | Multiplier | Level 1 Power = | -|------|------------|-----------------| -| 1 | 1x | Base | -| 2 | 10x | Tier 1 Level 10 | -| 3 | 100x | Tier 2 Level 10 | -| 4 | 1000x | Tier 3 Level 10 | -| 5 | 10000x | Tier 4 Level 10 | - -### Tier Up Requirements - -#### Core Skills (Mana, Study) -| Tier | Requirement | -|------|-------------| -| 1→2 | Any attunement level 3 | -| 2→3 | Any attunement level 5 | -| 3→4 | Any attunement level 7 | -| 4→5 | Any attunement level 10 | - -#### Enchanter Skills -| Tier | Requirement | -|------|-------------| -| 1→2 | Enchanter level 3 | -| 2→3 | Enchanter level 5 | -| 3→4 | Enchanter level 7 | -| 4→5 | Enchanter level 10 | - -#### Fabricator Skills (Golemancy) -| Tier | Requirement | -|------|-------------| -| 1→2 | Fabricator level 3 | -| 2→3 | Fabricator level 5 | -| 3→4 | Fabricator level 7 | -| 4→5 | Fabricator level 10 | - ---- - -## Banned Content - -The following effects/mechanics are **NOT allowed** in skill upgrades: - -| Banned Effect | Reason | -|---------------|--------| -| Lifesteal | Player cannot take damage | -| Healing (for player) | Player cannot take damage | -| Life/Blood/Wood/Mental/Force mana | Removed elements | -| Execution effects | Bypasses gameplay mechanics | -| Instant finishing | Skips mechanics | -| Direct spell damage bonuses | Spells only via weapons | -| Familiar system | Replaced by golemancy | - -### Design Philosophy - -1. **Player cannot take damage** - Only floors/enemies have HP -2. **No healing needed** - Player health doesn't exist -3. **Weapons matter** - Player attacks through enchanted weapons -4. **Golems fight** - Fabricator's constructs do the combat -5. **Enchantments empower** - Enchanter enhances equipment -6. **Pacts grant power** - Invoker makes deals with guardians - ---- - -## Code Architecture - -### Modular Structure - -The skill system has been refactored into a modular architecture for better maintainability: - -#### Skill Definitions (`src/lib/game/constants/skills.ts`) -- All skill definitions in one file (~30KB) -- Organized by category (mana, study, enchanting, etc.) -- Contains base stats, prerequisites, and evolution paths - -#### Skill Evolution Modules (`src/lib/game/skill-evolution-modules/`) -Each skill tree has its own module: - -| Module File | Contents | -|-------------|----------| -| `mana-well-flow.ts` | Mana Well, Mana Flow, Elemental Attunement | -| `quick-learner.ts` | Quick Learner, Knowledge Retention | -| `focused-mind.ts` | Focused Mind, Meditation skills | -| `enchanting-skills.ts` | Enchanting, Efficient Enchant, Disenchanting | -| `invocation-skills.ts` | Invocation, Pact Mastery trees | -| `hybrid-skills.ts` | Pact-Weaving, Guardian Constructs, Enchanted Golemancy | -| `guardian-skills.ts` | Guardian Bane, related skills | -| `insight-harvest.ts` | Insight, Deep Memory skills | -| `mana-utility-skills.ts` | Mana Overflow, Mana Tap, etc. | -| `elemental-attunement.ts` | Elemental skill upgrades | -| `knowledge-retention.ts` | Knowledge retention mechanics | -| `learning-skills.ts` | Learning speed skills | -| `magic-skills.ts` | Magic-related skills | -| `utils.ts` | Shared utility functions | -| `types.ts` | TypeScript interfaces | -| `index.ts` | Main export combining all modules (~11KB) | - -#### Skill State Management -Skill state is managed in the store layer: -- **New Modular Store:** `src/lib/game/stores/skillStore.ts` (~11KB) - Active skill state, studying, evolution -- **Legacy Slice:** `src/lib/game/store/skillSlice.ts` - Being migrated to `skillStore.ts` -- **Skill state includes:** `skills` (levels), `skillUpgrades` (chosen upgrades), `skillTiers` (current tier) - -### Adding a New Skill (Updated Process) - -1. **Define in `constants/skills.ts`** (NEW location) - - Add to `SKILLS_DEF` object - - Define base cost, study time, max level, category - -2. **Add evolution path in `skill-evolution-modules/`** (NEW location) - - Create new module or add to existing module - - Define upgrade trees for levels 5 and 10 - - Export upgrade functions - -3. **Export from `skill-evolution-modules/index.ts`** - - Import and re-export new module - - Ensure all upgrade functions are accessible - -4. **Update UI in `components/game/tabs/SkillsTab.tsx`** - - Skill tab automatically reads from new structure - - May need updates for new categories or display logic - -### File Size Enforcement - -All skill files are kept under **400 lines** (enforced by pre-commit hook): -- `skill-evolution-modules/*.ts` - Focused modules, typically 100-600 lines -- `constants/skills.ts` - Largest file at ~1000 lines ( acceptable as it's mostly data) -- Better code organization and maintainability -- Faster for AI agents to read and understand - ---- - -## Example Progression - -### Mana Well Complete Journey - -1. **Level 1-4:** +400 max mana (100 per level) -2. **Level 5:** Choose "Expanded Capacity" (+25% max) - - Total: 500 base + 125 bonus = 625 max mana -3. **Level 6-9:** +400 more max mana -4. **Level 10:** Choose "Deep Reservoir" (replaces to +50%) - - Total: 1000 base + 500 bonus = 1500 max mana -5. **Tier Up to Tier 2:** Mana Well becomes "Deep Reservoir" -6. **Tier 2 Level 1:** 100 × 10 = 1000 base (same as T1 L10) -7. **Tier 2 Level 5:** Choose "Abyssal Depth" (+50% max) -8. **Continue progression...** - -### Total Power at Tier 2 Level 5: -- Base: 500 × 10 = 5000 max mana -- Upgrades: +50% from Tier 1 +50% from Tier 2 = +100% -- Total: 5000 × 2 = **10,000 max mana** - ---- - -*Document Version: 1.1 (Updated for Modular Architecture)* -*Code has been refactored - game mechanics unchanged*