refactor: refactor Check Roll to custom DS4 Actor Method
This commit is contained in:
parent
9ed959337d
commit
df8c94a21f
1 changed files with 1 additions and 21 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue