Fix: simplifier l'affichage des jets

L'affichage de plus ou moins de jets ne marchait pas et faisait
régression
This commit is contained in:
Vincent Vandemeulebrouck
2021-12-03 22:53:38 +01:00
parent 0ccb98cfc9
commit 1f1fb39866
8 changed files with 29 additions and 49 deletions

View File

@ -1,5 +1,5 @@
import { ChatUtility } from "./chat-utility.js";
import { SYSTEM_RDD } from "./constants.js";
import { HIDE_DICE, SHOW_DICE, SHOW_DICE_OPTIONAL, SYSTEM_RDD } from "./constants.js";
import { Misc } from "./misc.js";
function img(src) {
@ -123,6 +123,7 @@ export class RdDDice {
CONFIG.Dice.terms[DeDraconique.DENOMINATION] = DeDraconique;
CONFIG.Dice.terms[DeHeure.DENOMINATION] = DeHeure;
}
static onReady() {
if (game.modules.get("dice-so-nice")?.active) {
if (game.settings.get("core", "noCanvas")) {
@ -131,17 +132,16 @@ export class RdDDice {
}
}
static async roll(formula, options = { showDice: false, rollMode: undefined }) {
static async roll(formula, options = { showDice: SHOW_DICE, rollMode: undefined }) {
const roll = new Roll(formula);
await roll.evaluate({ async: true });
if (!options.hideDice) {
roll.showDice = options.showDice;
await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
if (options.showDice != HIDE_DICE) {
await this.showDiceSoNice(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
}
return roll;
}
static async rollTotal(formula, options = { showDice: false, hideDice: false }) {
static async rollTotal(formula, options = { showDice: HIDE_DICE}) {
const roll = await RdDDice.roll(formula, options);
return roll.total;
}
@ -159,14 +159,6 @@ export class RdDDice {
}
}
/* -------------------------------------------- */
static async show(roll, rollMode) {
if (roll.showDice || game.settings.get(SYSTEM_RDD, "dice-so-nice") == true) {
await this.showDiceSoNice(roll, rollMode);
}
return roll;
}
/* -------------------------------------------- */
static async showDiceSoNice(roll, rollMode) {
if (game.modules.get("dice-so-nice")?.active) {