A Star Wars: Legion attack sequence dice calculator and Monte Carlo simulator. Configure attacker and defender dice pools, keywords, and tokens, then calculate expected wounds or run simulations.
# Install dependencies
npm install
# Start development server (http://localhost:8080)
npm run dev
# Run tests
npm test
# Validate code quality
npm run lint
npm run typecheck
# Build for production
npm run build- Framework: React 18 + TypeScript (strict mode)
- Build Tool: Vite
- Styling: Tailwind CSS (dark theme, utility-first)
- State Management: Zustand
- Testing: Vitest + React Testing Library + happy-dom
- Charts: Recharts
- PWA: vite-plugin-pwa (offline support, installable)
The app is a Progressive Web App that can be installed on any device:
- Deploy
dist/folder to any static hosting (Vercel, Netlify, GitHub Pages) - Users can install it to their home screen for offline access
The app is ready to build as a native desktop application using Tauri!
To run the desktop app:
- Install Rust:
winget install Rustlang.Rustup - Run:
npm run tauri:dev
To build executables:
npm run tauri:buildSee TAURI_QUICKSTART.md for detailed instructions.
Key features:
- β Already configured and ready to use
- π¦ ~3-5 MB executables (not 100+ MB!)
- π Fast startup, low memory usage
- π» Windows, macOS, and Linux support
- π Same codebase as web app (zero extra code)
# Watch mode
npm test
# Run once
npm run test:run
# Coverage report
npm run test:coverage
# Required for code changes
npm run lint
npm run typecheckEvery code change must pass both commands before it is considered complete:
npm run typecheck
npm run lintIf either command fails, resolve those issues before submitting or merging changes.
src/
βββ components/ # UI panels and shared components
β βββ AttackerPanel/
β βββ DefenderPanel/
β βββ ResultsPanel/
β βββ DiceDisplay/
β βββ shared/
βββ engine/ # Pure dice logic and probability math
βββ hooks/ # Custom React hooks
βββ utils/ # Helper functions
βββ data/ # Unit preset data
βββ test/ # Test setup
The app models the full Star Wars: Legion attack sequence (Steps 1-9):
- Attack dice: White, Black, Red (d8)
- Defense dice: White, Red (d6)
- Keywords: Impact, Pierce, Critical, Surge conversions, Cover, Dodge, Armor, etc.
See rulebook_markdown/ for detailed game rules reference.
Implementation follows a structured plan:
- Phase 1: Project scaffolding β
- Phase 2: Core dice engine
- Phase 3: Monte Carlo simulator
- Phase 4-8: UI components and integration
- Phase 9: Testing and validation
See plans/ directory for detailed phase documentation.
This project uses:
- Functional components only (no class components)
- Named exports for components
- Co-located tests (
.test.tsxnext to source files) - Tailwind utilities only (no CSS modules or styled-components)
- GitHub Copilot instructions in
.github/copilot-instructions.md
[Add license information]