docs: update AGENTS.md and GAME_BRIEFING.md to reflect current architecture
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m23s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m23s
- Remove references to legacy store.ts, store/, store-modules/, Prisma, database - Update guardian system: 4 tiers (base/compound/exotic/combination bosses at 150+) - Update discipline system: 34 disciplines across 10 data files, 4 attunement pools - Update combat: enemy modifiers, room types, floor HP formulas - Update incursion: starts day 5 (not day 20) - Update equipment: 50 types, 9 categories, 8 slots - Update golemancy: 10 golems (1 base + 3 elemental + 6 hybrid) - Update prestige: 14 upgrade types, pact persistence - Update achievements: 24 achievements across 5 categories - Fix mana types terminology: composite (not compound) in code - Add store architecture overview (7 Zustand stores) - Add removed systems appendix
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Mana Loop — Agent Guide
|
# Mana Loop — Agent Guide
|
||||||
|
|
||||||
Browser incremental/idle game. Next.js 16 + Zustand, no backend.
|
Browser incremental/idle game. Next.js 16 + Zustand, no backend, localStorage persistence.
|
||||||
|
|
||||||
## 🔑 Git
|
## 🔑 Git
|
||||||
|
|
||||||
@@ -24,13 +24,13 @@ git add -A && git commit -m "type: desc" && git push origin master
|
|||||||
|
|
||||||
1. `docs/project-structure.txt`
|
1. `docs/project-structure.txt`
|
||||||
2. `docs/dependency-graph.json`
|
2. `docs/dependency-graph.json`
|
||||||
3. `get_repo_summary` → resume in-progress or pick top todo
|
3. `gitea_get_project_boards` → resume in-progress or pick top todo
|
||||||
4. `update_issue_status` → `ai:in-progress`
|
4. `gitea_update_issue_status` → `ai_state: "in-progress"`
|
||||||
5. Work, log with `add_comment`, then `update_issue_status` → `ai:done`
|
5. Work, log with `gitea_add_comment`, then `gitea_update_issue_status` → `ai_state: "done"`
|
||||||
|
|
||||||
## Labels
|
## Labels
|
||||||
|
|
||||||
`ai:todo` | `ai:in-progress` | `ai:review` | `ai:blocked` | `ai:done`
|
`ai_state: todo` | `in_state: in-progress` | `ai_state: review` | `ai_state: blocked` | `ai_state: done`
|
||||||
|
|
||||||
## Terminal Tool
|
## Terminal Tool
|
||||||
|
|
||||||
@@ -42,24 +42,36 @@ Use for 3+ sequential independent calls. Zero context from parent — paste ever
|
|||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
- **Stack:** Next.js 16, TS 5, Tailwind 4 + shadcn/ui, Zustand+persist, Vitest/Playwright, Bun
|
- **Stack:** Next.js 16, TS 5, Tailwind 4 + shadcn/ui, Zustand+persist, Vitest, Bun
|
||||||
- **Active stores:** `src/lib/game/stores/{game,mana,combat,prestige,discipline,ui}Store.ts`
|
- **No backend:** Pure client-side. No Prisma, no database. State persisted to localStorage.
|
||||||
- **Legacy (migrating):** `src/lib/game/store/` and `store-modules/`
|
- **Active stores (7 Zustand stores):**
|
||||||
- **Crafting:** 3-step flow — Design → Prepare → Apply via `crafting-actions/`
|
- `useGameStore` — Coordinator/tick pipeline, imports all other stores
|
||||||
- **Disciplines:** `data/disciplines/` + `stores/discipline-slice.ts` + `utils/discipline-math.ts`
|
- `useManaStore` — Mana pools, regen, element conversion
|
||||||
- **Effects:** All stat mods through `getUnifiedEffects()` — discipline bonuses enter via `computeDisciplineEffects()`
|
- `useCombatStore` — Spire/floors, combat, spells, achievements
|
||||||
|
- `useCraftingStore` — Enchanting (Design/Prepare/Apply), equipment instances, loot
|
||||||
|
- `useAttunementStore` — Enchanter/Invoker/Fabricator attunement levels & XP
|
||||||
|
- `usePrestigeStore` — Insight, prestige upgrades, pact persistence, loop state
|
||||||
|
- `useDisciplineStore` — Discipline activation, XP ticking, perk evaluation (slice)
|
||||||
|
- `useUIStore` — Logs, pause, game over/victory flags
|
||||||
|
- **Legacy:** Fully migrated. No legacy `store.ts`, `store/`, or `store-modules/` directories remain.
|
||||||
|
|
||||||
### Adding Effects
|
### Adding Effects
|
||||||
1. `data/enchantment-effects.ts`
|
1. `data/enchantments/` — Add effect definition in the appropriate category file
|
||||||
2. `effects.ts` → `computeEquipmentEffects()`
|
2. `craftingStore.ts` → effects computation
|
||||||
3. Access via `getUnifiedEffects(state)`
|
3. Equipment effects flow through `src/lib/game/effects.ts` → `getUnifiedEffects()`
|
||||||
|
|
||||||
### Adding Disciplines
|
### Adding Disciplines
|
||||||
1. Choose the correct data file under `data/disciplines/`:
|
1. Choose the correct data file under `data/disciplines/`:
|
||||||
- `base.ts` — available to all attunements
|
- `base.ts` — Raw Mana Mastery (available to all)
|
||||||
- `enchanter.ts` — requires Enchanter attunement
|
- `elemental.ts` — Elemental Attunement (7 base+ elements)
|
||||||
- `invoker.ts` — requires Invoker attunement
|
- `elemental-regen.ts` — Elemental Regen (7 base + transference)
|
||||||
- `fabricator.ts` — requires Fabricator attunement
|
- `elemental-regen-advanced.ts` — Advanced Regen (3 composite + 3 exotic)
|
||||||
|
- `enchanter.ts` — Core Enchanter disciplines (4 disciplines)
|
||||||
|
- `enchanter-utility.ts` — Utility enchantment disciplines (2 disciplines)
|
||||||
|
- `enchanter-spells.ts` — Spell enchantment disciplines (3 disciplines)
|
||||||
|
- `enchanter-special.ts` — Special enchantment disciplines (1 discipline)
|
||||||
|
- `invoker.ts` — Invoker combat disciplines (2 disciplines)
|
||||||
|
- `fabricator.ts` — Fabricator crafting/golem disciplines (2 disciplines)
|
||||||
2. Define a `DisciplineDefinition` (see `types/disciplines.ts`):
|
2. Define a `DisciplineDefinition` (see `types/disciplines.ts`):
|
||||||
- `statBonus.stat` must match a key consumed by `computeDisciplineEffects()`
|
- `statBonus.stat` must match a key consumed by `computeDisciplineEffects()`
|
||||||
- Set `difficultyFactor` and `scalingFactor` to control growth rate
|
- Set `difficultyFactor` and `scalingFactor` to control growth rate
|
||||||
@@ -69,20 +81,79 @@ Use for 3+ sequential independent calls. Zero context from parent — paste ever
|
|||||||
|
|
||||||
### Discipline Math (quick reference)
|
### Discipline Math (quick reference)
|
||||||
```
|
```
|
||||||
StatBonus = baseValue × (XP / scalingFactor)^0.65
|
StatBonus = baseValue × (XP / scalingFactor)^0.65
|
||||||
ManaDrainPerTick = drainBase × (1 + (XP / difficultyFactor)^0.4)
|
ManaDrainPerTick = drainBase × (1 + (XP / difficultyFactor)^0.4)
|
||||||
```
|
```
|
||||||
- XP accrues every tick the discipline is active and mana drain is met
|
- 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)
|
- `concurrentLimit` starts at 1 and expands by 1 per 500 total XP (max 4)
|
||||||
|
|
||||||
### Adding Spells
|
### Adding Spells
|
||||||
1. `constants/spells.ts`
|
1. `constants/spells-modules/` — Add to the appropriate category file
|
||||||
2. `data/enchantment-effects.ts`
|
2. `data/enchantments/spell-effects/` — Add enchantment effect for the spell
|
||||||
3. `EFFECT_RESEARCH_MAPPING`
|
3. Re-export from barrel files
|
||||||
|
|
||||||
|
### Store Architecture (Key Files)
|
||||||
|
- `stores/gameStore.ts` — Main coordinator, combines all stores, tick orchestration
|
||||||
|
- `stores/tick-pipeline.ts` → `buildTickContext()` / `applyTickWrites()` pattern
|
||||||
|
- `stores/combat-actions.ts` — Combat tick processing
|
||||||
|
- `stores/gameLoopActions.ts` — Climb/spire actions
|
||||||
|
- `stores/pipelines/[name].ts` — Individual pipeline phases
|
||||||
|
|
||||||
|
## Crafting System
|
||||||
|
|
||||||
|
### Enchanting: 3-Step Flow — Design → Prepare → Apply
|
||||||
|
- **Design:** Select effects for a named design. Time: 1h + 0.5h per effect slot. Dual design slot with Enchant Mastery special.
|
||||||
|
- **Prepare:** Clears existing enchantments, costs `capacity × 10` raw mana, time: `2h + 1h per 50 capacity`. ONLY stage where explicit disenchanting occurs.
|
||||||
|
- **Apply:** Applies saved design to prepared equipment. Time: `2h + stacks` hours. Mana: `20 + 5×stacks` per hour.
|
||||||
|
|
||||||
|
### Equipment
|
||||||
|
- 8 slots: mainHand, offHand, head, body, hands, feet, accessory1, accessory2
|
||||||
|
- 50 equipment types across 9 categories (casters, swords, shields, catalysts, head, body, hands, feet, accessories)
|
||||||
|
- Instance fields: `instanceId`, `typeId`, `name`, `enchantments[]`, `usedCapacity`, `totalCapacity`, `rarity`, `quality`
|
||||||
|
- Stacking cost: each additional stack costs 20% more
|
||||||
|
|
||||||
|
### Golemancy
|
||||||
|
- 10 golems total: 1 base (Earth) + 3 elemental (Steel, Crystal, Sand) + 6 hybrid (Lava, Galvanic, Obsidian, Prism, Quicksilver, Voidstone)
|
||||||
|
- Golems slots: `floor(fabricatorLevel / 2)`, max 5 at level 10
|
||||||
|
- Hybrid golems require Enchanter 5 + Fabricator 5
|
||||||
|
|
||||||
|
### Guardian System
|
||||||
|
- Guardians on every 10th floor
|
||||||
|
- **Base (floors 10–80):** 7 base elements + Transference, static definitions with unique names
|
||||||
|
- **Compound (floors 90–110):** Metal, Sand, Lightning — procedurally named
|
||||||
|
- **Exotic (floors 120–140):** Crystal, Stellar, Void — procedurally named
|
||||||
|
- **Combination bosses (floor 150+):** Dual-element procedural guardians cycling through 9 element pairs, scaling indefinitely
|
||||||
|
- HP formula: `floor(5000 × (floor/10) ^ (1.1 + floor/200))`
|
||||||
|
- Pact signing: costs raw mana + time, grants permanent boons
|
||||||
|
|
||||||
|
### Combat
|
||||||
|
- Cast-speed based: `castProgress += HOURS_PER_TICK × spellCastSpeed × attackSpeedMult`
|
||||||
|
- Elemental bonuses: super effective (1.5×), same element (1.25×), weak (0.75×), neutral (1.0×)
|
||||||
|
- Element opposites: fire↔water, air↔earth, light↔dark, lightning→earth
|
||||||
|
- Enemy modifiers (max 2 per enemy): Armored, Agile, Mage, Shield, Swarm
|
||||||
|
- Room types: Combat (default), Guardian (every 10th), Swarm (15%), Speed (10%), Puzzle (20% on every 7th floor)
|
||||||
|
- Floor HP: `100 + floor × 50 + floor^1.7` for non-guardian floors
|
||||||
|
|
||||||
|
### Time & Incursion
|
||||||
|
- `TICK_MS`: 200ms, `HOURS_PER_TICK`: 0.04, `MAX_DAY`: 30
|
||||||
|
- Incursion starts day 5 (not day 20)
|
||||||
|
- Incursion strength: `min(0.95, (totalHours / maxHours) × 0.95)`
|
||||||
|
|
||||||
|
### Prestige (Insight)
|
||||||
|
- `baseInsight = floor(maxFloorReached × 15 + totalManaGathered / 500 + signedPacts.length × 150)`
|
||||||
|
- Multiplied by discipline and boon bonuses. ×3 for victory (floor 100 + pact signed)
|
||||||
|
- 14 prestige upgrade types: manaWell, manaFlow, insightAmp, spireKey, temporalEcho, steadyHand, ancientKnowledge, elementalAttune, spellMemory, guardianPact, quickStart, elemStart, unlockedManaTypeCapacity
|
||||||
|
- Signed pacts persist through prestige (bounded by `pactSlots`)
|
||||||
|
|
||||||
|
### Starting State
|
||||||
|
- Attunement: Enchanter only (level 1)
|
||||||
|
- Mana: Only Transference unlocked
|
||||||
|
- Equipment: Basic Staff with Mana Bolt enchantment (mainHand), Civilian Shirt (body), Civilian Shoes (feet)
|
||||||
|
- 1 discipline slot, 1 concurrent discipline
|
||||||
|
|
||||||
## Banned
|
## Banned
|
||||||
|
|
||||||
Lifesteal/healing, scroll crafting, ascension skills, LabTab, pause, mana types: `life`, `blood`, `wood`, `mental`, `force`
|
Lifesteal/healing, scroll crafting, ascension skills, LabTab, pause mechanics, familiar system, mana types: `life`, `blood`, `wood`, `mental`, `force`
|
||||||
|
|
||||||
## File Limit
|
## File Limit
|
||||||
|
|
||||||
@@ -90,7 +161,7 @@ Lifesteal/healing, scroll crafting, ascension skills, LabTab, pause, mana types:
|
|||||||
|
|
||||||
## Mana Types
|
## Mana Types
|
||||||
|
|
||||||
**Base (7):** Fire 🔥 Water 💧 Air 🌬️ Earth ⛰️ Light ☀️ Dark 🌑 Death 💀
|
**Base (7):** Fire 🔥 Water 💧 Air 🌬️ Earth ⛰️ Light ☀️ Dark 🌑 Death 💀
|
||||||
**Utility (1):** Transference 🔗
|
**Utility (1):** Transference 🔗
|
||||||
**Compound (3):** Fire+Earth=Metal, Earth+Water=Sand, Fire+Air=Lightning
|
**Composite (3):** Fire+Earth=Metal ⚙️, Earth+Water=Sand ⏳, Fire+Air=Lightning ⚡
|
||||||
**Exotic (3):** Sand+Sand+Light=Crystal, Fire+Fire+Light=Stellar, Dark+Dark+Death=Void
|
**Exotic (3):** Sand+Sand+Light=Crystal 💎, Fire+Fire+Light=Stellar ⭐, Dark+Dark+Death=Void 🕳️
|
||||||
|
|||||||
+547
-321
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user