mantimon-tcg/backend/data/definitions/README.md
Cal Corum 934aa4c443 Add CardService and card data conversion pipeline
- Rename data/cards/ to data/raw/ for scraped data
- Add data/definitions/ as authoritative card data source
- Add convert_cards.py script to transform raw -> definitions
- Generate 378 card definitions (344 Pokemon, 24 Trainers, 10 Energy)
- Add CardService for loading and querying card definitions
  - In-memory indexes for fast lookups by type, set, pokemon_type
  - search() with multiple filter criteria
  - get_all_cards() for GameEngine integration
- Add SetInfo model for set metadata
- Update Attack model with damage_display field for variable damage
- Update CardDefinition with image_path, illustrator, flavor_text
- Add 45 tests (21 converter + 24 CardService)
- Update scraper output path to data/raw/

Card data is JSON-authoritative (no database) to support offline fork goal.
2026-01-27 14:16:40 -06:00

1.2 KiB

Card Definitions (Authoritative)

These JSON files are the authoritative source for card data used by the game engine. Edit these files for gameplay changes.

Structure

definitions/
├── _index.json          # Master index with all cards + set metadata
├── pokemon/
│   ├── a1/              # Pokemon from Genetic Apex
│   └── a1a/             # Pokemon from Mythical Island
├── trainer/
│   ├── a1/              # Trainers from Genetic Apex
│   └── a1a/             # Trainers from Mythical Island
└── energy/
    └── basic/           # Universal basic energy cards

Generating Definitions

Definitions are generated from raw scraped data:

cd backend
python scripts/convert_cards.py

After generation, you can manually edit files for corrections or gameplay tweaks.

Schema

Each JSON file conforms to the CardDefinition Pydantic model in app/core/models/card.py.

Key fields:

  • id: Unique identifier (e.g., "a1-001-bulbasaur")
  • name: Display name
  • card_type: "pokemon", "trainer", or "energy"
  • set_id: Which set this card belongs to

See the model documentation for complete field descriptions.