# saucesoy/damage-calculator architecture

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

- Interactive diagram: https://gitdiagram.com/saucesoy/damage-calculator
- Repository: https://github.com/saucesoy/damage-calculator

## Overview

This is a browser-based Loomian Legacy damage calculator. The user configures two Loomians, their battle settings, and moves; the app computes damage and energy outcomes and can show a detailed report. The sampled code confirms the calculator and its data tables, while the README documents editable Loomian, move, and set data. Other UI capabilities are not fully visible in the excerpts, so the graph avoids claiming unshown calls between them.

Main entry points: [`src/app.js`](https://github.com/saucesoy/damage-calculator/blob/master/src/app.js) (Calculator interface), [`src/data.js`](https://github.com/saucesoy/damage-calculator/blob/master/src/data.js) (Loomian profiles), [`src/builtInSets.js`](https://github.com/saucesoy/damage-calculator/blob/master/src/builtInSets.js) (Built-in sets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Battle setup"]
  node_app["Calculator interface<br/>[app.js]"]
end

subgraph group_engine["Calculation engine"]
  node_stats["Stat calculation<br/>[app.js]"]
  node_energy["Energy calculation<br/>[app.js]"]
  node_damage["Damage calculation<br/>[app.js]"]
  node_report["Detailed report<br/>[app.js]"]
end

subgraph group_catalog["Game data"]
  node_loomian["Loomian profiles<br/>[data.js]"]
  node_moves["Move definitions<br/>[data.js]"]
  node_sets["Built-in sets<br/>[builtInSets.js]"]
end

node_user(("Calculator user"))

node_user -->|"configures"| node_app
node_app -.->|"loads sets"| node_sets
node_app -->|"calculates stats"| node_stats
node_app -->|"calculates energy"| node_energy
node_app -->|"calculates damage"| node_damage
node_app -->|"shows report"| node_report
node_stats -.->|"uses profiles"| node_loomian
node_damage -.->|"uses profiles"| node_loomian
node_damage -.->|"uses moves"| node_moves
node_energy -.->|"uses move costs"| node_moves

click node_app "https://github.com/saucesoy/damage-calculator/blob/master/src/app.js"
click node_loomian "https://github.com/saucesoy/damage-calculator/blob/master/src/data.js"
click node_moves "https://github.com/saucesoy/damage-calculator/blob/master/src/data.js"
click node_sets "https://github.com/saucesoy/damage-calculator/blob/master/src/builtInSets.js"
click node_stats "https://github.com/saucesoy/damage-calculator/blob/master/src/app.js"
click node_energy "https://github.com/saucesoy/damage-calculator/blob/master/src/app.js"
click node_damage "https://github.com/saucesoy/damage-calculator/blob/master/src/app.js"
click node_report "https://github.com/saucesoy/damage-calculator/blob/master/src/app.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_app,node_user toneBlue
class node_stats,node_energy,node_damage,node_report toneAmber
class node_loomian,node_moves,node_sets toneMint
```

## Components

### Battle setup

- [Calculator interface](https://github.com/saucesoy/damage-calculator/blob/master/src/app.js): `src/app.js`

### Calculation engine

- [Stat calculation](https://github.com/saucesoy/damage-calculator/blob/master/src/app.js): `src/app.js`
- [Energy calculation](https://github.com/saucesoy/damage-calculator/blob/master/src/app.js): `src/app.js`
- [Damage calculation](https://github.com/saucesoy/damage-calculator/blob/master/src/app.js): `src/app.js`
- [Detailed report](https://github.com/saucesoy/damage-calculator/blob/master/src/app.js): `src/app.js`

### Game data

- [Loomian profiles](https://github.com/saucesoy/damage-calculator/blob/master/src/data.js): `src/data.js`
- [Move definitions](https://github.com/saucesoy/damage-calculator/blob/master/src/data.js): `src/data.js`
- [Built-in sets](https://github.com/saucesoy/damage-calculator/blob/master/src/builtInSets.js): `src/builtInSets.js`

### Other components

- **Calculator user**

## Connections

- Calculator user → Calculator interface: configures (evidence: `src/app.js`)
- Calculator interface → Built-in sets: loads sets
- Calculator interface → Stat calculation: calculates stats (evidence: `src/app.js`)
- Calculator interface → Energy calculation: calculates energy (evidence: `src/app.js`)
- Calculator interface → Damage calculation: calculates damage (evidence: `src/app.js`)
- Calculator interface → Detailed report: shows report (evidence: `src/app.js`)
- Stat calculation → Loomian profiles: uses profiles
- Damage calculation → Loomian profiles: uses profiles
- Damage calculation → Move definitions: uses moves
- Energy calculation → Move definitions: uses move costs
