Foundry: Roll#evaluate sera async

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

View File

@ -5,6 +5,8 @@ import { HtmlUtility } from "./html-utility.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDUtility } from "./rdd-utility.js";
import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
import {RdDDice } from "./rdd-dice.js";
/* -------------------------------------------- */
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
@ -124,9 +126,9 @@ export class RdDCalendrier extends Application {
}
/* -------------------------------------------- */
ajouterNombreAstral(index) {
async ajouterNombreAstral(index) {
return {
nombreAstral: new Roll("1d12").evaluate( {async:false} ).total,
nombreAstral: await RdDDice.rollTotal("1dh"),
valeursFausses: [],
index: index
}
@ -278,11 +280,10 @@ export class RdDCalendrier extends Application {
request.isValid = true;
if (!request.rolled.isSuccess) {
request.isValid = false;
let nbAstralFaux = new Roll("1d11").evaluate( { async: false} ).total;
nbAstral = nbAstral==nbAstralFaux ? 12 : nbAstralFaux;
nbAstral = await RdDDice.rollTotal("1dhr"+nbAstral);
// Mise à jour des nombres astraux du joueur
let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == request.date);
astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstralFaux });
astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstral });
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
}
request.nbAstral = nbAstral;