Foundry: Roll#evaluate sera async
This commit is contained in:
@ -25,7 +25,7 @@ export class De7 extends Die {
|
||||
return {
|
||||
type: "d7",
|
||||
font: "HeuresDraconiques",
|
||||
fontScale : 0.7,
|
||||
fontScale: 0.7,
|
||||
labels: ['1', '2', '3', '4', '5', '6', 'd', '0'],
|
||||
system: system
|
||||
}
|
||||
@ -36,7 +36,7 @@ export class De7 extends Die {
|
||||
super(termData);
|
||||
}
|
||||
|
||||
evaluate() {
|
||||
async evaluate() {
|
||||
super.evaluate();
|
||||
this.explode("x=8");
|
||||
return this;
|
||||
@ -62,7 +62,7 @@ export class DeDraconique extends Die {
|
||||
return {
|
||||
type: "dr",
|
||||
font: "HeuresDraconiques",
|
||||
fontScale : 0.7,
|
||||
fontScale: 0.7,
|
||||
labels: ['1', '2', '3', '4', '5', '6', 'd', '0'],
|
||||
system: system
|
||||
}
|
||||
@ -73,7 +73,7 @@ export class DeDraconique extends Die {
|
||||
super(termData);
|
||||
}
|
||||
|
||||
evaluate() {
|
||||
async evaluate() {
|
||||
super.evaluate();
|
||||
this.explode("x=7");
|
||||
return this;
|
||||
@ -113,7 +113,7 @@ export class DeHeure extends Die {
|
||||
}
|
||||
|
||||
static getResultLabel(result) {
|
||||
return img(imagesHeures[result-1]);
|
||||
return img(imagesHeures[result - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,6 +124,27 @@ export class RdDDice {
|
||||
CONFIG.Dice.terms[DeHeure.DENOMINATION] = DeHeure;
|
||||
}
|
||||
|
||||
static async roll(formula, options = { showDice: false }) {
|
||||
const roll = new Roll(formula);
|
||||
await roll.evaluate({ async: true });
|
||||
if (options.showDice) {
|
||||
roll.showDice = options.showDice;
|
||||
}
|
||||
await RdDDice.show(roll, game.settings.get("core", "rollMode"));
|
||||
return roll;
|
||||
}
|
||||
|
||||
static async rollTotal(formula) {
|
||||
const roll = new Roll(formula);
|
||||
await roll.evaluate({ async: true });
|
||||
return roll.total;
|
||||
}
|
||||
|
||||
static async rollOneOf(array) {
|
||||
const roll = await RdDDice.rollTotal(`1d${array.length}`);
|
||||
return array[roll-1];
|
||||
}
|
||||
|
||||
static diceSoNiceReady(dice3d) {
|
||||
for (const system of Object.keys(dice3d.DiceFactory.systems)) {
|
||||
dice3d.addDicePreset(De7.diceSoNiceData(system));
|
||||
|
Reference in New Issue
Block a user