dicelang
Version:
JavaScript interpreter of the Roll20 dice language
863 lines • 44.9 kB
HTML
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Dice | dicelang</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">dicelang</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="../modules/_dice_dice_.html">"Dice/Dice"</a>
</li>
<li>
<a href="_dice_dice_.dice.html">Dice</a>
</li>
</ul>
<h1>Class Dice</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Representation of a dice roll.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">Dice</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="_dice_dice_.dice.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Accessors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="_dice_dice_.dice.html#d" class="tsd-kind-icon">d</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="_dice_dice_.dice.html#fate" class="tsd-kind-icon">fate</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="_dice_dice_.dice.html#minroll" class="tsd-kind-icon">min<wbr>Roll</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="_dice_dice_.dice.html#mod" class="tsd-kind-icon">mod</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="_dice_dice_.dice.html#n" class="tsd-kind-icon">n</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="_dice_dice_.dice.html#rawrolls" class="tsd-kind-icon">raw<wbr>Rolls</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="_dice_dice_.dice.html#result" class="tsd-kind-icon">result</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="_dice_dice_.dice.html#rolls" class="tsd-kind-icon">rolls</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class tsd-is-protected tsd-is-static"><a href="_dice_dice_.dice.html#diceregexp" class="tsd-kind-icon">dice<wbr>Reg<wbr>Exp</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-static"><a href="_dice_dice_.dice.html#maxd" class="tsd-kind-icon">maxD</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-static"><a href="_dice_dice_.dice.html#maxn" class="tsd-kind-icon">maxN</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_dice_dice_.dice.html#roll" class="tsd-kind-icon">roll</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_dice_dice_.dice.html#tostring" class="tsd-kind-icon">to<wbr>String</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_dice_dice_.dice.html#tostringplaintext" class="tsd-kind-icon">to<wbr>String<wbr>Plaintext</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_dice_dice_.dice.html#roll-1" class="tsd-kind-icon">roll</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new <wbr>Dice<span class="tsd-signature-symbol">(</span>diceExpr<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, binding<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">object</span>, device<span class="tsd-signature-symbol">?: </span><a href="_common_random_.randomdevice.html" class="tsd-signature-type">RandomDevice</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_dice_dice_.dice.html" class="tsd-signature-type">Dice</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L89">Dice/Dice.ts:89</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Create a new dice from the given atomic expression.</p>
</div>
<dl class="tsd-comment-tags">
<dt>throws</dt>
<dd><p>If the value of n is not between 0 and Dice.maxN inclusive.</p>
</dd>
<dt>throws</dt>
<dd><p>If the value of d is not between 0 and Dice.maxD inclusive.</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> diceExpr: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The atomic dice expression to create the dice
from. If not given, the dice is initialized as "1d20".</p>
</div>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> binding: <span class="tsd-signature-type">object</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>An object to bind to if the expression includes
bindings.</p>
</div>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> device: <a href="_common_random_.randomdevice.html" class="tsd-signature-type">RandomDevice</a><span class="tsd-signature-symbol"> = RD</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The random number generator that this Dice
should use.</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="_dice_dice_.dice.html" class="tsd-signature-type">Dice</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Accessors</h2>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="d" class="tsd-anchor"></a>
<h3>d</h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> d<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">set</span> d<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L162">Dice/Dice.ts:162</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The value of d is the number of faces on this dice. In the case of fate
dice, returns 3 (d3).</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
</li>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L175">Dice/Dice.ts:175</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Set the value of d. If the dice is a fate dice, the fate attribute is
cleared.</p>
</div>
<dl class="tsd-comment-tags">
<dt>throws</dt>
<dd><p>If the value of d is not between 0 and Dice.maxD inclusive.</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>value: <span class="tsd-signature-type">number</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="fate" class="tsd-anchor"></a>
<h3>fate</h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> fate<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">set</span> fate<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L186">Dice/Dice.ts:186</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>True if this dice is a fate dice.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L196">Dice/Dice.ts:196</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Set if this dice is a fate dice. If the value changes to true, the previous
value for d is cleared. If the value changes to false, the value of d is
set to 3 (the dice becomes a d3 and keeps its value of n). If the new value
is the same as the dice's current value, there is no effect.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>value: <span class="tsd-signature-type">boolean</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="minroll" class="tsd-anchor"></a>
<h3>min<wbr>Roll</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> minRoll<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L221">Dice/Dice.ts:221</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The lowest numeric value that this dice can roll. This is usually 1, except
in the case of fate dice, where it is -1.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="mod" class="tsd-anchor"></a>
<h3>mod</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> mod<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_dice_dicemod_.dicemod.html" class="tsd-signature-type">DiceMod</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L213">Dice/Dice.ts:213</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The modifiers for this dice.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <a href="_dice_dicemod_.dicemod.html" class="tsd-signature-type">DiceMod</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="n" class="tsd-anchor"></a>
<h3>n</h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> n<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">set</span> n<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L144">Dice/Dice.ts:144</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Get the value of n, which is the number of times the d-sided dice is rolled
when roll() is called.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
</li>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L152">Dice/Dice.ts:152</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Set the value of n.</p>
</div>
<dl class="tsd-comment-tags">
<dt>throws</dt>
<dd><p>If the value of n is not between 0 and Dice.maxN inclusive.</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>value: <span class="tsd-signature-type">number</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="rawrolls" class="tsd-anchor"></a>
<h3>raw<wbr>Rolls</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> rawRolls<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L271">Dice/Dice.ts:271</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>An array of the individual dice values for the most recent roll before
modifiers were applied.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="result" class="tsd-anchor"></a>
<h3>result</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> result<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L256">Dice/Dice.ts:256</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The most recently rolled result, or null if the dice has never been rolled.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="rolls" class="tsd-anchor"></a>
<h3>rolls</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> rolls<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L263">Dice/Dice.ts:263</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>An array of the individual dice values for the most recent roll.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class tsd-is-protected tsd-is-static">
<a name="diceregexp" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagStatic">Static</span> <span class="tsd-flag ts-flagProtected">Protected</span> dice<wbr>Reg<wbr>Exp</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class tsd-is-protected tsd-is-static">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> diceRegExp<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RegExp</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L64">Dice/Dice.ts:64</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The RegExp used to parse the core dice expression.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RegExp</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class tsd-is-static">
<a name="maxd" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagStatic">Static</span> maxD</h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> maxD<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">set</span> maxD<span class="tsd-signature-symbol">(</span>d<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L41">Dice/Dice.ts:41</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The maximum allowed value of d, which is equal to the largest representable
integer in JavaScript (9007199254740991, or Number.MAX_SAFE_INTEGER).</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
</li>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L44">Dice/Dice.ts:44</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The maximum allowed value of d, which is equal to the largest representable
integer in JavaScript (9007199254740991, or Number.MAX_SAFE_INTEGER).</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>d: <span class="tsd-signature-type">number</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class tsd-is-static">
<a name="maxn" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagStatic">Static</span> maxN</h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> maxN<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">set</span> maxN<span class="tsd-signature-symbol">(</span>n<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L54">Dice/Dice.ts:54</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The maximum allowed value of n, which is equal to the largest representable
integer in JavaScript (9007199254740991, or Number.MAX_SAFE_INTEGER in
ES6).</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
</li>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L57">Dice/Dice.ts:57</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The maximum allowed value of n, which is equal to the largest representable
integer in JavaScript (9007199254740991, or Number.MAX_SAFE_INTEGER in
ES6).</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>n: <span class="tsd-signature-type">number</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="roll" class="tsd-anchor"></a>
<h3>roll</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">roll<span class="tsd-signature-symbol">(</span>n<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L238">Dice/Dice.ts:238</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Roll the dice. Returns the combined result of the dice roll. Individual
rolls are stored in the rolls property.</p>
</div>
<dl class="tsd-comment-tags">
<dt>throws</dt>
<dd><p>If the value of n is not between 0 and Dice.maxN inclusive.</p>
</dd>
<dt>throws</dt>
<dd><p>It is possible for certain types of roll modifiers to continue
rolling infinitely. Instead of crashing we throw an error describing where
we stopped prematurely. The value of the rolls that we did execute can
still be accessed via the rolls property, and the result can still be
accessed via the result property.</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> n: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = this.n</span></h5>
<div class="tsd-comment tsd-typography">
<p>The number of dice to roll. If not given, defaults to
the value of n given when the dice was constructed.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
<p>The combined result of the dice roll.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="tostring" class="tsd-anchor"></a>
<h3>to<wbr>String</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">to<wbr>String<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L279">Dice/Dice.ts:279</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
<p>The string representation of the Dice, using Roll20
notation.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="tostringplaintext" class="tsd-anchor"></a>
<h3>to<wbr>String<wbr>Plaintext</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">to<wbr>String<wbr>Plaintext<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L286">Dice/Dice.ts:286</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
<p>The string representation of the Dice, in English text.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a name="roll-1" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagStatic">Static</span> roll</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon">roll<span class="tsd-signature-symbol">(</span>d<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, n<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span>, device<span class="tsd-signature-symbol">?: </span><a href="_common_random_.randomdevice.html" class="tsd-signature-type">RandomDevice</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/IrisAmp/dicelang/blob/48a3edf/src/Dice/Dice.ts#L22">Dice/Dice.ts:22</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Perform a simple dice roll.</p>
</div>
<dl class="tsd-comment-tags">
<dt>throws</dt>
<dd><p>If the value of n is not between 0 and Dice.maxN inclusive.</p>
</dd>
<dt>throws</dt>
<dd><p>If the value of d is not between 0 and Dice.maxD inclusive.</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>d: <span class="tsd-signature-type">number</span></h5>
<div class="tsd-comment tsd-typography">
<p>The number of faces the dice should have.</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> n: <span class="tsd-signature-type">number</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> device: <a href="_common_random_.randomdevice.html" class="tsd-signature-type">RandomDevice</a><span class="tsd-signature-symbol"> = RD</span></h5>
<div class="tsd-comment tsd-typography">
<p>The random number generator to use in this
roll.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_common_constants_.html">"<wbr>Common/<wbr>Constants"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_common_iexpression_.html">"<wbr>Common/IExpression"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_common_random_.html">"<wbr>Common/<wbr>Random"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_common_util_.html">"<wbr>Common/<wbr>Util"</a>
</li>
<li class="current tsd-kind-external-module">
<a href="../modules/_dice_dice_.html">"<wbr>Dice/<wbr>Dice"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_dice_dicemod_.html">"<wbr>Dice/<wbr>Dice<wbr>Mod"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_dice_dicemod_types_.html">"<wbr>Dice/<wbr>Dice<wbr>Mod.<wbr>Types"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_dice_testhelpers_.html">"<wbr>Dice/<wbr>Test<wbr>Helpers"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parser_parser_.html">"<wbr>Parser/<wbr>Parser"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_index_.html">"index"</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-parent-kind-external-module">
<a href="_dice_dice_.dice.html" class="tsd-kind-icon">Dice</a>
<ul>
<li class=" tsd-kind-constructor tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#d" class="tsd-kind-icon">d</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#fate" class="tsd-kind-icon">fate</a>
</li>
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#minroll" class="tsd-kind-icon">min<wbr>Roll</a>
</li>
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#mod" class="tsd-kind-icon">mod</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#n" class="tsd-kind-icon">n</a>
</li>
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#rawrolls" class="tsd-kind-icon">raw<wbr>Rolls</a>
</li>
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#result" class="tsd-kind-icon">result</a>
</li>
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#rolls" class="tsd-kind-icon">rolls</a>
</li>
<li class=" tsd-kind-get-signature tsd-parent-kind-class tsd-is-protected tsd-is-static">
<a href="_dice_dice_.dice.html#diceregexp" class="tsd-kind-icon">dice<wbr>Reg<wbr>Exp</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class tsd-is-static">
<a href="_dice_dice_.dice.html#maxd" class="tsd-kind-icon">maxD</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class tsd-is-static">
<a href="_dice_dice_.dice.html#maxn" class="tsd-kind-icon">maxN</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#roll" class="tsd-kind-icon">roll</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#tostring" class="tsd-kind-icon">to<wbr>String</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_dice_dice_.dice.html#tostringplaintext" class="tsd-kind-icon">to<wbr>String<wbr>Plaintext</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a href="_dice_dice_.dice.html#roll-1" class="tsd-kind-icon">roll</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html>