Skip to content

Deck

A Deck is the list a player brings to a game. The engine reads the parts it needs to build the game — cards, sideboard, commanders, and the supplementary decks (attractions, contraptions, schemes, planes) — and round-trips the rest unchanged: the remaining fields are client-side state (stack positions, tags, cover art) the engine doesn’t model but preserves so the wire shape stays identical.

Each block below is generated from the same source as the engine bindings (ts-rs for TypeScript, the manabrew-protocol crate for Rust).

The whole deck — its identity, the maindeck and sideboard, the supplementary zones, and the preserved client-side metadata.

interface Deck {
version?: string;
id?: string;
name: string;
description?: string;
color?: string;
format?: DeckFormat;
cards: Array<DeckCard>;
sideboard: Array<DeckCard>;
attractions?: Array<DeckCard>;
contraptions?: Array<DeckCard>;
schemes?: Array<DeckCard>;
planes?: Array<DeckCard>;
commanders?: Array<DeckCard>;
companion?: DeckCard;
maybeboard?: Array<DeckCard>;
draft?: boolean;
labels?: Array<DeckLabel>;
coverCardName?: string;
coverCardFace?: number;
playmat?: string;
playmatSettings?: PlaymatSettings;
stackPositions?: Record<string, { x: number; y: number }>;
tokens?: Array<DeckCard>;
}

References: DeckCard , DeckFormat , DeckLabel , PlaymatSettings

One entry in a deck: a nested identity (which card and printing) plus a flattened rules summary and the UI-only uris.

interface DeckCard {
identity: DeckCardIdentity;
uris: CardImageUris;
allParts?: Array<CardPart>;
color: string;
colorIdentity: Array<string>;
manaCost: string;
cmc: number;
types: Array<string>;
subtypes: Array<string>;
supertypes: Array<string>;
keywords?: Array<string>;
power?: string;
toughness?: string;
text: string;
layout?: string;
isDoubleFaced?: boolean;
/**
* Back face of a transform / modal_dfc card, captured at deck import.
* Absent on single-faced cards and on decks saved before it existed.
*/
backFace?: CardBackFaceSummary;
}

References: CardBackFaceSummary , CardImageUris , CardPart , DeckCardIdentity

Which card a DeckCard is — name, printing (setCode/cardNumber), and an optional foil flag. id is a client-side instance id.

interface DeckCardIdentity {
id: string;
name: string;
setCode: string;
cardNumber: string;
oracleId?: string;
tokenScript?: TokenScript;
foil?: boolean;
}

References: TokenScript

A user-defined label attached to a deck.

interface DeckLabel {
name: string;
color?: string;
}