From 9e8ebdda0daa79c560fbdda5c698a67d30b3b1dc Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 5 Dec 2020 01:10:06 +0100 Subject: [PATCH] =?UTF-8?q?L'=C3=A9tat=20g=C3=A9n=C3=A9ral=20ne=20s'appliq?= =?UTF-8?q?ue=20pas=20toujours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - jets de chance - jets de résistance (Rêve Actuel) - jets de stress (ne passe pas par la fenêtre de résolution) RdD Page 93 --- module/rdd-roll-dialog.js | 17 +++++++++++++++-- templates/dialog-competence.html | 2 +- templates/dialog-roll-carac.html | 2 +- templates/dialog-roll-sort.html | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/module/rdd-roll-dialog.js b/module/rdd-roll-dialog.js index c434c475..71afc43b 100644 --- a/module/rdd-roll-dialog.js +++ b/module/rdd-roll-dialog.js @@ -71,7 +71,13 @@ export class RdDRollDialog extends Dialog { rollData.finalLevel = rollLevel; rollData.caracValue = caracValue - + + if (RdDRollDialog._isEtatGeneralApplicable(rollData)) { + $(".etat-general").show(); + } + else { + $(".etat-general").hide(); + } // Sort management if ( rollData.selectedSort ) { //console.log("Toggle show/hide", rollData.selectedSort); @@ -167,9 +173,16 @@ export class RdDRollDialog extends Dialog { }); } + static _isEtatGeneralApplicable(rollData) { + if (rollData.selectedCarac.label == 'Chance') return false; + if (rollData.selectedCarac.label == 'Rêve Actuel') return false; + + return true; + } + /* -------------------------------------------- */ static _computeFinalLevel(rollData) { - const etat = Misc.toInt(rollData.etat); + const etat = RdDRollDialog._isEtatGeneralApplicable(rollData) ? Misc.toInt(rollData.etat) : 0; const diffConditions = Misc.toInt(rollData.diffConditions); let malusEnc = (rollData.surencMalusApply ) ? rollData.surencMalusValue : 0; let diffLibre = Misc.toInt(rollData.diffLibre); diff --git a/templates/dialog-competence.html b/templates/dialog-competence.html index dc929b5f..316ef4cb 100644 --- a/templates/dialog-competence.html +++ b/templates/dialog-competence.html @@ -45,7 +45,7 @@ {{/if}} {{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-natation.html"}} -
+
diff --git a/templates/dialog-roll-carac.html b/templates/dialog-roll-carac.html index fcdda7fb..6fa8be3a 100644 --- a/templates/dialog-roll-carac.html +++ b/templates/dialog-roll-carac.html @@ -19,7 +19,7 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}} -
+
diff --git a/templates/dialog-roll-sort.html b/templates/dialog-roll-sort.html index 98e86d83..fc227009 100644 --- a/templates/dialog-roll-sort.html +++ b/templates/dialog-roll-sort.html @@ -59,7 +59,7 @@
-
+