Commandes pour jet de dés

This commit is contained in:
Vincent Vandemeulebrouck
2020-12-29 00:11:58 +01:00
parent 3e42ddd314
commit 77ed4f1482
5 changed files with 227 additions and 66 deletions

View File

@ -10,16 +10,17 @@ import { RdDResolutionTable } from "./rdd-resolution-table.js";
export class RdDRollResolution extends Dialog {
/* -------------------------------------------- */
static async open() {
let rollData = RdDRollResolution._prepareDefaultOptions();
static async open(rollData = {selectedCarac:10}) {
RdDRollResolution._setDefaultOptions(rollData);
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html', rollData);
const dialog = new RdDRollResolution(rollData, html);
dialog.render(true);
}
/* -------------------------------------------- */
static _prepareDefaultOptions() {
let rollData = {
static _setDefaultOptions(rollData) {
let defRollData = {
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
difficultesLibres: CONFIG.RDD.difficultesLibres,
etat: 0,
@ -29,11 +30,14 @@ export class RdDRollResolution extends Dialog {
diffConditions: 0,
diffLibre: 0
}
mergeObject(rollData, defRollData, {overwrite: false});
for (let i = 1; i < 21; i++) {
rollData.carac[i] = { type: "number", value: i, label: i }
if (rollData.selectedCarac == i) {
rollData.selectedCarac = rollData.carac[i];
}
}
rollData.selectedCarac = rollData.carac[10];
return rollData;
}
/* -------------------------------------------- */