Fix slaying dice modifier

This commit is contained in:
Johannes Loher 2021-07-01 01:51:50 +02:00
parent 1ddabc388c
commit 7a37f46017

View file

@ -7,7 +7,6 @@ import { DS4Check } from "./check";
export default function registerSlayingDiceModifier(): void {
PoolTerm.MODIFIERS.x = slay;
// PoolTerm.POOL_REGEX = /^{([^}]+)}([A-z]([A-z0-9<=>]+)?)?$/; // TODO: Maybe we don't need this anymore?
}
function slay(this: PoolTerm, modifier: string): void {
@ -21,10 +20,11 @@ function slay(this: PoolTerm, modifier: string): void {
checked++;
if (diceTerm instanceof DS4Check && diceTerm.coup) {
const formula = `dsv${diceTerm.checkTargetNumber}c${diceTerm.maximumCoupResult}:${diceTerm.minimumFumbleResult}n`;
const additionalRoll = Roll.create(formula).evaluate();
const additionalRoll = Roll.create(formula).evaluate({ async: false });
this.rolls.push(additionalRoll);
this.results.push({ result: additionalRoll.total ?? 0, active: true });
this.terms.push(formula);
}
if (checked > 1000) throw new Error(game.i18n.localize("DS4.ErrorSlayingDiceRecursionLimitExceeded"));
}