Reference · Rolls and exact odds
statsOffunction
Stats for a history, oldest roll first. focus picks which spec's totals to
break down, and which die's faces: its first kind, or sides when a roll
of several kinds wants another.
Import it
import { statsOf } from "@johnmorrisdotca/korokoro";
Definition
function statsOf(history: readonly Roll[], focus?: RollSpec, sides?: Sides | DiceGroup): Stats
Parameters
| Name | Type | Description |
|---|---|---|
history | readonly Roll[] | Completed rolls, newest first where the history API requires it. |
focus (optional) | RollSpec | undefined | The spec whose totals are measured. |
sides (optional) | DiceGroup | Sides | undefined | A numbered die size or F for Fate dice. |
Returns
Stats
Stats for a history, oldest roll first. focus picks which spec's totals to break down, and which die's faces: its first kind, or sides when a roll of several kinds wants another.
Examples
import { statsOf } from "@johnmorrisdotca/korokoro";
import { normalizeSpec, rollFrom } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
const sample = rollFrom(spec, [2, 5], "saved", 0, null)!;
console.log(statsOf([sample]).rolls);1What it prints (run when this page was built)