Skip to content

Formulas ​

Conditions and amounts in the builder are short formulas, like spreadsheet formulas. The builder suggests names as you type and underlines mistakes.

text
count(hand) > 0
var.self.life <= 0
card.cost <= var.self.mana
seats <= 3 ? 7 : 5

Names you can use ​

NameMeans
selfthe player doing this
activethe player whose turn it is
seatshow many players
seatIdsevery player, in seat order
round, phase, stepwhere the game is
var.game.pota game value
var.self.life, var.active.lifea player value (yours, or the active player's)
var[s].lifea player value for player s
hand, decka zone (yours, for players' zones)
zone.hand[s]player s's zone
card.costa field of the card in question

Effects can also name things for the effects after them: a choice (Call the answer target), a roll (as: "dmg"), a For each item (Call it drawn).

Operators ​

+ - * / %, comparisons == != < <= > >=, && (and), || (or), ! (not), and condition ? this : that. Text goes in single quotes: card.suit == 'hearts'. + joins text: 'Pair of ' + rankLabel(r). Lists use brackets: [1, 2, 3], list[0].

Functions ​

Cards and zones ​

Function
count(zone or list)how many
cards(zone)the cards in a zone
top(zone)the top card
all()every card
above(card)the card and every card on top of it (a run in a column)
sum(list, field)add up a field
countWhere(list, field, value)how many have that value
filterBy(list, field, value)the ones with that value
pluck(list, field)one field from each

Lists ​

Function
len(list)how long
min(a, b, …), max(a, b, …)smallest, largest
distinct(list)without repeats
slice(list, from, to)part of a list
concat(list, list, …)join lists
flat(list)a list of lists as one list
join(list, ', ')the items as one text: join(pluck(cards(hand), 'name'), ', ')
contains(list, value)is it in there
allEqual(list, value)are they all that value
filter(list, 'functionName')the ones your function says yes to
map(list, 'functionName')your function applied to each
countIf(list, 'functionName')how many your function says yes to
argmaxBy(list, 'functionName')the best (ties: all of them)
argminBy(list, 'functionName')the lowest

Tables ​

Function
table('id', value, suit)the row of a game's result table for a card value (and suit): an oracle, an encounter, a room. Tables are part of the game's definition (the His Majesty the Worm game uses them).
tableName('id')that table's name

Players and turns ​

Function
seatName(seat)the player's (or character's) name
next(seat)the next player clockwise
nextWhere(seat, variable, value)the next player with that value
seatsWhere(variable, value)the players with that value
seatVars(variable)that value for every player
varsOf(players, variable)that value for these players
acted(seat)has acted this phase
activeSeats()players taking part this phase
everyoneActed()everyone has acted this phase

Cards with abilities ​

Function
has(card, 'ability')the card has that ability or keyword
abilityValue(card, 'ability')the number after it on the card (Burn 2 → 2)
abilities(card)the card's abilities

Playing cards and poker ​

Function
rankLabel(rank)'J', 'Q', 'K', 'A'…
pokerRank(cards)a poker hand's strength, to compare
pokerHandName(cards)"Full house", "Two pair"…

Your own functions ​

On Rules → Formulas, give a formula a name and inputs, then use it anywhere: askable(s) = s != self && count(zone.hand[s]) > 0, then filter(seatIds, 'askable').

Placeholders in text ​

Roll formulas and labels can include formulas in braces: 1d20 + {var.self.bonus}, {f.dice} (a card's dice field, like 2d4+1), and a label {f.name} shows the card's name.