# holynova/mafa-survivor architecture

> Architecture diagram of the GitHub repository holynova/mafa-survivor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/holynova/mafa-survivor
- Repository: https://github.com/holynova/mafa-survivor

## Overview

Mafa Survivor is a browser-based, single-player survivor game. Players choose a class and chapter, fight through waves using skills, equipment, and summons, then develop their build and persistent progress. The graph shows the React/Phaser entry and presentation layers, the game simulation and its domain systems, and the progression/save and test-mode branches. Relationships are limited to calls or module references visible in excerpts, the SOURCE INDEX, or the README; unsampled internals may have additional connections.

Main entry points: [`src/game.ts`](https://github.com/holynova/mafa-survivor/blob/main/src/game.ts) (Game State), [`src/App.tsx`](https://github.com/holynova/mafa-survivor/blob/main/src/App.tsx) (Game UI), [`src/test-mode.ts`](https://github.com/holynova/mafa-survivor/blob/main/src/test-mode.ts) (Test Mode), [`src/spells.ts`](https://github.com/holynova/mafa-survivor/blob/main/src/spells.ts) (Skills and Spells)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Player Interface"]
  node_app["Game UI<br/>[App.tsx]"]
  node_audio_ui["Audio Settings<br/>[AudioSettings.tsx]"]
  node_save_ui["Save Manager<br/>[SaveManager.tsx]"]
  node_skill_guide["Skill Guide<br/>[SkillGuide.tsx]"]
  node_test_ui["Test Tools UI<br/>[TestTools.tsx]"]
end

subgraph group_runtime["Game Runtime"]
  node_entry["Browser Entry<br/>[main.tsx]"]
  node_renderer["Phaser Renderer<br/>[renderer.ts]"]
  node_simulation["Simulation Adapter<br/>[simulation.ts]"]
  node_game["Game State<br/>[game.ts]"]
  node_audio["Game Audio<br/>[sound.ts]"]
end

subgraph group_domain["Combat and Content"]
  node_world["World Navigation<br/>[world.ts]"]
  node_content["Game Content<br/>[content.ts]"]
  node_classes["Class Definitions<br/>[classes.ts]"]
  node_spells["Skills and Spells<br/>[spells.ts]"]
  node_growth["Skill Growth<br/>[skill-growth.ts]"]
  node_rules["Combat Rules<br/>[rules.ts]"]
  node_taoist["Taoist Systems<br/>[taoist.ts]"]
  node_equipment["Equipment<br/>[equipment.ts]"]
end

subgraph group_progress["Progress and Tools"]
  node_test_mode["Test Mode<br/>[test-mode.ts]"]
  node_save["Save and Progress<br/>[save.ts]"]
  node_checkpoint["Run Checkpoints<br/>[checkpoint.ts]"]
  node_talents["Talent System<br/>[talents.ts]"]
end

node_player(("Player"))

node_player -->|"plays through"| node_app
node_entry -->|"mounts"| node_app
node_entry -->|"loads"| node_renderer
node_entry -->|"loads"| node_game
node_app -->|"controls"| node_game
node_app -->|"loads assets"| node_renderer
node_app -->|"renders"| node_audio_ui
node_app -->|"renders"| node_save_ui
node_app -->|"renders"| node_skill_guide
node_app -->|"renders"| node_test_ui
node_renderer -->|"reads state"| node_game
node_renderer -->|"uses adapter"| node_simulation
node_game -->|"reads definitions"| node_content
node_game -->|"checks movement"| node_world
node_game -->|"uses calculations"| node_rules
node_game -->|"uses skills"| node_spells
node_game -->|"uses progression"| node_growth
node_game -->|"uses class systems"| node_taoist
node_game -->|"triggers sounds"| node_audio
node_content -->|"re-exports skills"| node_spells
node_spells -->|"uses class IDs"| node_classes
node_spells -->|"scales cooldown"| node_rules
node_growth -->|"reads skill data"| node_spells
node_save_ui -->|"exports and restores"| node_save
node_app -->|"writes progress"| node_save
node_save -->|"uses checkpoints"| node_checkpoint
node_save -->|"uses talents"| node_talents
node_test_ui -->|"runs diagnostics"| node_test_mode
node_test_mode -->|"drives scenarios"| node_game
node_test_mode -->|"reads definitions"| node_content
node_test_mode -->|"checks safe positions"| node_world
node_test_mode -->|"reads skills"| node_spells
node_test_mode -->|"clears skill state"| node_taoist
node_game -->|"uses equipment"| node_equipment

click node_app "https://github.com/holynova/mafa-survivor/blob/main/src/App.tsx"
click node_audio_ui "https://github.com/holynova/mafa-survivor/blob/main/src/AudioSettings.tsx"
click node_save_ui "https://github.com/holynova/mafa-survivor/blob/main/src/SaveManager.tsx"
click node_skill_guide "https://github.com/holynova/mafa-survivor/blob/main/src/SkillGuide.tsx"
click node_test_ui "https://github.com/holynova/mafa-survivor/blob/main/src/TestTools.tsx"
click node_entry "https://github.com/holynova/mafa-survivor/blob/main/src/main.tsx"
click node_renderer "https://github.com/holynova/mafa-survivor/blob/main/src/renderer.ts"
click node_simulation "https://github.com/holynova/mafa-survivor/blob/main/src/simulation.ts"
click node_game "https://github.com/holynova/mafa-survivor/blob/main/src/game.ts"
click node_world "https://github.com/holynova/mafa-survivor/blob/main/src/world.ts"
click node_content "https://github.com/holynova/mafa-survivor/blob/main/src/content.ts"
click node_classes "https://github.com/holynova/mafa-survivor/blob/main/src/classes.ts"
click node_spells "https://github.com/holynova/mafa-survivor/blob/main/src/spells.ts"
click node_growth "https://github.com/holynova/mafa-survivor/blob/main/src/skill-growth.ts"
click node_rules "https://github.com/holynova/mafa-survivor/blob/main/src/rules.ts"
click node_taoist "https://github.com/holynova/mafa-survivor/blob/main/src/taoist.ts"
click node_audio "https://github.com/holynova/mafa-survivor/blob/main/src/sound.ts"
click node_test_mode "https://github.com/holynova/mafa-survivor/blob/main/src/test-mode.ts"
click node_save "https://github.com/holynova/mafa-survivor/blob/main/src/save.ts"
click node_checkpoint "https://github.com/holynova/mafa-survivor/blob/main/src/checkpoint.ts"
click node_talents "https://github.com/holynova/mafa-survivor/blob/main/src/talents.ts"
click node_equipment "https://github.com/holynova/mafa-survivor/blob/main/src/equipment.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_audio_ui,node_save_ui,node_skill_guide,node_test_ui toneBlue
class node_entry,node_renderer,node_simulation,node_game,node_audio toneAmber
class node_world,node_content,node_classes,node_spells,node_growth,node_rules,node_taoist,node_equipment toneMint
class node_test_mode,node_save,node_checkpoint,node_talents toneRose
class node_player toneIndigo
```

## Components

### Player Interface

- [Game UI](https://github.com/holynova/mafa-survivor/blob/main/src/App.tsx): `src/App.tsx`
- [Audio Settings](https://github.com/holynova/mafa-survivor/blob/main/src/AudioSettings.tsx): `src/AudioSettings.tsx`
- [Save Manager](https://github.com/holynova/mafa-survivor/blob/main/src/SaveManager.tsx): `src/SaveManager.tsx`
- [Skill Guide](https://github.com/holynova/mafa-survivor/blob/main/src/SkillGuide.tsx): `src/SkillGuide.tsx`
- [Test Tools UI](https://github.com/holynova/mafa-survivor/blob/main/src/TestTools.tsx): `src/TestTools.tsx`

### Game Runtime

- [Browser Entry](https://github.com/holynova/mafa-survivor/blob/main/src/main.tsx): `src/main.tsx`
- [Phaser Renderer](https://github.com/holynova/mafa-survivor/blob/main/src/renderer.ts): `src/renderer.ts`
- [Simulation Adapter](https://github.com/holynova/mafa-survivor/blob/main/src/simulation.ts): `src/simulation.ts`
- [Game State](https://github.com/holynova/mafa-survivor/blob/main/src/game.ts): `src/game.ts`
- [Game Audio](https://github.com/holynova/mafa-survivor/blob/main/src/sound.ts): `src/sound.ts`

### Combat and Content

- [World Navigation](https://github.com/holynova/mafa-survivor/blob/main/src/world.ts): `src/world.ts`
- [Game Content](https://github.com/holynova/mafa-survivor/blob/main/src/content.ts): `src/content.ts`
- [Class Definitions](https://github.com/holynova/mafa-survivor/blob/main/src/classes.ts): `src/classes.ts`
- [Skills and Spells](https://github.com/holynova/mafa-survivor/blob/main/src/spells.ts): `src/spells.ts`
- [Skill Growth](https://github.com/holynova/mafa-survivor/blob/main/src/skill-growth.ts): `src/skill-growth.ts`
- [Combat Rules](https://github.com/holynova/mafa-survivor/blob/main/src/rules.ts): `src/rules.ts`
- [Taoist Systems](https://github.com/holynova/mafa-survivor/blob/main/src/taoist.ts): `src/taoist.ts`
- [Equipment](https://github.com/holynova/mafa-survivor/blob/main/src/equipment.ts): `src/equipment.ts`

### Progress and Tools

- [Test Mode](https://github.com/holynova/mafa-survivor/blob/main/src/test-mode.ts): `src/test-mode.ts`
- [Save and Progress](https://github.com/holynova/mafa-survivor/blob/main/src/save.ts): `src/save.ts`
- [Run Checkpoints](https://github.com/holynova/mafa-survivor/blob/main/src/checkpoint.ts): `src/checkpoint.ts`
- [Talent System](https://github.com/holynova/mafa-survivor/blob/main/src/talents.ts): `src/talents.ts`

### Other components

- **Player**

## Connections

- Player → Game UI: plays through
- Browser Entry → Game UI: mounts (evidence: `src/main.tsx`)
- Browser Entry → Phaser Renderer: loads (evidence: `src/main.tsx`)
- Browser Entry → Game State: loads (evidence: `src/main.tsx`)
- Game UI → Game State: controls (evidence: `src/App.tsx`)
- Game UI → Phaser Renderer: loads assets (evidence: `src/App.tsx`)
- Game UI → Audio Settings: renders (evidence: `src/App.tsx`)
- Game UI → Save Manager: renders (evidence: `src/App.tsx`)
- Game UI → Skill Guide: renders (evidence: `src/App.tsx`)
- Game UI → Test Tools UI: renders (evidence: `src/App.tsx`)
- Phaser Renderer → Game State: reads state (evidence: `src/renderer.ts`)
- Phaser Renderer → Simulation Adapter: uses adapter (evidence: `src/renderer.ts`)
- Game State → Game Content: reads definitions (evidence: `src/game.ts`)
- Game State → World Navigation: checks movement (evidence: `src/game.ts`)
- Game State → Combat Rules: uses calculations (evidence: `src/game.ts`)
- Game State → Skills and Spells: uses skills (evidence: `src/game.ts`)
- Game State → Skill Growth: uses progression (evidence: `src/game.ts`)
- Game State → Taoist Systems: uses class systems (evidence: `src/game.ts`)
- Game State → Game Audio: triggers sounds (evidence: `src/game.ts`)
- Game Content → Skills and Spells: re-exports skills (evidence: `src/content.ts`)
- Skills and Spells → Class Definitions: uses class IDs (evidence: `src/spells.ts`)
- Skills and Spells → Combat Rules: scales cooldown (evidence: `src/spells.ts`)
- Skill Growth → Skills and Spells: reads skill data (evidence: `src/skill-growth.ts`)
- Save Manager → Save and Progress: exports and restores (evidence: `src/SaveManager.tsx`)
- Game UI → Save and Progress: writes progress (evidence: `src/App.tsx`)
- Save and Progress → Run Checkpoints: uses checkpoints (evidence: `src/save.ts`)
- Save and Progress → Talent System: uses talents (evidence: `src/save.ts`)
- Test Tools UI → Test Mode: runs diagnostics (evidence: `src/TestTools.tsx`)
- Test Mode → Game State: drives scenarios (evidence: `src/test-mode.ts`)
- Test Mode → Game Content: reads definitions (evidence: `src/test-mode.ts`)
- Test Mode → World Navigation: checks safe positions (evidence: `src/test-mode.ts`)
- Test Mode → Skills and Spells: reads skills (evidence: `src/test-mode.ts`)
- Test Mode → Taoist Systems: clears skill state (evidence: `src/test-mode.ts`)
- Game State → Equipment: uses equipment (evidence: `src/game.ts`)
