Fix: validation encaissement MJ

This commit is contained in:
2023-06-05 20:18:05 +02:00
parent 6c4a8eb70f
commit 4273f5f48f
6 changed files with 26 additions and 20 deletions

View File

@ -7,7 +7,7 @@ import { RdDUtility } from "./rdd-utility.js";
*/
export class DialogValidationEncaissement extends Dialog {
static async validerEncaissement(actor, rollData, armure, show, onEncaisser) {
static async validerEncaissement(actor, rollData, armure, show, attackerId, onEncaisser) {
let encaissement = await RdDUtility.jetEncaissement(rollData, armure, { showDice: HIDE_DICE });
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-validation-encaissement.html', {
actor: actor,
@ -15,12 +15,12 @@ export class DialogValidationEncaissement extends Dialog {
encaissement: encaissement,
show: show
});
const dialog = new DialogValidationEncaissement(html, actor, rollData, armure, encaissement, show, onEncaisser);
const dialog = new DialogValidationEncaissement(html, actor, rollData, armure, encaissement, show, attackerId, onEncaisser);
dialog.render(true);
}
/* -------------------------------------------- */
constructor(html, actor, rollData, armure, encaissement, show, onEncaisser) {
constructor(html, actor, rollData, armure, encaissement, show, attackerId, onEncaisser) {
// Common conf
let buttons = {
"valider": { label: "Valider", callback: html => this.onValider() },
@ -48,6 +48,7 @@ export class DialogValidationEncaissement extends Dialog {
this.armure = armure;
this.encaissement = encaissement;
this.show = show;
this.attackerId = attackerId;
this.onEncaisser = onEncaisser;
this.forceDiceResult = {total: encaissement.roll.result };
}
@ -66,6 +67,6 @@ export class DialogValidationEncaissement extends Dialog {
async onValider() {
this.encaissement = await RdDUtility.jetEncaissement(this.rollData, this.armure, { showDice: SHOW_DICE, forceDiceResult: this.forceDiceResult});
this.onEncaisser(this.encaissement, this.show)
this.onEncaisser(this.encaissement, this.show, this.attackerId)
}
}