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

@ -7,6 +7,7 @@ import { Grammar } from "./grammar.js";
import { TMRUtility } from "./tmr-utility.js";
import { DialogItemAchat } from "./dialog-item-achat.js";
import { ReglesOptionelles } from "./regles-optionelles.js";
import { RdDDice } from "./rdd-dice.js";
/* -------------------------------------------- */
// This table starts at 0 -> niveau -10
@ -444,8 +445,8 @@ export class RdDUtility {
}
/* -------------------------------------------- */
static getLocalisation(type = 'personnage') {
let result = new Roll("1d20").roll().total;
static async getLocalisation(type = 'personnage') {
let result = await RdDDice.rollTotal("1d20");
let txt = ""
if (type == 'personnage') {
if (result <= 3) txt = "Jambe, genou, pied, jarret";
@ -477,15 +478,6 @@ export class RdDUtility {
return duplicate(table[0]);
}
/* -------------------------------------------- */
static _evaluatePerte(formula, over20) {
console.log("_evaluatePerte", formula, over20);
let perte = new Roll(formula, { over20: over20 });
perte.evaluate();
return perte.total;
}
/* -------------------------------------------- */
static currentFatigueMalus(value, max) {
if (ReglesOptionelles.isUsing("appliquer-fatigue")) {