ExportedRoll型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
One roll as the JSON export writes it.
インポート
import type { ExportedRoll } from "@johnmorrisdotca/korokoro";
定義
type ExportedRoll = {
id: string;
notation: string;
spec: Roll["spec"];
faces: number[];
kept: boolean[];
total: number;
successes?: true;
words?: string[];
at: number;
time: string;
seed: string | null;
held?: boolean[];
loaded?: true;
set?: Roll["set"];
dice: DieRoll[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
id | string | |
notation | string | The dice as notation, its label included. |
spec | RollSpec | The same dice as a spec: what |
faces | number[] | Every die thrown, in the order thrown. |
kept | boolean[] | Which faces count. |
total | number | |
successes (省略可) | true | undefined | True when the total is a count of successes. Left out otherwise. |
words (省略可) | string[] | undefined | What the faces say, on a roll of custom dice. Left out otherwise. |
at | number | Epoch milliseconds, and the same moment as ISO 8601 in UTC. |
time | string | |
seed | string | null | |
held (省略可) | boolean[] | undefined | |
loaded (省略可) | true | undefined | |
set (省略可) | { id: string; index: number; of: number; } | undefined | |
dice | DieRoll[] | What became of each die. |
例
import type { ExportedRoll } from "@johnmorrisdotca/korokoro";
import { DEFAULT_SPEC, rollFrom, exportedRoll } from "@johnmorrisdotca/korokoro";
const value: ExportedRoll = exportedRoll(rollFrom(DEFAULT_SPEC, [2, 5], "saved", 0, null)!);
console.log(value.total);7出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。