Skip to content

Shared types

The prompt protocol is built from a small set of reusable structures. Instead of redefining them on every prompt page, they’re collected here - each prompt’s arguments link back to the entries it uses.

The title/description header most modal prompts open with. The client is supposed to use this information to add visual clarity about what card or effect triggered the specific prompt being shown.

interface PromptPresentation {
title: string;
description?: string;
text?: string;
targets: Array<TargetRef>;
}

References: TargetRef

A typed reference to a player, card, or spell. intent and oracle are hints for the UI to optionally annotate the target.

interface TargetRef {
kind: TargetKind;
id: string;
intent?: TargetingIntent;
oracle?: string;
}

References: TargetKind , TargetingIntent

Which id space a TargetRef points into - a player, a card, or a spell on the stack.

type TargetKind = "player" | "card" | "spell";

Specifically used for scry-style prompts that need to sort and divide cards into specific zones.

type ScryDestination =
| "libraryTop"
| "libraryBottom"
| "graveyard"
| "exile"
| "hand";

One player’s dice result.

interface DiceRollEntry {
label?: string;
playerId?: string;
round: number;
naturalResults: Array<number>;
finalResults: Array<number>;
ignoredRolls: Array<number>;
highlighted: boolean;
}

One legal action. Offered by chooseAction: cast a spell, activate an ability, or undo a mana activation.

type AvailableAction = { id: string } & (
| { type: "cast"; cardId: string; mode: PlayCardMode; label: string }
| ({ type: "activateAbility" } & ActivatableAbilityInfo)
| { type: "undoMana"; cardId: string }
);

References: ActivatableAbilityInfo , PlayCardMode

A mana ability the player can activate while paying a cost (payManaCost).

interface ActivatableAbilityInfo {
cardId: string;
abilityIndex: number;
description: string;
isManaAbility: boolean;
isClassLevelUp?: boolean;
cost?: string;
producedMana?: Array<Mana>;
}

References: Mana

A creature that can attack, with the set of targets it may attack (chooseAttackers).

interface AttackerOptionDto {
attackerId: string;
validTargetIds: Array<string>;
mustAttack: boolean;
}

Something an attacker can be declared against - a player, planeswalker, or battle.

interface AttackTargetDto {
id: string;
label: string;
kind: AttackTargetKind;
}

References: AttackTargetKind

Which kind of thing an AttackTargetDto is.

type AttackTargetKind = "player" | "planeswalker" | "battle";

An incoming attacker and how it may be blocked (chooseBlockers).

interface BlockableAttackerDto {
attackerId: string;
validBlockerIds: Array<string>;
minBlockers: number;
maxBlockers?: number;
mustBeBlocked: boolean;
}

Taken directly from the Forge spec. This is a definition used to distinguish tokens with the same name but different rules, such as two 2/2 white Knight tokens with different abilities. It is an opaque string on the wire.

Examples are w_2_2_knight_vigilance or w_2_2_knight_flying See Forge’s tokenscripts directory for the canonical definitions.

type TokenScript = string;