Przeglądaj źródła

export Outcomes + simplify reroll abovebelow check

tags/v0.1.3
bertieb 3 lat temu
rodzic
commit
ec315db5a4
1 zmienionych plików z 2 dodań i 10 usunięć
  1. +2
    -10
      dice.ts

+ 2
- 10
dice.ts Wyświetl plik

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



Ładowanie…
Anuluj
Zapisz