{
  "markdown": "# OPR Combat Calculator\n\nA damage calculator for [One Page Rules](https://onepagerules.com)' **Grimdark Future**, written in Rust. Configure an attacker and a defender in the web UI, choose ranged or melee, hit **Run Simulation**, and get aggregated combat results over thousands of dice rolls.\n\n## Disclaimer\n\nThis is an unofficial fan project. It is **not affiliated with, endorsed by, or sponsored by OPR Games** in any way. Grimdark Future and all associated names, units, and rules are the intellectual property of OPR Games ([the OPR website](https://onepagerules.com)). This tool is made by a fan, for the community, to help players quickly work out combat outcomes. Please support the official release by downloading the free rules from the OPR website.\n\n## Architecture — Modular Monolith\n\n```\n├── Cargo.toml            # workspace + shared strict clippy lints\n├── crates/\n│   ├── api/              # library crate: simulation core\n│   │   ├── src/\n│   │   │   ├── models/   # Unit, Weapon, SpecialRule (serde)\n│   │   │   ├── combat/   # 8-phase calculator, dice, context\n│   │   │   └── armies/   # faction rosters (Alien Hives, 35 units)\n│   │   └── tests/        # integration tests\n│   ├── frontend/         # binary crate: axum web app\n│   │   ├── static/       # index.html, app.js, style.css (vanilla JS)\n│   │   └── src/main.rs   # /api/armies, /api/armies/{id}/units, /api/simulate\n│   └── data-collector/   # binary crate: army data scraper\n│       ├── src/\n│       │   ├── main.rs           # CLI with fetch/parse subcommands\n│       │   ├── fetch.rs          # Jina Reader API integration\n│       │   ├── parser.rs         # HTML parsing & YAML generation\n│       │   ├── cache.rs          # local HTML caching with metadata\n│       │   ├── http_client.rs    # rate-limited HTTP client\n│       │   └── error.rs          # error types\n├── data/                 # generated army data (repo root)\n│   ├── armies/           # 43 generated army YAML catalogs (committed)\n│   └── cache/            # cached HTML from Army Forge (git-ignored)\n└── docs/                 # OKF v0.2 knowledge bundle (rules, architecture, computation)\n```\n\nThe project consists of three crates:\n\n- **`opr-api`** — simulation core with unit/weapon models, combat phases, and Monte Carlo simulation\n- **`opr-frontend`** — web UI that depends only on the public surface of `opr-api`\n- **`data-collector`** — standalone tool that scrapes army data from the OPR Army Forge website, caches HTML locally, and generates versioned YAML files for all 43 Grimdark Future armies (including subfactions)\n\nThe frontend depends only on the public surface of `opr-api`; the crate boundary is enforced at compile time. The data-collector is independent and generates the YAML files that populate the army rosters. See `docs/` for the full knowledge bundle, including the sanctioned damage simulation definition (`docs/computations/damage-simulation.md`) and data-collector architecture (`docs/architecture/data-collector.md`).\n\n## Running\n\n```bash\ncargo run -p opr-frontend\n```\n\nThen open <http://127.0.0.1:3000> — pick attacker/defender units, set attack type/distance/cover/iterations (default 1000, max 100000), and click **Run Simulation**.\n\n## Tests\n\n```bash\ncargo test\n```\n\n## Features\n\n- Unit/weapon modelling: Quality, Defense, Tough, points, builder pattern\n- Special rules as a parameterized enum (`AP(1)`, `Blast(3)`, `Tough(12)`, …)\n- Combat phases: AP, Blast, Deadly, Tough, Regeneration (+ Bane/Rending/Unstoppable skip), Reliable, Furious/Relentless/Surge extra hits, cover, fatigue\n- Monte Carlo simulation with mean/min/max aggregation over N iterations\n- **Loadout customization**: pick-one rule upgrades, weapon swaps (\"Replace Shredder Cannon\" → 9 ranged/melee options), and optional add-ons per army book; rendered as dropdowns/checkboxes in the UI. Hive Lord fully populated; other units incrementally\n- Alien Hives roster (35 units)\n\n## License\n\nMIT — see [LICENSE](LICENSE). OPR game rules and unit data remain the property of OPR Games.\n",
  "bytes": 4040,
  "sha": "da547a4e93d13cf88d832b8a3ce4ead0831d18b0336e77f7a82c0957d3dd256f",
  "repo_slug": "feralfantasies/opr-combat-calculator",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/okf_feralfantasies_opr_combat_calculator_doc_4f1e84da/readme"
}