Outcome型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
How a roll is read in a game. A reading is one of a small, fixed set of
named functions, so that a new game is a line of data and rarely new code.
Each takes the dice, kind by kind, and says what they come to in the game's
own terms: an outcome with a stable name, and the figures that go with it.
The words for each outcome, in English and Japanese, are in words.ts.
Readings are small and particular on purpose. They do not run a game (turn order, scores across rounds): they read one roll, with the rolls just before it where a game needs them, as craps does for its point.
インポート
import type { Outcome } from "@johnmorrisdotca/korokoro";
定義
type Outcome = {
outcome: string;
values: Record<string, string | number>;
tone: "good" | "bad" | "plain";
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
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. |
例
import type { Outcome } from "@johnmorrisdotca/korokoro";
import { getPreset, presetSpec, roll, seededSource, readDiceAs } from "@johnmorrisdotca/korokoro";
const value: Outcome = readDiceAs(getPreset("cho-han")!.reading, roll(presetSpec(getPreset("cho-han")!), seededSource("docs"), 0));
console.log(value.outcome);han出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。