Skip to content

Flesh and Blood card data ​

Ruleset and calculator scripts get Flesh and Blood cards as plain objects straight from the card catalog. This page lists every field on those objects and in the catalog globals, with a real example and a few recipes.

Where the cards show up:

  • Card rules receive one card as their first argument.
  • Deck and deck set rules receive cardsById, an object keyed by card ref that holds every card in the deck (it can hold more).
  • Calculators receive cardsById as their second argument.

See the ruleset script API and the calculator script API for the full function signatures.

Card keys and deck refs ​

A Flesh and Blood card in the catalog is a card identity: one card name at one pitch, with every printing of it listed under printings. The red, yellow and blue versions of a card are three identities, so Command and Conquer in red is its own card. Three kinds of id matter:

  • The identity id, card.id: fab- plus a hash, like fab-d2dbc5d0a6028396c6ed.
  • A printing id: one set and collector number in lowercase, like arc159.
  • A variant id: one edition and foiling of a printing, like arc159:f-r (first edition, rainbow foil). A variant's metadata carries its edition, foiling, rarity and TCGplayer product id.

A double-faced card is one identity keyed on its front face; the back face is on game.backFace and is never a deck card on its own.

cardsById is keyed by the deck's refs, and each one points to its identity:

  • Count copies of "the same card" by card.id, not by ref.
  • To read the printing a ref points to, find it in the list: card.printings.find((p) => p.id === ref).
  • ctx.globals.printings[ref] gives the identity id for a printing id, when globals are available.

A card rule gets the identity card itself, so card.id is always the identity id.

The game fields describe the identity. rarity is the rarity of its default printing (game.defaultPrintingId, the latest released standard-foil printing), and each printing's metadata has its own rarity and artists.

Guard against a missing card before reading from it: cardsById[ref] can be undefined when the catalog doesn't know a ref.

Card fields ​

Every card, in every game, has these top-level fields:

PropertyTypeDescription
idstringCatalog id of the card identity ("01DE012" in LoR, "pikachu-ex--1f29b66b68bc" in Pokémon).
slug?stringThe card's public URL segment (#2189, ADL §64): a frozen English slug, identical in every locale. Equals id for a game whose readable slugs are off (readableCardSlugsEnabled in @turny/game-adapters) or a card that has no readable slug yet. Pokémon keeps its <name>--<hash12> id as its slug; LoR's switch stays off for good, so its URLs stay its card codes. A page whose route param already equals slug renders; any other known key (the id, a history slug, an alias) redirects to it, so a card whose slug equals its id never redirects to itself.

