Reference · Rolls and exact odds
DieRolltype
One die of a roll: the face it showed and what became of it.
Import it
import type { DieRoll } from "@johnmorrisdotca/korokoro";
Definition
type DieRoll = {
face: number;
status: DieStatus;
exploded: boolean;
die: number;
group?: number;
label?: string;
value?: number;
counts?: 1 | -1;
critical?: "success" | "failure";
};
Members
| Name | Type | Description |
|---|---|---|
face | number | The face it showed. A Fate die shows −1, 0 or 1. |
status | DieStatus | Whether it counts, was dropped, or was thrown again. |
exploded | boolean | It showed its highest face and threw the die after it. |
die | number | Which of the dice asked for this one belongs to, from 0 and counted across the whole roll: a reroll or an explosion belongs to the die that caused it. |
group (optional) | number | undefined | Which kind of dice it is, from 0, in a roll of several kinds. Left out in a roll of one kind. |
label (optional) | string | undefined | What the face says, on a custom die. Left out of a numbered die. |
value (optional) | number | undefined | What the die is worth in the total when that is not its face: a custom face's value (0 for a face that is only words), a face raised or lowered by |
counts (optional) | 1 | -1 | undefined | In a roll that counts successes: 1 on a die that is a success, −1 on one that takes a success away. Left out of every other die. A compounding die's count is on the last die of its chain. |
critical (optional) | "success" | "failure" | undefined | A die marked by |
Examples
import type { DieRoll } from "@johnmorrisdotca/korokoro";
import { DEFAULT_SPEC, readDice } from "@johnmorrisdotca/korokoro";
const value: DieRoll = readDice(DEFAULT_SPEC, [2, 5])![0]!;
console.log(value.face);2What it prints (run when this page was built)