Gestion des signes draconiques #455

Closed
vincent.vandeme wants to merge 233 commits from v1.4-signes-draconiques into master
7 changed files with 15 additions and 13 deletions
Showing only changes of commit 36df301144 - Show all commits

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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());
}

View File

@ -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;
}