mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Added support for d20 rolls
This commit is contained in:
parent
565f0f9e6f
commit
e7c3bcc362
6 changed files with 107 additions and 55 deletions
|
|
@ -172,4 +172,22 @@ export default class D20Roll extends DHRoll {
|
|||
resetFormula() {
|
||||
return (this._formula = this.constructor.getFormula(this.terms));
|
||||
}
|
||||
|
||||
static async reroll(rollString, _target, message) {
|
||||
let parsedRoll = game.system.api.dice.D20Roll.fromData(rollString);
|
||||
parsedRoll = await parsedRoll.reroll();
|
||||
const newRoll = game.system.api.dice.D20Roll.postEvaluate(parsedRoll, {
|
||||
targets: message.system.targets,
|
||||
roll: {
|
||||
advantage: message.system.roll.advantage?.type,
|
||||
difficulty: message.system.roll.difficulty ? Number(message.system.roll.difficulty) : null
|
||||
}
|
||||
});
|
||||
|
||||
if (game.modules.get('dice-so-nice')?.active) {
|
||||
await game.dice3d.showForRoll(parsedRoll, game.user, true);
|
||||
}
|
||||
|
||||
return { newRoll, parsedRoll };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue