From 3362f2473a5a82a0ca1166ffc33ee83389e5b272 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 19 Nov 2022 01:37:00 +0100 Subject: [PATCH] =?UTF-8?q?Jet=20de=20Carac=20avec=20comp=C3=A9tence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pour faire plus rapidement les jets depuis les caracs --- module/actor.js | 5 ++++- module/rdd-roll.js | 5 +++++ module/rdd-utility.js | 1 + templates/dialog-roll-carac.html | 2 ++ templates/partial-roll-competences.html | 8 ++++++++ 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 templates/partial-roll-competences.html diff --git a/module/actor.js b/module/actor.js index 6632412a..5e91f3c7 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2471,7 +2471,10 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async rollCarac(caracName) { - let rollData = { selectedCarac: this.getCaracByName(caracName) }; + let rollData = { + selectedCarac: this.getCaracByName(caracName), + competences: this.itemTypes['competence'] + }; const dialog = await RdDRoll.create(this, rollData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html' }, diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 3c10fcad..836bce49 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -217,6 +217,11 @@ export class RdDRoll extends Dialog { this.updateRollResult(); $("#diffLibre").val(this.rollData.diffLibre); }); + html.find('.roll-carac-competence').change((event) => { + const competence = event.currentTarget.value; + this.rollData.competence = this.rollData.competences.find(it => it.name == competence); + this.updateRollResult(); + }); html.find('.roll-signedraconique').change((event) => { let sortKey = Misc.toInt(event.currentTarget.value); this.setSelectedSigneDraconique(this.rollData.signes[sortKey]); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 7f99fc45..636487a0 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -222,6 +222,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html', + 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-competences.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html', // Dialogs diff --git a/templates/dialog-roll-carac.html b/templates/dialog-roll-carac.html index 89c454ab..d2f3e5dc 100644 --- a/templates/dialog-roll-carac.html +++ b/templates/dialog-roll-carac.html @@ -5,7 +5,9 @@
+ {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-competences.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html"}} diff --git a/templates/partial-roll-competences.html b/templates/partial-roll-competences.html new file mode 100644 index 00000000..9d13235d --- /dev/null +++ b/templates/partial-roll-competences.html @@ -0,0 +1,8 @@ +
+ + +