|
|
@@ -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; |
|
|
|
|
|
|
|