# Drawstep — Yu-Gi-Oh! TCG: table model (ruleset) Generated from Drawstep's game registry (engine id `yugioh`). Wiki page: https://drawstep.xyz/wiki/yugioh · this document: https://drawstep.xyz/wiki/drawstep-yugioh-ai-pack.md. Two duelists start at 8000 LP and summon monsters, set Spells and Traps and battle until one of them runs out of LP. Every official card is in the library with its ATK / DEF, Level, Attribute, type and the current TCG Forbidden & Limited list; deck building checks the Main, Extra and Side Deck sizes and the banlist. Assisted tables run the turn's structure; effects, chains and battle damage are resolved by the duelists. ## How a table plays Yu-Gi-Oh! Tables offer **assisted** play — the free table plus Yu-Gi-Oh!'s ruleset — and **free** play (no rules at all). Card text is never executed: it is shown on the card and resolved by the players. The ruleset is plain data in `packages/game-registry/src/games/yugioh.ts`, run by `RulesetTable` (`packages/engine/src/ruleset.ts`). Turn: Draw → Standby → Main 1 (main) → Battle → Main 2 (main) → End. Only the player whose turn it is moves it on (Next phase / End turn); automatic phases pass by themselves. What the table does by itself: - Deals 5 cards each; the player going first skips their first draw. - Draw and Standby Phases pass by themselves; the turn player moves on from Main 1 to Battle, Main 2 and End. - Counts the Normal Summon / Set of the turn (a monster from the hand to a Main Monster Zone) — Special Summons are yours to tell apart. - Holds the end of the turn until the hand is down to 6. - A player whose LP reach 0, or who has to draw from an empty Deck, loses. What the players do by hand: - Activating effects and building chains - Tributes, Special Summons and the summoning conditions of Extra Deck monsters - Battle: attack targets, damage calculation, changing LP - The first player not attacking on their first turn How a game is won: - The opponent's LP reach 0 (the table checks the LP counter). - The opponent has to draw from an empty Deck (the table checks). - Card effects that win the Duel (Exodia, Final Countdown) — declared by the players. The publisher's rules: https://www.yugioh-card.com/en/rulebook/ · official cards from YGOPRODeck (https://ygoprodeck.com/api-guide/) · card pictures: YGOPRODeck's, hosted by this server (they ask not to be hotlinked). ## Card format A Yu-Gi-Oh! card is a card definition with `"game": "yugioh"` and a `tcg` payload — the printed data the ruleset reads (its category, its cost, the numbers on it). Cards are plain data: put the printed text in `text`; do **not** invent ability JSON. ```json { "id": "my-card", "name": "My Card", "game": "yugioh", "source": "custom", "types": [ "Monster" ], "subtypes": [ "Trait" ], "colors": [ "DARK" ], "text": "Printed rules text.", "tcg": { "category": "Monster", "cost": 2, "stats": { "level": 1, "atk": 1, "def": 1 }, "attributes": [ "DARK" ], "traits": [ "Trait" ], "extra": { "property": "…", "archetype": "…" } }, "image": { "normal": "https://… (optional full-card image)" } } ``` Fields (the Card Studio's form): `traits` (Type; Monster only), `attributes` (Attribute: DARK / LIGHT / EARTH / WATER / FIRE / WIND / DIVINE; Monster only), `stats.level` (Level / Rank / Link; Monster only), `stats.atk` (ATK; Monster only), `stats.def` (DEF; Monster only), `extra.property` (Property: Normal / Quick-Play / Continuous / Equip / Field / Ritual / Counter; Spell, Trap only), `extra.archetype` (Archetype), `text` (Card text). Categories: Monster, Spell, Trap. ## Zones | Zone | Label | Kind | Visibility | Notes | |---|---|---|---|---| | `library` | Deck | pile | hidden | ordered | | `hand` | Hand | hand | owner | | | `monster` | Main Monster Zones | slots | public | 5 slots | | `spellTrap` | Spell & Trap Zones | slots | public | 5 slots | | `field` | Field Zone | slots | public | 1 slot | | `extraMonster` | Extra Monster Zones | slots | public | shared · 2 slots | | `extra` | Extra Deck | pile | owner | | | `graveyard` | Graveyard | pile | public | ordered | | `banished` | Banished | pile | public | | Hand zone: `hand` · library: `library` · main surface: `monster` · discard: `graveyard`. Seats: 2. ## Counters - `lp` — LP, starts at 8000 (primary) ## Phases Draw → Standby → Main 1 → Battle → Main 2 → End ## Deck rules A deck list is `{ "name", "engine": "yugioh", "format", "zones": { "": ["", …] } }`; copies are repeated ids. Formats: | Format | Zones (min–max, allowed types) | Max copies | Notes | |---|---|---|---| | Advanced | Main Deck (`main`): 40–60; Extra Deck (`extra`): 0–15, Fusion/Synchro/Xyz/Link; Side Deck (`side`): 0–15 | 3 | lp 8000 · legality: tcg | | Traditional | Main Deck (`main`): 40–60; Extra Deck (`extra`): 0–15, Fusion/Synchro/Xyz/Link; Side Deck (`side`): 0–15 | 3 | lp 8000 | | Custom | Main Deck (`main`): 1+; Extra Deck (`extra`): 0+, Fusion/Synchro/Xyz/Link; Side Deck (`side`): 0+ | 99 | | ## Card adapter Types: Monster, Spell, Trap · resource: Level / Rank · stats: ATK / DEF · colors: DARK, LIGHT, EARTH, WATER, FIRE, WIND, DIVINE.