feat: update Roll evaluation methods

This commit is contained in:
Alexander Minges 2025-07-12 20:55:22 +02:00
parent bfbd327e51
commit 9ed959337d
Signed by: Athemis
GPG key ID: 31FBDEF92DDB162B

View file

@ -204,7 +204,7 @@ export class DS4ActorSheet extends foundry.applications.api.DocumentSheetV2 {
// Try to parse as a formula
try {
const roll = new Roll(value);
return roll.evaluate({ async: false }).total;
return roll.evaluateSync().total;
} catch (error) {
return value;
}
@ -224,7 +224,7 @@ export class DS4ActorSheet extends foundry.applications.api.DocumentSheetV2 {
if (check !== undefined) {
const roll = new Roll("1d20");
const rollResult = await roll.evaluate({ async: true });
const rollResult = await roll.evaluate();
const success = rollResult.total <= check;
const resultText = success ? "DS4.CheckSuccess" : "DS4.CheckFailure";
@ -236,7 +236,6 @@ export class DS4ActorSheet extends foundry.applications.api.DocumentSheetV2 {
target: check,
}),
content: game.i18n.localize(resultText),
type: CONST.CHAT_MESSAGE_TYPES.ROLL,
rolls: [rollResult],
};