From d1a8c13b843977a07d32985f954f0138d0b15750 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 13 Jan 2021 17:30:44 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20etat=20g=C3=A9n=C3=A9ral=20sur=20Haut=20?= =?UTF-8?q?r=C3=AAve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-carac.js | 4 ++-- module/rdd-roll.js | 2 +- module/rolldata-ajustements.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/rdd-carac.js b/module/rdd-carac.js index 921bbb6e..ae9cdf26 100644 --- a/module/rdd-carac.js +++ b/module/rdd-carac.js @@ -13,10 +13,10 @@ export class RdDCarac { return selectedCarac?.label?.toLowerCase()?.match(/r(e|ê)ve(( |-)actuel)?/); } - static isIgnoreEtatGeneral(selectedCarac) { + static isIgnoreEtatGeneral(selectedCarac, competence) { return !selectedCarac || RdDCarac.isChance(selectedCarac) || - RdDCarac.isReve(selectedCarac); + (RdDCarac.isReve(selectedCarac) && !competence); } /** diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 6b998e44..de2f3b05 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -210,7 +210,7 @@ export class RdDRoll extends Dialog { rollData.finalLevel = this._computeFinalLevel(rollData); HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used); - HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac)); + HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence)); HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData)); // Sort management diff --git a/module/rolldata-ajustements.js b/module/rolldata-ajustements.js index 5eff690d..1929f7ef 100644 --- a/module/rolldata-ajustements.js +++ b/module/rolldata-ajustements.js @@ -49,7 +49,7 @@ export const referenceAjustements = { getValue: (rollData, actor) => RdDBonus.find(rollData.surpriseDefenseur).attaque, }, etat: { - isUsed: (rollData, actor) => !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac), + isUsed: (rollData, actor) => !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence), getLabel: (rollData, actor) => 'Etat général', getValue: (rollData, actor) => actor.getEtatGeneral() },