readPreset関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Read a roll the way a game does. before is the rolls made just before it
in the same game, oldest first, for a game that reads a roll in their
light: the point in craps, a turn's total in Pig. language is "en" or
"ja". The roll may be of other dice than the preset opens with (a pool made
larger, a bonus added): it is read all the same.
インポート
import { readPreset } from "@johnmorrisdotca/korokoro";
定義
function readPreset(preset: Preset, thrown: Roll, before?: readonly Roll[], language?: "en" | "ja"): PresetReading
引数
| 名前 | 型 | 説明 |
|---|---|---|
preset | Preset | The game preset whose dice and reading are used. |
thrown | Roll | The completed roll to read or announce. |
before (省略可) | readonly Roll[] | Earlier rolls needed by a reading with a running result. |
language (省略可) | "en" | "ja" | English or Japanese for the reading text. |
戻り値
PresetReading
Read a roll the way a game does. before is the rolls made just before it in the same game, oldest first, for a game that reads a roll in their light: the point in craps, a turn's total in Pig. language is "en" or "ja". The roll may be of other dice than the preset opens with (a pool made larger, a bonus added): it is read all the same.
例
import { readPreset } from "@johnmorrisdotca/korokoro";
import { getPreset, normalizeSpec, rollFrom } from "@johnmorrisdotca/korokoro";
const preset = getPreset("cho-han")!;
const spec = normalizeSpec({ count: 2, sides: 6 });
const sample = rollFrom(spec, [2, 5], "saved", 0, null)!;
console.log(readPreset(preset, sample, [], "en").text);Han: 7 is odd出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。