Fix: re-tirage de dés sur reload #499

Merged
vincent.vandeme merged 1 commits from v1.4-fix-refresh-calendar into v1.4 2021-06-25 15:36:50 +02:00
2 changed files with 14 additions and 10 deletions

View File

@ -139,13 +139,15 @@ export class RdDCalendrier extends Application {
}
/* -------------------------------------------- */
async ajouterNombreAstral(index, showdice = true) {
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showdice, rollMode: "selfroll" });
async ajouterNombreAstral(index, showDice = true) {
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showDice, hideDice: !showDice, rollMode: "selfroll" });
const dateFuture = this.getDateFromIndex(index);
ChatMessage.create({
whisper: ChatMessage.getWhisperRecipients("GM"),
content: `Le chiffre astrologique du ${dateFuture} sera le ${nombreAstral}`
});
if (showDice) {
ChatMessage.create({
whisper: ChatMessage.getWhisperRecipients("GM"),
content: `Le chiffre astrologique du ${dateFuture} sera le ${nombreAstral}`
});
}
return {
nombreAstral: nombreAstral,
valeursFausses: [],
@ -198,8 +200,8 @@ export class RdDCalendrier extends Application {
}
}
console.log("SAVE list", newList, jourCourant);
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
this.listeNombreAstral = newList;
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
}
}

View File

@ -134,12 +134,14 @@ export class RdDDice {
static async roll(formula, options = { showDice: false, rollMode: undefined }) {
const roll = new Roll(formula);
await roll.evaluate({ async: true });
roll.showDice = options.showDice;
await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
if (!options.hideDice) {
roll.showDice = options.showDice;
await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
}
return roll;
}
static async rollTotal(formula, options = { showDice: false }) {
static async rollTotal(formula, options = { showDice: false, hideDice: false }) {
const roll = await RdDDice.roll(formula, options);
return roll.total;
}