Reference · Rolls and exact odds
PresetReadingtype
What a game makes of a roll: the outcome, and the words for it.
Import it
import type { PresetReading } from "@johnmorrisdotca/korokoro";
Definition
type PresetReading = Outcome & {
text: string;
};
Members
| Name | Type | Description |
|---|---|---|
outcome | string | The outcome's name within its reading: "natural", "point", "yahtzee". |
values | Record<string, string | number> | The figures the outcome's words are filled in with. |
tone | "good" | "bad" | "plain" | Whether it is good news, bad news or neither, for a tray to colour. |
text | string | The reading in a sentence, in English. Empty for a die that says it all itself, such as a coin. |
Examples
import type { PresetReading } from "@johnmorrisdotca/korokoro";
import { getPreset, presetSpec, roll, seededSource, readPreset } from "@johnmorrisdotca/korokoro";
const value: PresetReading = readPreset(getPreset("cho-han")!, roll(presetSpec(getPreset("cho-han")!), seededSource("docs"), 0));
console.log(value.text);Han: 3 is oddWhat it prints (run when this page was built)