|
@@ -13,6 +13,10 @@ class Dice {
|
|
|
}
|
|
|
|
|
|
public roll (stat : number) : Array<number> {
|
|
|
+ if (stat == 0) {
|
|
|
+ return [this.minResult];
|
|
|
+ }
|
|
|
+
|
|
|
let rng = this.range.slice();
|
|
|
if (stat >= 10) {
|
|
|
rng.push(2, 1);
|
|
@@ -32,6 +36,10 @@ class Dice {
|
|
|
return results;
|
|
|
}
|
|
|
|
|
|
+ public rollAndSum (stat : number) : number {
|
|
|
+ return this.roll(stat).reduce(Dice.sum);
|
|
|
+ }
|
|
|
+
|
|
|
public static sum (a, b) {
|
|
|
return a + b;
|
|
|
}
|