rollFrom関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A roll put back together from its spec and its faces: for a history read from storage and a roll read from a link. The dice, which are kept and the total are all worked out again, never trusted as given. Null when the dice could not have shown those faces.
インポート
import { rollFrom } from "@johnmorrisdotca/korokoro";
定義
function rollFrom(spec: RollSpec, faces: readonly unknown[], id: string, at: number, seed: string | null): Roll | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
spec | RollSpec | Dice counts, sides, rules and modifier; omitted fields use the documented defaults. |
faces | readonly unknown[] | Physical face values, in the order thrown. |
id | string | The id recorded with the reconstructed roll. |
at | number | The recorded time in epoch milliseconds. |
seed | string | null | Text that reproduces the same random sequence, or null for an unseeded stored roll. |
戻り値
Roll | null
A roll put back together from its spec and its faces: for a history read from storage and a roll read from a link. The dice, which are kept and the total are all worked out again, never trusted as given. null when the dice could not have shown those faces.
例
import { rollFrom } from "@johnmorrisdotca/korokoro";
import { normalizeSpec } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
console.log(rollFrom(spec, [2, 5], "saved", 0, null)?.total);7出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。