Foundry: Roll#evaluate sera async

This commit is contained in:
Vincent Vandemeulebrouck
2021-05-11 21:45:43 +02:00
parent d6325581f7
commit 2a519315b5
20 changed files with 160 additions and 147 deletions

View File

@@ -1,4 +1,5 @@
import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js";
import { RdDRollTables } from "./rdd-rolltables.js";
import { TMRType } from "./tmr-utility.js";
@@ -68,7 +69,7 @@ export class RdDItemSigneDraconique {
}
static async randomSigneDraconique() {
let modele = await Misc.rollOneOf(tableSignesIndicatifs);
let modele = await RdDDice.rollOneOf(tableSignesIndicatifs);
return {
name: await RdDItemSigneDraconique.randomSigneDescription(),
type: "signedraconique",
@@ -85,9 +86,9 @@ export class RdDItemSigneDraconique {
static async randomTmrs(nbTmr = undefined) {
let tmrs = Object.values(TMRType).map(value => Misc.upperFirst(value.name));
let keep = nbTmr ?? (await new Roll("1d" + TMRType.length).evaluate().total + 1);
let keep = nbTmr ?? (await RdDDice.rollTotal("1d" + TMRType.length) + 1);
for (let i = tmrs.length; i > keep; i--) {
tmrs.splice(await new Roll("1d" + i).evaluate().total, 1);
tmrs.splice(await RdDDice.rollTotal("1d" + i), 1);
}
return tmrs;
}