浏览代码

export Outcomes + simplify reroll abovebelow check

tags/v0.1.3
bertieb 3 年前
父节点
当前提交
ec315db5a4
共有 1 个文件被更改,包括 2 次插入10 次删除
  1. +2
    -10
      dice.ts

+ 2
- 10
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;



正在加载...
取消
保存