Sort, confrontation, update tarots, etc

This commit is contained in:
2023-02-08 17:51:16 +01:00
parent e146c6ba5b
commit c5509143b1
24 changed files with 657 additions and 59 deletions

View File

@@ -5,26 +5,32 @@ export class MaleficesRollDialog extends Dialog {
/* -------------------------------------------- */
static async create(actor, rollData) {
let options = { classes: ["MaleficesDialog"], width: 540, height: 'fit-content', 'z-index': 99999 };
let html = await renderTemplate('systems/fvtt-malefices/templates/dialogs/roll-dialog-generic.hbs', rollData);
let options = { classes: ["MaleficesDialog"], width: 540, height: 'fit-content', 'z-index': 99999 }
let html
if (rollData.attr && rollData.attr.iscard) {
html = await renderTemplate('systems/fvtt-malefices/templates/dialogs/confrontation-dialog.hbs', rollData);
} else {
html = await renderTemplate('systems/fvtt-malefices/templates/dialogs/roll-dialog-generic.hbs', rollData);
}
return new MaleficesRollDialog(actor, rollData, html, options);
}
/* -------------------------------------------- */
constructor(actor, rollData, html, options, close = undefined) {
let isCard = rollData.attr && rollData.attr.iscard
let conf = {
title: (rollData.mode == "skill") ? "Skill" : "Attribute",
title: (isCard) ? "Jet" : "Tirage",
content: html,
buttons: {
roll: {
icon: '<i class="fas fa-check"></i>',
label: "Roll !",
label: (isCard) ? "Tirer une carte" : "Lancer le dé",
callback: () => { this.roll() }
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Cancel",
label: "Annuler",
callback: () => { this.close() }
}
},
@@ -39,7 +45,12 @@ export class MaleficesRollDialog extends Dialog {
/* -------------------------------------------- */
roll() {
MaleficesUtility.rollMalefices(this.rollData)
let isCard = this.rollData.attr && this.rollData.attr.iscard
if (isCard) {
MaleficesUtility.tirageConfrontationMalefices(this.rollData)
} else {
MaleficesUtility.rollMalefices(this.rollData)
}
}
/* -------------------------------------------- */
@@ -70,6 +81,12 @@ export class MaleficesRollDialog extends Dialog {
html.find('#bonusMalusPortee').change((event) => {
this.rollData.bonusMalusPortee = Number(event.currentTarget.value)
})
html.find('#confrontationDegre').change((event) => {
this.rollData.confrontationDegre = Number(event.currentTarget.value)
})
html.find('#confrontationModif').change((event) => {
this.rollData.confrontationModif = Number(event.currentTarget.value)
})
}
}