本文へ移動

Korokoroコロコロ

ダイスを組み合わせて振り、ダイス表記を読み取り、正確な確率を調べます。履歴の保存やシードを指定した再現もできます。

「コロコロ」は、小さなものが転がる様子を表す言葉です。 名前について(英語)

目次

リファレンス · ロールと正確な確率

RollSpec型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

What to roll: the dice, the bonus, and the rules. A roll of one kind of die is { count, sides, modifier, keep } and whichever optional fields it uses. A roll of several kinds keeps its first kind there and the others in more, so a one-kind spec is the same object it always was.

インポート

import type { RollSpec } from "@johnmorrisdotca/korokoro";

定義

type RollSpec = DiceGroup & {
    modifier: number;
    more?: DiceGroup[];
    times?: number;
    math?: MathNode;
    label?: string;
};

メンバー

名前型説明
countnumber

How many dice: at least 1, and no more than MAX_DICE over the whole roll.

sidesSides

The kind of die: 2 to 1000 sides, or "F" for a Fate die.

keepKeep

Which dice count towards the total.

keepCount (省略可)number | undefined

How many dice highest or lowest keep. Left out when it is one.

explode (省略可)true | undefined

A die showing its highest face throws another, which may do the same. Left out when the dice do not explode.

reroll (省略可)number | undefined

A die showing this face or lower is thrown again, once, and the new face stands: ro< in notation. Left out when nothing is rerolled once.

rerollUntil (省略可)number | undefined

A die showing this face or lower is thrown again until it shows more, up to MAX_REROLLS times: r< in notation. Left out when nothing is rerolled until clear.

rerollWhen (省略可)Compare | undefined

A die meeting this is thrown again, once: ro>=5, ro=3. For the comparisons reroll cannot say; left out otherwise.

rerollUntilWhen (省略可)Compare | undefined

A die meeting this is thrown again until it does not, up to MAX_REROLLS times: r=3, r>=5. For the comparisons rerollUntil cannot say; left out otherwise.

explodeWhen (省略可)Compare | undefined

With explode: the faces that explode, when they are not just the highest. !>=5 in notation. Left out when only the highest face explodes.

explodeKind (省略可)ExplodeKind | undefined

With explode: how the extra dice are added up. Left out for ordinary explosions.

floor (省略可)number | undefined

The least a die counts for: a face below it counts as it. min2 in notation.

ceiling (省略可)number | undefined

The most a die counts for: a face above it counts as it. max5 in notation.

success (省略可)Compare | undefined

The dice are counted, not added: each die meeting this is one success, and the total is how many. >=8 in notation.

failure (省略可)Compare | undefined

With success: each die meeting this takes one success away. f=1 in notation.

critical (省略可)Compare | undefined

Dice meeting this are marked as critical successes. Only a mark: the total is the same. cs>=19 in notation.

fumble (省略可)Compare | undefined

Dice meeting this are marked as critical failures. Only a mark. cf<=2 in notation.

sort (省略可)"ascending" | "descending" | undefined

The order the dice are shown in: sa ascending, sd descending. The order thrown is kept in the roll.

unique (省略可)true | undefined

The dice all show different faces: each is thrown from the faces not yet showing, which comes to the same as rerolling any duplicate until there is none. u in notation.

faces (省略可)CustomFace[] | undefined

A custom die: its faces, in order, and sides is how many there are. A face written twice comes up twice as often. A roll records a custom face by its place, from 1. Left out of a numbered die and a Fate die.

weights (省略可)number[] | undefined

A loaded die: how heavily each face is weighted, from the lowest face up, where a fair die has every face at 1. [1, 1, 1, 1, 1, 3] is a d6 that shows its 6 three times in eight. Left out of a fair die, and never present by accident: isFair is false for any roll that has it.

modifiernumber

Added to the total, as in 1d20+5.

more (省略可)DiceGroup[] | undefined

The other kinds of dice in the roll, in order. Left out when there is one kind.

times (省略可)number | undefined

How many times rollMany throws the roll, as a set: 6 for 6#4d6dl1. Left out when it is once. roll throws it once whatever this says.

math (省略可)MathNode | undefined

How the kinds' totals are put together, when that is not simply adding them: (2d6+3)*2, 1d20-1d4, floor(4d6/2). It names each kind of dice once, by its place. With a formula the bonus is part of it, and modifier is 0. Left out of a roll whose kinds are added.

label (省略可)string | undefined

What the roll is for, in a few words: "fire damage". Text, only ever shown as text. 2d6 # fire damage in notation. Left out when there is none.

例

import type { RollSpec } from "@johnmorrisdotca/korokoro";
import { normalizeSpec } from "@johnmorrisdotca/korokoro";
const value: RollSpec = normalizeSpec({ count: 2, sides: 6 });
console.log(value.sides);
6

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/korokoro 1.16.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。