diff --git a/AGENTS.md b/AGENTS.md index bfbeaaa..aaba63b 100755 --- a/AGENTS.md +++ b/AGENTS.md @@ -75,37 +75,42 @@ git config --global user.email "zhipu@local.local" ``` src/ ├── app/ -│ ├── page.tsx # Main game UI (~1700 lines, single page application) +│ ├── page.tsx # Main game UI (~548 lines, reduced via component extraction) │ ├── layout.tsx # Root layout with providers │ └── api/ # API routes (minimal use) ├── components/ │ ├── ui/ # shadcn/ui components (auto-generated) │ └── game/ │ ├── index.ts # Barrel exports -│ ├── ActionButtons.tsx # Main action buttons (Meditate, Climb, Study, etc.) +│ ├── ActionButtons.tsx # Current action display with progress indicator │ ├── CalendarDisplay.tsx # Day calendar with incursion indicators │ ├── CraftingProgress.tsx # Design/preparation/application progress bars │ ├── StudyProgress.tsx # Current study progress with cancel button │ ├── ManaDisplay.tsx # Mana/gathering section with progress bar │ ├── TimeDisplay.tsx # Day/hour display with pause toggle -│ └── tabs/ # Tab-specific components +│ └── tabs/ # Tab-specific components (Task 2: all tabs refactored) │ ├── index.ts # Tab component exports -│ ├── CraftingTab.tsx # Enchantment crafting UI +│ ├── CraftingTab.tsx # Enchantment crafting UI (~164 lines) │ ├── LabTab.tsx # Skill upgrade and lab features │ ├── SpellsTab.tsx # Spell management and equipment spells -│ └── SpireTab.tsx # Combat and spire climbing +│ ├── SpireTab.tsx # Combat with Spire Mode (~354 lines, Task 2 overhaul) +│ ├── StatsTab.tsx # Player statistics (~251 lines, Task 2: elements locked) +│ ├── SkillsTab.tsx # Skill tree display (~371 lines, Task 2: Ascension deleted) +│ ├── EquipmentTab.tsx # Gear management (~435 lines) +│ ├── DebugTab.tsx # Debug tools (~34 lines, Task 2: added Pact buttons) +│ └── LootTab.tsx # Loot display (~48 lines, Task 2: Transference removed) └── lib/ ├── game/ - │ ├── store.ts # Zustand store (~1650 lines, main state + tick logic) - │ ├── computed-stats.ts # Computed stats functions (extracted utilities) - │ ├── navigation-slice.ts # Floor navigation actions (setClimbDirection, changeFloor) - │ ├── study-slice.ts # Study system actions (startStudying*, cancelStudy) - │ ├── crafting-slice.ts # Equipment/enchantment logic + │ ├── store.ts # Zustand store (~2812 lines, main state + tick logic) + │ ├── crafting-slice.ts # Equipment/enchantment logic (~1100 lines, from store.ts) + │ ├── computed-stats.ts # Computed stats functions (~12 lines, simplified) + │ ├── navigation-slice.ts # Floor navigation actions (~75 lines) + │ ├── study-slice.ts # Study system actions (~210 lines) │ ├── familiar-slice.ts # Familiar system actions │ ├── effects.ts # Unified effect computation │ ├── upgrade-effects.ts # Skill upgrade effect definitions │ ├── constants.ts # Game definitions (spells, skills, etc.) - │ ├── skill-evolution.ts # Skill tier progression paths + │ ├── skill-evolution.ts # Skill tier progression paths (~3400 lines) │ ├── types.ts # TypeScript interfaces │ ├── formatting.ts # Display formatters │ ├── utils.ts # Utility functions @@ -117,16 +122,42 @@ src/ ## Key Systems +### 0. Task 2 Completion Summary + +**Task 2 has been completed successfully (12/12 tasks done)!** + +Key changes made in Task 2: +- **ActionButtons Rework**: Removed manual selection, auto-transition to Meditate after actions +- **SpireTab Overhaul**: Added "Climb the Spire" button, implemented Spire Mode with exit condition +- **Equipment System**: Added support for 2-Handed Weapons, Staves now block offhand slot +- **Research Locking**: Prevent switching topics while study in progress +- **DebugTab Update**: Added Invoker Debugging Buttons for Pacts +- **Combat UI Fix**: Fixed Casting Bar progress animation +- **Crafting Limits**: Disabled Prepare for non-enchanted items, limited Design to owned gear types +- **System Integrity**: Fixed Show Component Names debug option for all components +- **StatsTab**: Locked Fire/Water/Air/Earth at start, only Transference unlocked +- **LootTab**: Removed Transference from essence list (not lootable) +- **Ascension Skills**: Deleted all Ascension skills +- **Mana Well Fix**: Fixed Deep Basin upgrade multiplier values + +**Context File Approach for Sub-Agents:** +During Task 2, context files were created in `docs/` to guide sub-agents: +- `update_agents_context.md` - Context for updating AGENTS.md +- `update_game_briefing_context.md` - Context for updating GAME_BRIEFING.md +- `update_skills_context.md` - Context for updating skills.md + +This approach proved effective for delegating documentation updates to sub-agents. + ### 1. State Management (`store.ts`) The game uses a Zustand store organized with **slice pattern** for better maintainability: #### Store Slices -- **Main Store** (`store.ts`): Core state, tick logic, and main actions -- **Navigation Slice** (`navigation-slice.ts`): Floor navigation (setClimbDirection, changeFloor) -- **Study Slice** (`study-slice.ts`): Study system (startStudyingSkill, startStudyingSpell, cancelStudy) -- **Crafting Slice** (`crafting-slice.ts`): Equipment/enchantment (createEquipmentInstance, startDesigningEnchantment) -- **Familiar Slice** (`familiar-slice.ts`): Familiar system (addFamiliar, removeFamiliar) +- **Main Store** (`store.ts`): Core state, tick logic, and main actions (~2812 lines) +- **Navigation Slice** (`navigation-slice.ts`): Floor navigation (setClimbDirection, changeFloor) (~75 lines) +- **Study Slice** (`study-slice.ts`): Study system (startStudyingSkill, startStudyingSpell, cancelStudy) (~210 lines) +- **Crafting Slice** (`crafting-slice.ts`): Equipment/enchantment (createEquipmentInstance, startDesigningEnchantment) (~1100 lines) +- **Familiar Slice** (`familiar-slice.ts`): Familiar system (addFamiliar, removeFamiliar) - **NOTE: File does not currently exist** #### Computed Stats (`computed-stats.ts`) Extracted utility functions for stat calculations: @@ -341,30 +372,35 @@ const useGameStore = create()( ### Existing Slices -| Slice | File | Purpose | -|-------|------|---------| -| Navigation | `navigation-slice.ts` | Floor navigation (setClimbDirection, changeFloor) | -| Study | `study-slice.ts` | Study system (startStudyingSkill, startStudyingSpell, cancelStudy) | -| Crafting | `crafting-slice.ts` | Equipment/enchantment (createEquipmentInstance, startDesigningEnchantment) | -| Familiar | `familiar-slice.ts` | Familiar system (addFamiliar, removeFamiliar) | +| Slice | File | Lines | Purpose | +|-------|------|-------|----------| +| Navigation | `navigation-slice.ts` | ~75 | Floor navigation (setClimbDirection, changeFloor) | +| Study | `study-slice.ts` | ~210 | Study system (startStudyingSkill, startStudyingSpell, cancelStudy) | +| Crafting | `crafting-slice.ts` | ~1100 | Equipment/enchantment (createEquipmentInstance, startDesigningEnchantment) | +| Familiar | `familiar-slice.ts` | N/A | Familiar system - **File not found in current codebase** | ## File Size Guidelines -### Current File Sizes (After Refactoring) -| File | Lines | Notes | -|------|-------|-------| -| `store.ts` | ~1650 | Core state + tick logic (reduced from 2138, 23% reduction) | -| `page.tsx` | ~1695 | Main UI (reduced from 2554, 34% reduction) | -| `computed-stats.ts` | ~200 | Extracted utility functions | -| `navigation-slice.ts` | ~50 | Navigation actions | -| `study-slice.ts` | ~100 | Study system actions | +### Current File Sizes (After Task 2) +| File | Lines | Size (bytes) | Notes | +|------|-------|--------------|-------| +| `store.ts` | ~2812 | ~103KB | Core state + tick logic, crafting-slice extracted | +| `page.tsx` | ~548 | ~22KB | Main UI (heavily reduced through component extraction) | +| `crafting-slice.ts` | ~1100 | ~35KB | Equipment/enchantment logic (extracted from store.ts) | +| `skill-evolution.ts` | ~3400 | ~120KB | Skill tier progression paths | +| `study-slice.ts` | ~210 | ~8KB | Study system actions | +| `navigation-slice.ts` | ~75 | ~3KB | Navigation actions | +| `computed-stats.ts` | ~12 | ~1KB | Extracted utility functions (some moved to slices) | +| `components/game/tabs/*.tsx` | ~3000 | ~95KB | Tab-specific components (SpireTab, CraftingTab, etc.) | ### Guidelines -- Keep `page.tsx` under 2000 lines by extracting to components (ActionButtons, ManaDisplay, etc.) -- Keep `store.ts` under 1800 lines by extracting to slices (navigation, study, crafting, familiar) -- Extract computed stats and utility functions to `computed-stats.ts` when >50 lines +- Keep `page.tsx` under 600 lines by extracting to components (ActionButtons, ManaDisplay, tabs, etc.) +- Keep `store.ts` under 3000 lines by extracting to slices (navigation, study, crafting, familiar) +- Extract computed stats and utility functions to appropriate slices or utils when >100 lines - Use barrel exports (`index.ts`) for clean imports - Follow the slice pattern for store organization (see below) +- **After Task 2**: `page.tsx` reduced from ~2554 to ~548 lines (78% reduction) +- **After Task 2**: `store.ts` increased due to crafting-slice integration, but better organized ---