Fix slying dice usage in CheckFactory

This commit is contained in:
Johannes Loher 2021-03-13 22:15:58 +01:00
parent 7f973e7de8
commit 18e6c31b5c

View file

@ -36,12 +36,8 @@ class CheckFactory {
async execute(): Promise<ChatMessage | unknown> {
const rollCls = CONFIG.Dice.rolls[0];
const formula = [
"ds",
this.createTargetValueTerm(),
this.createCritTerm(),
this.createSlayingDiceTerm(),
].filterJoin("");
const innerFormula = ["ds", this.createTargetValueTerm(), this.createCritTerm()].filterJoin("");
const formula = this.checkOptions.useSlayingDice ? `{${innerFormula}}x` : innerFormula;
const roll = new rollCls(formula);
const rollModeTemplate = this.checkOptions.rollMode;
@ -62,15 +58,11 @@ class CheckFactory {
const maxCritRequired = this.checkOptions.maxCritSuccess !== defaultCheckOptions.maxCritSuccess;
if (minCritRequired || maxCritRequired) {
return "c" + (this.checkOptions.maxCritSuccess ?? "") + "," + (this.checkOptions.minCritFailure ?? "");
return "c" + (this.checkOptions.maxCritSuccess ?? "") + ":" + (this.checkOptions.minCritFailure ?? "");
} else {
return null;
}
}
createSlayingDiceTerm(): string | null {
return this.checkOptions.useSlayingDice ? "x" : null;
}
}
/**