Metadata-Version: 2.4
Name: cwc-cartes
Version: 1.0.0
Summary: Create helper cards for Cold War Commander from list of units and pictures
Author-email: Aubustou <survivalfr@yahoo.fr>
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: Pillow>=9.3.0
Requires-Dist: apischema>=0.14.7
Requires-Dist: requests>=2.25.1
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: ruff>=0.9; extra == "dev"
Requires-Dist: pre-commit>=3; extra == "dev"

# cwc-cartes

Generate printable unit cards for the [Cold War Commander](http://www.coldwarcommander.com/) tabletop game.

Given a folder of unit photos and a `units.json` file, the tool composites card images and saves them as PNGs.

## Example output

![AMX AuF1 card](example/generated/FR_AMX_AuF1_1.png)

## Installation

```bash
pip install cwc-cartes
```

Or from source:

```bash
pip install -e .
```

Requires Python 3.9+.

## Usage

### Generate cards

```bash
python -m cwc_cartes.main <folder>
```

The folder must contain a `units.json` file and the background images it references. Cards are written to `<folder>/generated/`.

Options:

| Flag | Description |
|------|-------------|
| `-rotate` | Rotate each card 90° |
| `-no-bleeding-margins` | Omit the 36 px bleeding margin added around cards by default |

### Convert a raw army list to JSON

```bash
python -m cwc_cartes.converter <raw_file> <country_code> <army_name> <output.json>
```

The raw file must be a plain-text list where every 9 consecutive lines describe one unit: name, arm, move, combat (`attacks/range`), hits, save, _(blank)_, _(blank)_, notes.

## units.json format

```json
[
  {
    "country": "FR",
    "army": "French Army, Cold War/1st Gulf War/Modern (46+)",
    "name": "AMX AuF1",
    "arm": "artillery",
    "move": "30",
    "attacks": "4",
    "range": "-",
    "hits": "5",
    "save": "6",
    "notes": "Heavy Artillery: 5/100(H) attacks using direct fire while on-table",
    "flavour": "",
    "images": ["FR/7274.jpg"]
  }
]
```

- `country` — uppercase ISO country code; must match a file in `cwc_cartes/images/country_flags/`
- `arm` — unit type; must match a file in `cwc_cartes/images/unit_icons/` (without `.png`)
- `images` — paths relative to the folder, or `http(s)://` URLs
- `"invisible": true` — skip card generation for this unit

## License

MIT
