refactor: refactor Check Roll to custom DS4 Actor Method

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

View file

@ -220,27 +220,7 @@ export class DS4ActorSheet extends foundry.applications.api.DocumentSheetV2 {
if (!checkKey) return;
const actor = this.document;
const check = actor.system.checks[checkKey];
if (check !== undefined) {
const roll = new Roll("1d20");
const rollResult = await roll.evaluate();
const success = rollResult.total <= check;
const resultText = success ? "DS4.CheckSuccess" : "DS4.CheckFailure";
const messageData = {
speaker: ChatMessage.getSpeaker({ actor }),
flavor: game.i18n.format("DS4.CheckRollFlavor", {
check: game.i18n.localize(`DS4.Check${checkKey.capitalize()}`),
target: check,
}),
content: game.i18n.localize(resultText),
rolls: [rollResult],
};
await ChatMessage.create(messageData);
}
await actor.rollCheck(checkKey);
}
/**