mantimon-tcg/backend/data/definitions
Cal Corum adb55dec12 Fix scraper to preserve energy types in effect text
The source website uses <span class='energy-text energy-text--type-fire'>
to render inline energy icons. BeautifulSoup's get_text() was stripping
these spans, losing the energy type information and causing merged text
like 'Discard aEnergy' instead of 'Discard a Fire Energy'.

Changes:
- Add ENERGY_TEXT_TYPES mapping for inline energy references
- Add replace_energy_text_spans() to convert spans to text before extraction
- Add extract_effect_text() helper with proper text joining (separator=' ')
- Update parse_attack(), parse_ability(), _parse_trainer_details() to use it
- Fix JSON encoding in convert_cards.py to use UTF-8 (ensure_ascii=False)

Before: 'Discard an Energy from this Pokémon'
After:  'Discard a Fire Energy from this Pokémon'

Re-scraped all 372 cards and regenerated 382 definitions.
2026-01-27 15:10:02 -06:00
..
energy/basic Add CardService and card data conversion pipeline 2026-01-27 14:16:40 -06:00
pokemon Fix scraper to preserve energy types in effect text 2026-01-27 15:10:02 -06:00
trainer Fix scraper to preserve energy types in effect text 2026-01-27 15:10:02 -06:00
_index.json Fix scraper to preserve energy types in effect text 2026-01-27 15:10:02 -06:00
README.md Add CardService and card data conversion pipeline 2026-01-27 14:16:40 -06:00

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.