From ec315db5a4a5dcea4733fd379908d46a6f1a36c2 Mon Sep 17 00:00:00 2001 From: bertieb Date: Thu, 11 Feb 2021 18:21:00 +0000 Subject: [PATCH] export Outcomes + simplify reroll abovebelow check --- dice.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/dice.ts b/dice.ts index 28eab93..503162f 100644 --- a/dice.ts +++ b/dice.ts @@ -27,7 +27,7 @@ interface Dice { readonly type: string; } -enum Outcomes { +export enum Outcomes { Success = "Success", Fail = "Failure", CritSuccess = "Critical Success", @@ -311,7 +311,6 @@ export class Asphodice extends D10 { // 1. if no re-rolls we can finish here if (!(cancelledDice.includes(this.passCrit) || resultDice.includes(this.failCrit))) { - // results.total = results.dice.reduce((acc: number, curr: number) => acc + curr); return false; } @@ -321,21 +320,14 @@ export class Asphodice extends D10 { // 2. only reroll if they don't cancel each other out if (rerollGood == rerollBad) { - // console.log("Good = Bad, no need to reroll"); return false; - // results.total = results.dice.reduce((acc: number, curr: number) => acc + curr); } // 3. If all dice are above/below cutoff we don't need to reroll - if (this.allAboveCutOff(cancelledDice)) { - console.log("All above cutoff, auto-success", cancelledDice); - return false; - } else if (this.allBelowCutOff(cancelledDice)) { - console.log("All below cutoff, auto-fail", cancelledDice); + if (this.allAboveCutOff(cancelledDice) || this.allBelowCutOff(cancelledDice)) { return false; } - // We should re-roll return true;