The catalog export (#2193) writes it only for a switched-on game and only when it differs from id, so an absent slug means the id: always read it through cardSlugOf (@turny/game-adapters).
namestringDisplay name in the catalog locale.
setCodestringSet of the card, or of its default printing ("set1", "sv2", "OGN").
collectible?booleanFalse for cards that can't go in a deck (LoR tokens and level-ups).
assets?CardCatalogCardAssetContract[]Images of the card's default printing.
printings?CardPrintingContract[]Every printing of the identity, default printing first (only some on a partial card, see partialPrintings). Absent in LoR.
printingCount?numberLean list files (#1323), which omit printings, partial cards (see partialPrintings) and per-identity core files (#1522): how many printings the full card has. Absent on full cards and in games without printings.
printingSetCodes?string[]Lean list files (#1323), partial cards and per-identity core files: the distinct set codes across the full card's printings, in printing order. Absent on full cards.
printingsFile?stringPer-identity core files (#1522) only: the card's printings file (identities/<id>.printings.<hash8>.json, relative to the locale directory, see cardCatalogIdentityPrintingsFileName), in place of printings. Absent when the printings are inline in the core file.
partialPrintings?booleanTrue on a partial card (the featured-cards bundle, #1330): printings holds only some of the identity's printings (its default printing plus the ones the featured content references), while printingCount / printingSetCodes summarize all of them. Absent on full and list cards.
hasImage?booleanFalse when none of the card's printings has an image in this language. Absent means it has one.
languages?CardLanguageEntry[]Catalog locales that hold real text for this card (#2552). A locale whose entry is only fallback text is absent. Absent on older exports and in single-locale games.
game?TGameDataGame-specific fields; see the per-game *CardGameData type.

Each entry of languages (CardLanguageEntry):

PropertyTypeDescription
localestringCatalog locale ("zh-tw", "de_de"), not an app locale.
statusCardLanguageStatusWhere the text comes from: official (printed) or unofficial (a translation).

Values of a language entry's status (CardLanguageStatus):

MemberValueDescription
Official"official"Printed in this language by the publisher.
Unofficial"unofficial"Real text the publisher did not print in this language: a reconstruction or a translation.

Printings ​

Each entry of printings (CardPrintingContract):

PropertyTypeDescription
idstringPrinting id; deck refs use it ("sv2-11" for Pokémon, "ogn-030-298" for Riftbound).
setCodestringSet the printing belongs to ("sv2", "OGN").
number?stringCollector number within the set.
language?stringLanguage of the printing, when it is not the catalog's own.
releaseDate?stringRelease date as the source gives it ("2023/06/09").
assets?CardCatalogCardAssetContract[]This printing's own images.
variants?CardVariantContract[]Treatments of this printing (foil, alternate art, …).
metadata?JsonObjectExtra per-printing data (rarity, artist, store ids); game-specific.

Each entry of a printing's variants:

PropertyTypeDescription
idstringVariant id, usually <printing id>:<kind> ("ogn-030-298:normal").
kind?stringTreatment kind ("normal", "foil", "alternate_art"); values are per game.
label?stringDisplay label, when the kind alone is not enough.
metadata?JsonObjectExtra per-variant data; game-specific.

Each entry of assets (on the card and on each printing):

PropertyTypeDescription
kindCardAssetKindWhat the image shows: "card" (framed render), "full" (full art), "icon", "banner", "slice", "portrait", …
urlstringImage URL.
format?CardAssetFormatImage format ("webp"), when known.
width?numberWidth in pixels, when known.
height?numberHeight in pixels, when known.
metadata?JsonObjectExtra per-asset data; game-specific.

Game fields (card.game) ​

Everything specific to Flesh and Blood lives on card.game. Types, classes and talents are lower-case tokens with spaces and hyphens turned into _ (defense_reaction, demi_hero); look them up in the globals for display names. A stat the card doesn't have is null, and a printed X or * is null too, with the raw value in variableStats.

PropertyTypeDescription
pitchFabPitch | nullPitch value; null for cards without a colour bar. Part of the identity.
colorFabPitchColor | nullThe printed colour bar as the source spells it, null when there is none. Almost always FAB_PITCH_COLOR_BY_PITCH of pitch, but not always: Goldfin Harpoon is printed yellow with no pitch value, so a text decklist line Goldfin Harpoon (Yellow) must match on colour, not pitch.
costnumber | nullResource cost.
powernumber | nullAttack power.
defensenumber | nullDefense value.
healthnumber | nullHero (and demi-hero / ally) life total.
intelligencenumber | nullHero hand size.
arcanenumber | nullArcane damage the card deals.
variableStats?FabVariableStatsNon-numeric printed stats ({ cost: "X" }); absent when every stat is numeric.
typesFabCardType[]Structural types, sorted (["action", "attack"]).
classesFabClass[]Classes; ["generic"] for class-less cards, two for hybrid cards.
talentsFabTalent[]Talents; empty for untalented cards.
subtypesstring[]The rest of the type line as source tokens (["Sword"], ["Young"], ["Evo", "Base"]); open-ended, never compared as an enum.
equipmentSlotFabEquipmentSlot | nullSlot an equipment takes; null for anything else.
weaponHandsFabWeaponHands | nullHands a weapon takes; null for anything else.
keywordsstring[]The card's own keywords as source tokens (["Go again", "Dominate"]).
isHerobooleanTrue for heroes (adult and young).
isYoungHerobooleanTrue for young heroes (Blitz / Silver Age); adult heroes play CC and LL.
playedHorizontallybooleanPrinted landscape (Landmarks, some macros); gets its own art window.
legalitiesFabCardLegalitiesLegality per format (see Legalities below).
extraLegalities?{ upf: CardLegalityStatus; } & JsonObjectFormats carried as source legality data only, no Turny rule or preset (Ultimate Pit Fight).
defaultPrintingId?stringThe representative printing (latest released standard-foil, no art variation); the deck-legal ref the builder pool exposes.
isProvisional?booleanTrue while no printing of the card has released yet; absent once released.
rarityFabRarity | nullRarity of the representative (default) printing's base variant.
backFace?FabCardBackFaceThe back face of a double-faced card (see the module header); absent on single-faced cards. Back faces have no legality or pitch of their own.
text?stringRules text with the source's markdown-ish markup.
textPlain?stringRules text as plain text.
typeText?stringThe printed type line ("Guardian Action - Attack").

Legalities ​

The legalities object, one entry per format:

PropertyTypeDescription
ccCardLegalityStatusClassic Constructed.
blitzCardLegalityStatusBlitz.
llCardLegalityStatusLiving Legend.
commonerCardLegalityStatusCommoner.
silver_ageCardLegalityStatusSilver Age.

Variable stats ​

The variableStats object:

PropertyTypeDescription
cost?stringPrinted cost ("X").
power?stringPrinted attack power ("*").
defense?stringPrinted defense.
health?stringPrinted life.
intelligence?stringPrinted intellect.
arcane?stringPrinted arcane damage.

Back face ​

The backFace object of a double-faced card:

PropertyTypeDescription
namestringThe back face's printed name.
typesFabCardType[]Structural types, as on the front face.
classesFabClass[]Classes, as on the front face.
talentsFabTalent[]Talents, as on the front face.
subtypesstring[]The rest of the type line as source tokens.
costnumber | nullResource cost.
powernumber | nullAttack power.
defensenumber | nullDefense value.
healthnumber | nullLife total.
intelligencenumber | nullHand size.
arcanenumber | nullArcane damage.
variableStats?FabVariableStatsNon-numeric printed stats; absent when every stat is numeric.
keywordsstring[]The back face's keywords as source tokens.
text?stringRules text with the source's markdown-ish markup.
textPlain?stringRules text as plain text.
typeText?stringThe printed type line.

Printing metadata ​

Each printing's metadata:

PropertyTypeDescription
rarityFabRarityRarity of the printing's BASE variant (standard foiling, no art variation). Rarity varies across a printing's variants (a cold-foil full-art variant of a Common is Marvel), so per-variant rarity lives on FabVariantMetadata.rarity.
artists?string[]Artists credited on the printing.
flavorText?stringPrinted flavour text, when any.

Variant metadata ​

Each printing variant's metadata:

PropertyTypeDescription
editionFabEditionPrint run ("first", "unlimited", "none", …).
foilingFabFoilingFoil treatment ("standard", "rainbow_foil", "cold_foil", …).
rarityFabRarityThis variant's own rarity (the source gives one per edition x foiling x art).
artVariations?string[]Source art-variation codes (["AA"] for alternate art, ["EA"] extended art).
tcgplayerProductId?stringTCGplayer product id, when the variant is listed there.
imageUrl?stringThe source render for this variant (the LSS image host, or a fallback host).
backImageUrl?stringA same-card _BACK render (double-sided Marvel heroes); not a second face.

Globals (ctx.globals) ​

The catalog's globals are lookup tables for the values on a card (classes: ["guardian"] resolves through ctx.globals.classes.guardian), the keyword glossary, the rules-text symbols and the printing map.

When globals are available

Globals are passed to ruleset scripts as ctx.globals (the last argument). Calculators may not receive ctx at all, and a ruleset can run without it too. Always check ctx && ctx.globals before using them and fall back to the raw value.

PropertyTypeDescription
classes?Record<string, FabCatalogLookupEntry>By FabClass value.
talents?Record<string, FabCatalogLookupEntry>By FabTalent value.
types?Record<string, FabCatalogLookupEntry>By FabCardType value.
rarities?Record<string, FabCatalogLookupEntry>By FabRarity value.
formats?Record<string, FabCatalogLookupEntry>By FabFormat value (the legalities keys).
sets?Record<string, FabCatalogSetLookupEntry>By source set id.
keywords?Record<string, FabCatalogKeywordLookupEntry>By source keyword name.
symbols?Record<string, FabCatalogSymbolEntry>Card-text symbol inventory keyed by symbol key (p, r, d, h, i, t, c, u, x).
printings?Record<string, string>Printing id → owning card identity id ("mst131" → "fab-…"), covering every emitted printing. A double-faced card's shared printing id maps to the front face's identity. Identity ids are never self-mapped. Same name and meaning as the other games' globals.printings.

Lookup entries ​

Every table except symbols and printings maps a key to an entry with these fields:

PropertyTypeDescription
labelstringDisplay name in the catalog locale ("Attack Reaction").
color?stringDisplay color set by an operator override; usually absent.
icon?string | nullIcon image URL set by an operator override; usually absent.
order?numberSort position in filters and lists, lowest first.
showInFilter?booleanWhether the entry is offered as a filter option; absent means shown.
metadataRef?FabCatalogMetadataReferenceAnchor an operator override is matched on.

Set entries ​

Entries of sets add:

PropertyTypeDescription
releaseDate?string | nullRelease date (YYYY-MM-DD) of the set's earliest edition, when known.

Keyword entries ​

Entries of keywords add:

PropertyTypeDescription
description?stringReminder text: what the keyword does.

Symbol entries ​

Each entry of symbols:

PropertyTypeDescription
tokenstringThe inline token as it appears in rules text ("{p}").

Example card ​

Command and Conquer (red), trimmed to two printings with one image each:

json
{
  "id": "fab-d2dbc5d0a6028396c6ed",
  "slug": "command-and-conquer-red",
  "name": "Command and Conquer",
  "setCode": "1HP",
  "collectible": true,
  "assets": [
    {
      "kind": "card",
      "url": "https://cdn.turny.gg/cards/fab/assets/fab-d2dbc5d0a6028396c6ed-card-6265564160020d520a166028818ab80890d155e11b5011dec5acf49eee39f16b.webp"
    }
  ],
  "printings": [
    {
      "id": "1hp360",
      "setCode": "1HP",
      "number": "360",
      "releaseDate": "2022-05-06",
      "variants": [
        {
          "id": "1hp360:n-s",
          "kind": "standard",
          "metadata": {
            "edition": "none",
            "foiling": "standard",
            "rarity": "majestic",
            "tcgplayerProductId": "270947",
            "imageUrl": "https://legendstory-production-s3-public.s3.amazonaws.com/media/cards/large/1HP360.webp"
          }
        }
      ],
      "metadata": {
        "rarity": "majestic",
        "artists": ["Fajareka Setiawan"]
      }
    },
    {
      "id": "arc159",
      "setCode": "ARC",
      "number": "159",
      "releaseDate": "2020-03-27",
      "assets": [
        {
          "kind": "card",
          "url": "https://cdn.turny.gg/cards/fab/assets/arc159-card-942a45de4e645df90c415a928ec2007b8af8c13483aae1f4e02013da317861ea.webp"
        }
      ],
      "variants": [
        {
          "id": "arc159:f-r",
          "kind": "rainbow_foil",
          "metadata": {
            "edition": "first",
            "foiling": "rainbow_foil",
            "rarity": "majestic",
            "tcgplayerProductId": "225899",
            "imageUrl": "https://legendstory-production-s3-public.s3.amazonaws.com/media/cards/large/ARC159-RF.webp"
          }
        },
        {
          "id": "arc159:f-s",
          "kind": "standard",
          "metadata": {
            "edition": "first",
            "foiling": "standard",
            "rarity": "majestic",
            "tcgplayerProductId": "225899",
            "imageUrl": "https://legendstory-production-s3-public.s3.amazonaws.com/media/cards/large/ARC159.webp"
          }
        },
        {
          "id": "arc159:u-r",
          "kind": "rainbow_foil",
          "metadata": {
            "edition": "unlimited",
            "foiling": "rainbow_foil",
            "rarity": "majestic",
            "tcgplayerProductId": "225899",
            "imageUrl": "https://legendstory-production-s3-public.s3.amazonaws.com/media/cards/large/U-ARC159-RF.webp"
          }
        },
        {
          "id": "arc159:u-s",
          "kind": "standard",
          "metadata": {
            "edition": "unlimited",
            "foiling": "standard",
            "rarity": "majestic",
            "tcgplayerProductId": "225899",
            "imageUrl": "https://legendstory-production-s3-public.s3.amazonaws.com/media/cards/large/U-ARC159.webp"
          }
        }
      ],
      "metadata": {
        "rarity": "majestic",
        "artists": ["Fajareka Setiawan"]
      }
    }
  ],
  "hasImage": true,
  "game": {
    "pitch": 1,
    "color": "red",
    "cost": 2,
    "power": 6,
    "defense": 3,
    "health": null,
    "intelligence": null,
    "arcane": null,
    "types": ["action", "attack"],
    "classes": ["generic"],
    "talents": [],
    "subtypes": [],
    "equipmentSlot": null,
    "weaponHands": null,
    "keywords": [],
    "isHero": false,
    "isYoungHero": false,
    "playedHorizontally": false,
    "legalities": {
      "cc": "legal",
      "blitz": "legal",
      "ll": "legal",
      "commoner": "not_legal",
      "silver_age": "not_legal"
    },
    "extraLegalities": {
      "upf": "unknown"
    },
    "rarity": "majestic",
    "text": "Defense reaction cards can't be played this chain link. When this hits a hero, destroy all cards in their arsenal.",
    "textPlain": "Defense reaction cards can't be played this chain link. When this hits a hero, destroy all cards in their arsenal.",
    "typeText": "Generic Action - Attack",
    "defaultPrintingId": "1hp360"
  }
}

Common recipes ​

js
// Calculator: copies per pitch value. Cards without a colour bar are left out.
export default function compute(pile, cardsById) {
  const counts = { red: 0, yellow: 0, blue: 0 };

  Object.keys(pile).forEach((ref) => {
    const game = (cardsById[ref] && cardsById[ref].game) || {};

    if (game.color in counts) {
      counts[game.color] += pile[ref];
    }
  });

  return {
    widgets: [
      {
        kind: "donut",
        label: "Pitch",
        segments: Object.keys(counts).map((color) => ({
          label: color,
          value: counts[color],
        })),
      },
    ],
  };
}
js
// Calculator: copies at each resource cost, 4+ grouped.
export default function compute(pile, cardsById) {
  const buckets = [0, 0, 0, 0, 0];

  Object.keys(pile).forEach((ref) => {
    const game = (cardsById[ref] && cardsById[ref].game) || {};

    if (typeof game.cost !== "number") {
      return; // Heroes, equipment and X costs have no number.
    }

    buckets[Math.min(game.cost, 4)] += pile[ref];
  });

  return {
    widgets: [
      {
        kind: "histogram",
        label: "Cost curve",
        buckets: buckets,
        labels: ["0", "1", "2", "3", "4+"],
      },
    ],
  };
}
js
// Card rule: legal in Classic Constructed.
export default function validateCard(card) {
  const legalities = (card.game && card.game.legalities) || {};

  if (legalities.cc === "legal" || legalities.cc === "restricted") {
    return true;
  }

  return {
    valid: false,
    issues: [{ message: card.name + " is not legal in Classic Constructed." }],
  };
}
js
// Card rule: Guardian or generic cards only. Uses the class's display name when globals exist.
export default function validateCard(card, ctx) {
  const classes = (card.game && card.game.classes) || [];

  if (classes.indexOf("guardian") !== -1 || classes.indexOf("generic") !== -1) {
    return true;
  }

  const globals = ctx && ctx.globals;
  const guardian =
    globals && globals.classes && globals.classes.guardian
      ? globals.classes.guardian.label
      : "guardian";

  return {
    valid: false,
    issues: [{ message: card.name + " is not a " + guardian + " card." }],
  };
}

Turny.gg documentation