mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-21 18:09:54 +02:00
Fixed so things are awaited properly if there are more dice to be rolled
This commit is contained in:
parent
9fba339230
commit
7ab7cc9787
1 changed files with 13 additions and 3 deletions
|
|
@ -18,12 +18,22 @@ export default class BaseDie extends foundry.dice.terms.Die {
|
||||||
The actual rolls are done here in place so every dice gets the correct denomination.
|
The actual rolls are done here in place so every dice gets the correct denomination.
|
||||||
*/
|
*/
|
||||||
if (game.modules.get('dice-so-nice')?.active) {
|
if (game.modules.get('dice-so-nice')?.active) {
|
||||||
await Promise.allSettled(this.results.map(async result => {
|
const rolls = [];
|
||||||
|
for (const result of this.results) {
|
||||||
const roll = await (new Roll(`1${result.denomination ?? this.denomination}`)).evaluate();
|
const roll = await (new Roll(`1${result.denomination ?? this.denomination}`)).evaluate();
|
||||||
roll.terms[0].results = [result];
|
roll.terms[0].results = [result];
|
||||||
roll._evaluateTotal();
|
roll._evaluateTotal();
|
||||||
return game.dice3d.showForRoll(roll, game.user, false);
|
rolls.push(roll);
|
||||||
}));
|
}
|
||||||
|
|
||||||
|
/* If there are other dice that will be rolled we cannot await here. The other dice will be awaited in the normal flow */
|
||||||
|
if (this._root.dice.length > 1) {
|
||||||
|
for (const roll of rolls) {
|
||||||
|
game.dice3d.showForRoll(roll, game.user, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await Promise.allSettled(rolls.map(roll => game.dice3d.showForRoll(roll, game.user, true)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const result of this.results)
|
for (const result of this.results)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue