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