refactor: cleanup codebase — remove hydration guards, extract constants, fix bugs
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m20s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m20s
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<p align="center">
|
||||
<img src="public/logo.svg" alt="Mana Loop Logo" width="200" />
|
||||
<br />
|
||||
<em>An incremental/idle game about climbing a magical spire, mastering skills, and uncovering ancient secrets.</em>
|
||||
<em>An incremental/idle game about climbing a magical spire, mastering disciplines, and uncovering ancient secrets.</em>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -15,7 +15,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/version-0.2.0-blue" alt="Version" />
|
||||
<img src="https://img.shields.io/badge/version-0.3.0-blue" alt="Version" />
|
||||
<img src="https://img.shields.io/badge/license-MIT-green" alt="License" />
|
||||
<img src="https://img.shields.io/badge/Next.js-16.1.1-black" alt="Next.js" />
|
||||
<img src="https://img.shields.io/badge/TypeScript-5-blue" alt="TypeScript" />
|
||||
@@ -42,13 +42,13 @@
|
||||
|
||||
## Overview
|
||||
|
||||
**Mana Loop** is a browser-based incremental/idle game where players gather mana, master skills, climb a mysterious 100-floor spire, craft enchanted equipment, and summon magical golems. The game features a unique time-loop prestige system (Insight) that provides permanent progression bonuses across playthroughs.
|
||||
**Mana Loop** is a browser-based incremental/idle game where players gather mana, practice disciplines, climb a mysterious spire, craft enchanted equipment, and summon magical golems. The game features a unique time-loop prestige system (Insight) that provides permanent progression bonuses across playthroughs.
|
||||
|
||||
### Core Game Loop
|
||||
|
||||
1. **Gather Mana** - Click to collect mana or let it regenerate automatically (14 total mana types)
|
||||
2. **Study Skills & Spells** - 20+ skills with 5-tier evolution system and milestone upgrades
|
||||
3. **Climb the Spire** - Battle through 100 procedurally-generated floors, defeat guardians, sign pacts
|
||||
2. **Practice Disciplines** - Continuously train abilities that drain mana each tick in exchange for growing stat bonuses
|
||||
3. **Climb the Spire** - Battle through procedurally-generated floors; every 10th floor is a guardian encounter
|
||||
4. **Craft & Enchant** - 3-stage equipment enchantment system with capacity limits
|
||||
5. **Summon Golems** - Magical constructs that fight alongside you (4 base + 6 hybrid types)
|
||||
6. **Prestige (Loop)** - Reset progress for Insight currency, gain permanent bonuses
|
||||
@@ -62,18 +62,19 @@
|
||||
- Elemental conversion, regeneration mechanics, and meditation bonuses
|
||||
- Mana types: Fire, Water, Air, Earth, Light, Dark, Death (base), Transference (utility), Metal, Sand, Lightning (compound), Crystal, Stellar, Void (exotic)
|
||||
|
||||
### 📜 Skill & Spell System
|
||||
- 20+ skills across multiple categories (mana, study, enchanting, golemancy)
|
||||
- 5-tier evolution system for each skill
|
||||
- Milestone upgrades at levels 5 and 10 per tier
|
||||
- Unique special effects unlocked through skill upgrades
|
||||
### 📜 Discipline System
|
||||
- Practice-based progression - no discrete levels, only continuous XP growth
|
||||
- Disciplines drain mana each tick; stat bonuses grow as a power curve of accumulated XP
|
||||
- Perks unlock at XP thresholds (once, capped, or infinite stacking)
|
||||
- Attunement-gated discipline pools (Base / Enchanter / Invoker / Fabricator)
|
||||
- Concurrent discipline slots unlock as total XP grows (max 4)
|
||||
|
||||
### ⚔️ Combat & Spire
|
||||
- Cast-speed based combat system
|
||||
- Cast-speed based combat system with elemental effectiveness
|
||||
- Multi-spell support from equipped weapons
|
||||
- 100-floor spire with elemental themes
|
||||
- Floor guardians with unique mechanics and pacts
|
||||
- Every 10th floor is a guardian: base elements (10–80), compound (90–110), exotic (120–140), then procedural combination bosses (150+)
|
||||
- Golem allies that deal automatic damage each tick
|
||||
- Enemy modifiers: Armored, Agile, Mage, Shield, Swarm
|
||||
|
||||
### 🛡️ Equipment & Enchanting
|
||||
- 3-stage enchantment process: Design → Prepare → Apply
|
||||
@@ -86,20 +87,19 @@
|
||||
- Summon magical constructs (Earth, Steel, Crystal, Sand + 6 hybrid types)
|
||||
- Golem slots unlock every 2 Fabricator levels (max 5 slots at Level 10)
|
||||
- Hybrid golems require Enchanter 5 + Fabricator 5
|
||||
- Golem maintenance costs and stat upgrades via skills
|
||||
|
||||
### 🔄 Prestige (Insight)
|
||||
- Reset progress for permanent Insight currency
|
||||
- Insight upgrades across multiple categories
|
||||
- Signed pacts and attunements persist through prestige
|
||||
- Three attunement classes: Enchanter (Transference), Invoker (Spells), Fabricator (Golems/Equipment)
|
||||
- Three attunement classes: Enchanter (Transference), Invoker (Spells/Pacts), Fabricator (Golems/Equipment)
|
||||
|
||||
---
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Technology | Version | Purpose |
|
||||
|------------|---------|---------|
|
||||
|------------|---------|---------|
|
||||
| **Next.js** | ^16.1.1 | Full-stack framework (App Router) |
|
||||
| **React** | ^19.0.0 | UI library |
|
||||
| **TypeScript** | ^5 | Type-safe development |
|
||||
@@ -176,50 +176,53 @@ Mana-Loop/
|
||||
├── src/ # Application source code
|
||||
│ ├── app/ # Next.js App Router
|
||||
│ │ ├── layout.tsx # Root layout (metadata, fonts, providers)
|
||||
│ │ ├── page.tsx # Main game UI (~583 lines)
|
||||
│ │ ├── page.tsx # Main game UI
|
||||
│ │ ├── globals.css # Global styles
|
||||
│ │ └── api/ # API routes (minimal)
|
||||
│ ├── components/ # React components
|
||||
│ │ ├── ui/ # shadcn/ui components (20+ components)
|
||||
│ │ └── game/ # Game-specific components
|
||||
│ │ ├── tabs/ # Tab components (SpireTab, SkillsTab, etc.)
|
||||
│ │ ├── tabs/ # Tab components (SpireTab, DisciplinesTab, etc.)
|
||||
│ │ ├── ManaDisplay.tsx, ActionButtons.tsx, TimeDisplay.tsx
|
||||
│ │ └── crafting/, debug/, shared/, stats/ subdirectories
|
||||
│ ├── hooks/ # Custom React hooks (use-mobile, use-toast)
|
||||
│ ├── lib/ # Utility libraries
|
||||
│ │ ├── game/ # Core game logic
|
||||
│ │ │ ├── store.ts # Main Zustand store (~2862 lines)
|
||||
│ │ │ ├── crafting-slice.ts, study-slice.ts, navigation-slice.ts
|
||||
│ │ │ ├── effects.ts, upgrade-effects.ts
|
||||
│ │ │ ├── skill-evolution.ts (~3400 lines)
|
||||
│ │ │ ├── constants/ # Game definitions (elements, spells, skills)
|
||||
│ │ │ ├── data/ # Game data (equipment, golems, recipes)
|
||||
│ │ │ └── __tests__/ # Test files for game logic
|
||||
│ │ └── db.ts, utils.ts
|
||||
│ └── test/ # Test setup
|
||||
│ └── lib/ # Utility libraries
|
||||
│ └── game/ # Core game logic
|
||||
│ ├── stores/ # Modular Zustand stores
|
||||
│ │ ├── gameStore.ts # Core state & tick logic
|
||||
│ │ ├── manaStore.ts # Mana gathering & conversion
|
||||
│ │ ├── combatStore.ts # Combat, spells, floor progression
|
||||
│ │ ├── prestigeStore.ts # Prestige/loop & insight
|
||||
│ │ ├── discipline-slice.ts # Discipline activation & XP
|
||||
│ │ ├── attunementStore.ts # Attunement classes
|
||||
│ │ ├── craftingStore.ts # Crafting state
|
||||
│ │ └── uiStore.ts # UI state & modals
|
||||
│ ├── crafting-actions/ # Modular crafting stage handlers
|
||||
│ ├── constants/ # Elements, spells, rooms, prestige
|
||||
│ ├── data/ # Game data
|
||||
│ │ ├── disciplines/ # Per-attunement discipline definitions
|
||||
│ │ ├── enchantments/ # Enchantment effects by category
|
||||
│ │ ├── equipment/ # Equipment type definitions
|
||||
│ │ ├── golems/ # Golem definitions
|
||||
│ │ ├── guardian-data.ts # Static guardian definitions (floors 10–140)
|
||||
│ │ └── guardian-encounters.ts # Procedural guardian lookup & combo bosses
|
||||
│ ├── effects/ # Unified stat computation
|
||||
│ │ └── discipline-effects.ts # Discipline → getUnifiedEffects()
|
||||
│ ├── types/ # TypeScript types (disciplines, elements, etc.)
|
||||
│ └── utils/ # Combat, floor, enemy, discipline math helpers
|
||||
├── prisma/ # Database schema and migrations
|
||||
│ └── schema.prisma # SQLite schema
|
||||
├── public/ # Static assets (logo.svg, robots.txt)
|
||||
├── public/ # Static assets
|
||||
├── docs/ # Project documentation
|
||||
│ ├── AGENTS.md # Comprehensive architecture guide
|
||||
│ ├── GAME_BRIEFING.md # Game design document
|
||||
│ └── task/ # Task tracking documentation
|
||||
├── .next/ # Next.js build output (generated)
|
||||
├── node_modules/ # Dependencies (generated)
|
||||
├── Configuration Files:
|
||||
│ ├── package.json # Project metadata and scripts
|
||||
│ ├── tsconfig.json # TypeScript configuration
|
||||
│ ├── next.config.ts # Next.js config (standalone output)
|
||||
│ ├── vitest.config.ts # Vitest test configuration
|
||||
│ ├── eslint.config.mjs # ESLint configuration
|
||||
│ ├── Dockerfile # Docker multi-stage build
|
||||
│ ├── docker-compose.yml # Docker Compose setup
|
||||
│ ├── Caddyfile # Reverse proxy configuration
|
||||
│ └── .gitea/workflows/ # Gitea Actions CI/CD pipeline
|
||||
└── README.md # This file
|
||||
│ ├── AGENTS.md # Architecture guide for AI agents
|
||||
│ └── GAME_BRIEFING.md # Comprehensive game design document
|
||||
└── Configuration Files:
|
||||
├── package.json, tsconfig.json, next.config.ts
|
||||
├── vitest.config.ts, eslint.config.mjs
|
||||
├── Dockerfile, docker-compose.yml, Caddyfile
|
||||
└── .gitea/workflows/ # Gitea Actions CI/CD pipeline
|
||||
```
|
||||
|
||||
For detailed architecture patterns and coding guidelines, see [AGENTS.md](./docs/AGENTS.md).
|
||||
For detailed architecture patterns and coding guidelines, see [AGENTS.md](./AGENTS.md).
|
||||
|
||||
---
|
||||
|
||||
@@ -232,36 +235,50 @@ The core resource of the game with 14 distinct types organized in a hierarchy:
|
||||
- **Compound (3)**: Metal (Fire+Earth), Sand (Earth+Water), Lightning (Fire+Air)
|
||||
- **Exotic (3)**: Crystal (Sand+Sand+Light), Stellar (Fire+Fire+Light), Void (Dark+Dark+Death)
|
||||
|
||||
**Key Files**: `src/lib/game/store.ts`, `src/lib/game/constants/elements.ts`
|
||||
**Key Files**: `src/lib/game/stores/manaStore.ts`, `src/lib/game/constants/elements.ts`
|
||||
|
||||
### Skill Evolution System
|
||||
Each skill progresses through 5 tiers with upgrades at levels 5 and 10 per tier:
|
||||
- **Tier 1**: Basic functionality
|
||||
- **Tier 2-5**: Unlock new mechanics and bonuses
|
||||
- **Evolution Paths**: Defined in `src/lib/game/skill-evolution.ts` (~3400 lines)
|
||||
### Discipline System
|
||||
Disciplines replace the old skill system entirely. There are no discrete levels - disciplines grow **continuously** through practice. The player activates a discipline and it drains mana each tick in exchange for permanent stat growth within the run.
|
||||
|
||||
- **Stat bonus** grows as a power curve of XP: `baseValue × (XP / scalingFactor)^0.65`
|
||||
- **Mana drain** also increases with XP: `drainBase × (1 + (XP / difficultyFactor)^0.4)`
|
||||
- **Perks** unlock at XP thresholds (`once`, `capped`, or `infinite`)
|
||||
- **Concurrent slots** start at 1 and unlock as total XP grows (max 4)
|
||||
|
||||
**Key Files**: `src/lib/game/data/disciplines/`, `src/lib/game/stores/discipline-slice.ts`, `src/lib/game/utils/discipline-math.ts`
|
||||
|
||||
### Guardian & Spire System
|
||||
Every 10th floor is a guardian encounter. Guardians progress through four tiers of complexity:
|
||||
|
||||
1. **Base Elements (Floors 10–80)**: One guardian per base element + Transference. Static definitions with named guardians (Ignis Prime, Aqua Regia, etc.). Defeating them unlocks their associated mana types.
|
||||
2. **Compound Elements (Floors 90–110)**: Metal, Sand, and Lightning guardians with procedurally generated names.
|
||||
3. **Exotic Elements (Floors 120–140)**: Crystal, Stellar, and Void guardians - the most powerful single-element encounters.
|
||||
4. **Combination Bosses (Floor 150+)**: Fully procedural dual-element guardians. Each one wields two base elements simultaneously (e.g. Fire+Water, Light+Dark) and grows stronger every 10 floors.
|
||||
|
||||
**Key Files**: `src/lib/game/data/guardian-data.ts`, `src/lib/game/data/guardian-encounters.ts`
|
||||
|
||||
### Combat System
|
||||
- Cast-speed based spell casting with DPS calculations
|
||||
- Elemental damage bonuses and effectiveness
|
||||
- Multi-spell support from equipped weapons
|
||||
- Cast-speed based spell casting with elemental effectiveness multipliers
|
||||
- Enemy modifiers: Armored, Agile, Mage (barrier), Shielded, Swarm
|
||||
- Golem allies deal automatic damage each tick
|
||||
- Discipline bonuses feed into damage via `getUnifiedEffects()`
|
||||
|
||||
**Key Files**: `src/lib/game/store.ts` (combat tick logic), `src/lib/game/constants/spells.ts`
|
||||
**Key Files**: `src/lib/game/stores/combatStore.ts`, `src/lib/game/utils/combat-utils.ts`, `src/lib/game/utils/enemy-generator.ts`
|
||||
|
||||
### Enchanting System
|
||||
3-stage equipment enchantment process:
|
||||
1. **Design**: Choose effects for your equipment type
|
||||
2. **Prepare**: Prepare equipment (ONLY way to disenchant existing enchantments)
|
||||
2. **Prepare**: Ready equipment (ONLY stage where disenchanting is possible)
|
||||
3. **Apply**: Apply designed enchantments (cannot re-enchant already enchanted gear)
|
||||
|
||||
**Key Files**: `src/lib/game/crafting-slice.ts`, `src/lib/game/data/enchantment-effects.ts`
|
||||
**Key Files**: `src/lib/game/crafting-actions/`, `src/lib/game/data/enchantments/`
|
||||
|
||||
### Golemancy System
|
||||
- **Base Golems**: Earth (Fabricator 2), Steel (Metal), Crystal, Sand
|
||||
- **Hybrid Golems** (Enchanter 5 + Fabricator 5): Lava, Galvanic, Obsidian, Prism, Quicksilver, Voidstone
|
||||
- **Golem Slots**: 1 slot at Fabricator Level 2, +1 every 2 levels (max 5 at Level 10)
|
||||
|
||||
**Key Files**: `src/lib/game/data/golems.ts`, `src/lib/game/store.ts`
|
||||
**Key Files**: `src/lib/game/data/golems/`, `src/lib/game/stores/gameStore.ts`
|
||||
|
||||
### Prestige (Insight)
|
||||
Reset progress to gain Insight currency for permanent upgrades:
|
||||
@@ -274,7 +291,6 @@ Reset progress to gain Insight currency for permanent upgrades:
|
||||
## Deployment
|
||||
|
||||
### Docker Deployment
|
||||
The project includes Docker configuration for containerized deployment:
|
||||
|
||||
```bash
|
||||
# Build and run with Docker Compose
|
||||
@@ -286,7 +302,7 @@ docker run -p 3000:3000 mana-loop
|
||||
```
|
||||
|
||||
### CI/CD Pipeline
|
||||
- **Gitea Actions**: `.gitea/workflows/docker-build.yaml` automatically builds and pushes Docker images to `gitea.tailf367e3.ts.net/anexim/mana-loop:latest` on push to `master`/`main` branches
|
||||
- **Gitea Actions**: `.gitea/workflows/docker-build.yaml` automatically builds and pushes Docker images to `gitea.tailf367e3.ts.net/anexim/mana-loop:latest` on push to `master`/`main`
|
||||
- **Multi-platform**: Builds for linux/amd64 architecture
|
||||
- **Image Tags**: Branch name, commit SHA, "latest"
|
||||
|
||||
@@ -316,26 +332,24 @@ We welcome contributions! Please follow these guidelines:
|
||||
### Code Style
|
||||
- TypeScript throughout with strict typing
|
||||
- Use existing shadcn/ui components over custom implementations
|
||||
- Follow the slice pattern for Zustand store actions
|
||||
- Keep components focused (extract to separate files when >50 lines)
|
||||
- Follow the modular store pattern (`src/lib/game/stores/`)
|
||||
- Keep files under 400 lines (enforced by pre-commit hook)
|
||||
- Use path aliases: `@/*` maps to `./src/*`
|
||||
|
||||
### Adding New Features
|
||||
For detailed patterns on adding new effects, skills, spells, or systems, see the comprehensive [AGENTS.md](./docs/AGENTS.md) guide, which includes:
|
||||
- Architecture overview
|
||||
- Coding patterns
|
||||
- Git workflow (mandatory pull before work, commit & push after)
|
||||
- Credentials for automation (if applicable)
|
||||
For detailed patterns on adding new effects, disciplines, spells, or systems, see the comprehensive [AGENTS.md](./AGENTS.md) guide, which includes architecture overview, coding patterns, and git workflow.
|
||||
|
||||
---
|
||||
|
||||
## Banned Content
|
||||
|
||||
The following content has been removed from the game and should not be re-added:
|
||||
The following content has been removed from the game and must not be re-added:
|
||||
|
||||
### Banned Mechanics
|
||||
- **Lifesteal** - Player cannot heal from dealing damage
|
||||
- **Healing** - Player cannot heal themselves (floors take damage, not player)
|
||||
- **Healing** - Player cannot heal themselves (floors take damage, not the player)
|
||||
- **Scroll crafting** - Violates the no-instant-finishing design pillar
|
||||
- **Ascension skills** - Removed; no replacement
|
||||
|
||||
### Banned Mana Types
|
||||
- **Life** - Removed (healing theme conflicts with core design)
|
||||
@@ -345,14 +359,13 @@ The following content has been removed from the game and should not be re-added:
|
||||
- **Force** - Removed
|
||||
|
||||
### Banned Systems
|
||||
- **Familiar System** - Removed in favor of Golemancy and Pact systems
|
||||
- **Familiar System** - Removed in favour of Golemancy and Pact systems
|
||||
- **Skill System** (study, tiers T1–T5, milestone upgrades) - Fully replaced by the Discipline System
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the LICENSE section below for details.
|
||||
|
||||
```
|
||||
MIT License
|
||||
|
||||
@@ -377,8 +390,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
|
||||
**Note**: A `LICENSE` file is not currently present in the project root. It is recommended to create one with the above MIT License text.
|
||||
|
||||
---
|
||||
|
||||
## Acknowledgments
|
||||
@@ -393,4 +404,4 @@ SOFTWARE.
|
||||
|
||||
<p align="center">
|
||||
<em>Climb the spire. Master the mana. Uncover the loop.</em>
|
||||
</p>
|
||||
</p>
|
||||
Reference in New Issue
Block a user