diff --git a/module/actor.js b/module/actor.js index 974b75a0..9051a483 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1051,7 +1051,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async ajouterRefoulement(value = 1) { let refoulement = Misc.templateData(this).reve.refoulement.value + value; - let total = new Roll("1d20").roll().total; + let total = new Roll("1d20").evaluate( {async: false}).total; if (total <= refoulement) { refoulement = 0; await this.ajouterSouffle({ chat: true }); @@ -1426,9 +1426,9 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async moralIncDec(ajustementMoral) { - + let actorData if (ajustementMoral != 0) { - const actorData = Misc.data(this); + actorData = Misc.data(this); let moral = Misc.toInt(actorData.data.compteurs.moral.value) + ajustementMoral if (moral > 3) { // exaltation const exaltation = Misc.toInt(actorData.data.compteurs.exaltation.value) + moral - 3; diff --git a/module/misc.js b/module/misc.js index e443a63f..d14e841e 100644 --- a/module/misc.js +++ b/module/misc.js @@ -72,7 +72,7 @@ export class Misc { } static rollOneOf(array) { - return array[new Roll("1d" + array.length).evaluate().total - 1]; + return array[new Roll("1d" + array.length).evaluate( { async: false} ).total - 1]; } static distinct(array) { diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js index ca5376a9..9d2c392e 100644 --- a/module/rdd-resolution-table.js +++ b/module/rdd-resolution-table.js @@ -151,7 +151,7 @@ export class RdDResolutionTable { /* -------------------------------------------- */ static async rollChances(chances) { - let myRoll = new Roll("1d100").roll(); + let myRoll = new Roll("1d100").evaluate( {async: false} ); myRoll.showDice = chances.showDice; await RdDDice.show(myRoll); chances.roll = myRoll.total; diff --git a/module/rdd-roll.js b/module/rdd-roll.js index e8625e98..521645a2 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -144,9 +144,10 @@ export class RdDRoll extends Dialog { console.log(rollData); // Update html, according to data if (rollData.competence) { + let compData = rollData.competence.data.data || rollData.competence.data; // Set the default carac from the competence item - rollData.selectedCarac = rollData.carac[rollData.competence.data.data.defaut_carac]; - $("#carac").val(rollData.competence.data.data.defaut_carac); + rollData.selectedCarac = rollData.carac[compData.defaut_carac]; + $("#carac").val(compData.defaut_carac); } if (rollData.selectedSort) { $("#draconic").val(rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer diff --git a/module/rdd-rolltables.js b/module/rdd-rolltables.js index 15b05165..f9696267 100644 --- a/module/rdd-rolltables.js +++ b/module/rdd-rolltables.js @@ -15,9 +15,10 @@ export class RdDRollTables { static async drawItemFromRollTable(tableName, toChat) { const draw = await RdDRollTables.genericGetTableResult(tableName, toChat); const drawnItemRef = draw.results.length > 0 ? draw.results[0] : undefined; - if (drawnItemRef.collection) { - const pack = game.packs.get(drawnItemRef.collection); - return await pack.getDocument(drawnItemRef.resultId); + if (drawnItemRef.data.collection) { + console.log(drawnItemRef); + const pack = game.packs.get(drawnItemRef.data.collection); + return await pack.getDocument(drawnItemRef.data.resultId); } ui.notifications.warn("le tirage ne correspond pas à une entrée d'un Compendium") return drawnItemRef.text; diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index fcc92d6d..05665f24 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -457,7 +457,7 @@ export class RdDTMRDialog extends Dialog { if (rencontre) { return rencontre; } - let myRoll = new Roll("1d7").evaluate().total; + let myRoll = new Roll("1d7").evaluate( { async: false} ).total; if (TMRUtility.isForceRencontre() || myRoll == 7) { return await this.rencontreTMRRoll(tmr, this.actor.isRencontreSpeciale()); } diff --git a/module/tmr-rencontres.js b/module/tmr-rencontres.js index 7737ee5f..451f7b87 100644 --- a/module/tmr-rencontres.js +++ b/module/tmr-rencontres.js @@ -357,7 +357,7 @@ export class TMRRencontres { /* -------------------------------------------- */ static async getRencontreAleatoire(terrain, roll = undefined) { if (!roll || roll <= 0 || roll > 100) { - roll = new Roll("1d100").evaluate().total; + roll = new Roll("1d100").evaluate( {async: false}).total; } terrain = Grammar.toLowerCaseNoAccent(terrain); //console.log("getRencontreAleatoire", terrain, roll); @@ -386,7 +386,7 @@ export class TMRRencontres { rencontre.force = 7 + ddr.total; } else { - rencontre.force = new Roll(rencontre.force).evaluate().total; + rencontre.force = new Roll(rencontre.force).evaluate( {async: false} ).total; } return rencontre.force; }