# zolexdbb/draft_mon architecture

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

- Interactive diagram: https://gitdiagram.com/zolexdbb/draft_mon
- Repository: https://github.com/zolexdbb/draft_mon

## Overview

This is a browser-based Pokémon draft-and-tower game. The principal workflow is choosing a difficulty, drafting a team, building its members, then progressing through tower battles and earning persistent rewards. Supporting capabilities include the Pokédex, village services, item management, and save slots. The graph reflects explicit excerpt evidence where available; dashed, uncited links mark workflow connections or integrations whose implementation was not shown.

Main entry points: [`combat/battle-flow.js`](https://github.com/zolexdbb/draft_mon/blob/main/combat/battle-flow.js) (Battle flow), [`draft/draft-core.js`](https://github.com/zolexdbb/draft_mon/blob/main/draft/draft-core.js) (Team draft), [`combat/tower.js`](https://github.com/zolexdbb/draft_mon/blob/main/combat/tower.js) (Tower run), [`village/village-core.js`](https://github.com/zolexdbb/draft_mon/blob/main/village/village-core.js) (Village services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_progression["Run progression"]
  node_draft["Team draft<br/>[draft-core.js]"]
  node_draft_modes["Draft modes"]
  node_tower["Tower run<br/>[tower.js]"]
  node_tower_events["Tower events<br/>[tower-events.js]"]
end

subgraph group_combat["Battle system"]
  node_battle_flow["Battle flow<br/>[battle-flow.js]"]
  node_battle_ui["Battle display<br/>[battle-ui.js]"]
  node_damage["Damage calculation<br/>[damage-calc.js]"]
  node_statuses["Statuses and effects<br/>[status-effects.js]"]
  node_battle_mechanics["Battle mechanics"]
end

subgraph group_data["Game data"]
  node_moves["Move catalogue<br/>[moves.js]"]
  node_items["Item catalogue<br/>[items.js]"]
  node_pokemon_data["Pokémon catalogue"]
  node_core_rules["Core rules"]
end

subgraph group_village["Village and meta"]
  node_village_core["Village services<br/>[village-core.js]"]
  node_shop["Shop and merchant"]
  node_pc["PC storage<br/>[pc-storage.js]"]
  node_safari["Safari<br/>[safari.js]"]
  node_rewards["Run rewards<br/>[rewards.js]"]
end

subgraph group_interface["Interface and persistence"]
  node_screens["Game screens<br/>[screens.js]"]
  node_save[("Save system<br/>[save-system.js]")]
  node_dex["Pokédex viewer<br/>[dex-viewer.js]"]
  node_patch_notes["Patch notes<br/>[patch-notes.js]"]
end

node_player(("Player"))

node_player -.->|"opens"| node_screens
node_screens -.->|"starts draft"| node_draft
node_draft -->|"starts run"| node_tower
node_draft_modes -.->|"configures"| node_draft
node_tower -.->|"runs battles"| node_battle_flow
node_tower -.->|"triggers events"| node_tower_events
node_battle_flow -.->|"renders battle"| node_battle_ui
node_battle_flow -.->|"applies effects"| node_statuses
node_battle_flow -.->|"calculates damage"| node_damage
node_battle_flow -.->|"uses mechanics"| node_battle_mechanics
node_damage -->|"reads type chart"| node_core_rules
node_statuses -->|"reads held items"| node_items
node_draft -.->|"offers lineages"| node_pokemon_data
node_draft -.->|"calculates stats"| node_core_rules
node_tower -.->|"awards tokens"| node_rewards
node_player -.->|"visits"| node_village_core
node_village_core -.->|"opens services"| node_shop
node_village_core -.->|"opens storage"| node_pc
node_village_core -.->|"opens safari"| node_safari
node_screens -.->|"opens viewer"| node_dex
node_screens -.->|"opens notes"| node_patch_notes
node_player -.->|"saves run"| node_save
node_save -->|"rebuilds stats"| node_core_rules

click node_screens "https://github.com/zolexdbb/draft_mon/blob/main/ui/screens.js"
click node_draft "https://github.com/zolexdbb/draft_mon/blob/main/draft/draft-core.js"
click node_draft_modes "https://github.com/zolexdbb/draft_mon/tree/main/draft"
click node_tower "https://github.com/zolexdbb/draft_mon/blob/main/combat/tower.js"
click node_tower_events "https://github.com/zolexdbb/draft_mon/blob/main/combat/tower-events.js"
click node_battle_flow "https://github.com/zolexdbb/draft_mon/blob/main/combat/battle-flow.js"
click node_battle_ui "https://github.com/zolexdbb/draft_mon/blob/main/combat/battle-ui.js"
click node_damage "https://github.com/zolexdbb/draft_mon/blob/main/combat/damage-calc.js"
click node_statuses "https://github.com/zolexdbb/draft_mon/blob/main/combat/status-effects.js"
click node_battle_mechanics "https://github.com/zolexdbb/draft_mon/tree/main/combat"
click node_moves "https://github.com/zolexdbb/draft_mon/blob/main/moves/moves.js"
click node_items "https://github.com/zolexdbb/draft_mon/blob/main/items/items.js"
click node_pokemon_data "https://github.com/zolexdbb/draft_mon/tree/main/pokemon"
click node_core_rules "https://github.com/zolexdbb/draft_mon/tree/main/core"
click node_village_core "https://github.com/zolexdbb/draft_mon/blob/main/village/village-core.js"
click node_shop "https://github.com/zolexdbb/draft_mon/tree/main/village"
click node_pc "https://github.com/zolexdbb/draft_mon/blob/main/village/pc-storage.js"
click node_safari "https://github.com/zolexdbb/draft_mon/blob/main/village/safari.js"
click node_rewards "https://github.com/zolexdbb/draft_mon/blob/main/meta/rewards.js"
click node_save "https://github.com/zolexdbb/draft_mon/blob/main/save/save-system.js"
click node_dex "https://github.com/zolexdbb/draft_mon/blob/main/ui/dex-viewer.js"
click node_patch_notes "https://github.com/zolexdbb/draft_mon/blob/main/ui/patch-notes.js"

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_draft,node_draft_modes,node_tower,node_tower_events toneBlue
class node_battle_flow,node_battle_ui,node_damage,node_statuses,node_battle_mechanics toneAmber
class node_moves,node_items,node_pokemon_data,node_core_rules toneMint
class node_village_core,node_shop,node_pc,node_safari,node_rewards toneRose
class node_screens,node_save,node_dex,node_patch_notes,node_player toneIndigo
```

## Components

### Run progression

- [Team draft](https://github.com/zolexdbb/draft_mon/blob/main/draft/draft-core.js): `draft/draft-core.js`
- [Draft modes](https://github.com/zolexdbb/draft_mon/tree/main/draft): `draft`
- [Tower run](https://github.com/zolexdbb/draft_mon/blob/main/combat/tower.js): `combat/tower.js`
- [Tower events](https://github.com/zolexdbb/draft_mon/blob/main/combat/tower-events.js): `combat/tower-events.js`

### Battle system

- [Battle flow](https://github.com/zolexdbb/draft_mon/blob/main/combat/battle-flow.js): `combat/battle-flow.js`
- [Battle display](https://github.com/zolexdbb/draft_mon/blob/main/combat/battle-ui.js): `combat/battle-ui.js`
- [Damage calculation](https://github.com/zolexdbb/draft_mon/blob/main/combat/damage-calc.js): `combat/damage-calc.js`
- [Statuses and effects](https://github.com/zolexdbb/draft_mon/blob/main/combat/status-effects.js): `combat/status-effects.js`
- [Battle mechanics](https://github.com/zolexdbb/draft_mon/tree/main/combat): `combat`

### Game data

- [Move catalogue](https://github.com/zolexdbb/draft_mon/blob/main/moves/moves.js): `moves/moves.js`
- [Item catalogue](https://github.com/zolexdbb/draft_mon/blob/main/items/items.js): `items/items.js`
- [Pokémon catalogue](https://github.com/zolexdbb/draft_mon/tree/main/pokemon): `pokemon`
- [Core rules](https://github.com/zolexdbb/draft_mon/tree/main/core): `core`

### Village and meta

- [Village services](https://github.com/zolexdbb/draft_mon/blob/main/village/village-core.js): `village/village-core.js`
- [Shop and merchant](https://github.com/zolexdbb/draft_mon/tree/main/village): `village`
- [PC storage](https://github.com/zolexdbb/draft_mon/blob/main/village/pc-storage.js): `village/pc-storage.js`
- [Safari](https://github.com/zolexdbb/draft_mon/blob/main/village/safari.js): `village/safari.js`
- [Run rewards](https://github.com/zolexdbb/draft_mon/blob/main/meta/rewards.js): `meta/rewards.js`

### Interface and persistence

- [Game screens](https://github.com/zolexdbb/draft_mon/blob/main/ui/screens.js): `ui/screens.js`
- [Save system](https://github.com/zolexdbb/draft_mon/blob/main/save/save-system.js): `save/save-system.js`
- [Pokédex viewer](https://github.com/zolexdbb/draft_mon/blob/main/ui/dex-viewer.js): `ui/dex-viewer.js`
- [Patch notes](https://github.com/zolexdbb/draft_mon/blob/main/ui/patch-notes.js): `ui/patch-notes.js`

### Other components

- **Player**

## Connections

- Player → Game screens: opens
- Game screens → Team draft: starts draft
- Team draft → Tower run: starts run (evidence: `draft/draft-core.js`)
- Draft modes → Team draft: configures
- Tower run → Battle flow: runs battles
- Tower run → Tower events: triggers events
- Battle flow → Battle display: renders battle
- Battle flow → Statuses and effects: applies effects
- Battle flow → Damage calculation: calculates damage
- Battle flow → Battle mechanics: uses mechanics
- Damage calculation → Core rules: reads type chart (evidence: `core/type-chart.js`)
- Statuses and effects → Item catalogue: reads held items (evidence: `combat/status-effects.js`)
- Team draft → Pokémon catalogue: offers lineages
- Team draft → Core rules: calculates stats
- Tower run → Run rewards: awards tokens
- Player → Village services: visits
- Village services → Shop and merchant: opens services
- Village services → PC storage: opens storage
- Village services → Safari: opens safari
- Game screens → Pokédex viewer: opens viewer
- Game screens → Patch notes: opens notes
- Player → Save system: saves run
- Save system → Core rules: rebuilds stats (evidence: `save/save-system.js`)
