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. |
||
|---|---|---|
| .. | ||
| energy/basic | ||
| pokemon | ||
| trainer | ||
| _index.json | ||
| README.md | ||
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 namecard_type: "pokemon", "trainer", or "energy"set_id: Which set this card belongs to
See the model documentation for complete field descriptions.