diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 27fbd436..46cbed5d 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -108,11 +108,9 @@ export class RdDRoll extends Dialog { var dialog = this; function updateRollResult(rollData) { - let caracValue = parseInt(rollData.selectedCarac.value) - let rollLevel = dialog._computeFinalLevel(rollData); rollData.dmg = rollData.attackerRoll ? rollData.attackerRoll.dmg : RdDBonus.dmg(rollData, actor.getBonusDegat()); - rollData.finalLevel = rollLevel; - rollData.caracValue = caracValue; + rollData.finalLevel = dialog._computeFinalLevel(rollData); + rollData.caracValue = parseInt(rollData.selectedCarac.value); rollData.coupsNonMortels = (rollData.attackerRoll ? rollData.attackerRoll.dmg.mortalite : rollData.dmg.mortalite) == 'non-mortel'; let dmgText = Misc.toSignedString(rollData.dmg.total); if (rollData.coupsNonMortels) { @@ -120,7 +118,10 @@ export class RdDRoll extends Dialog { } HtmlUtility._showControlWhen($(".diffMoral"), rollData.selectedCarac == actor.data.data.carac.volonte); - HtmlUtility._showControlWhen($(".etat-general"), !dialog._isIgnoreEtatGeneral(rollData)); + + HtmlUtility._showControlWhen($("#ajustements"), (!dialog._isIgnoreEtatGeneral(rollData)) || dialog._isAjustementAstrologique(rollData)); + HtmlUtility._showControlWhen($("#etat-general"), !dialog._isIgnoreEtatGeneral(rollData)); + HtmlUtility._showControlWhen($("#ajust-astrologique"), dialog._isAjustementAstrologique(rollData)); // Sort management if (rollData.selectedSort) { @@ -137,9 +138,9 @@ export class RdDRoll extends Dialog { $("#dmg-arme-actor").text(dmgText); $("#defenseur-surprise").text(RdDBonus.description(rollData.surpriseDefenseur)); $(".table-resolution").remove(); - $("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(caracValue, rollLevel)); + $("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(rollData.caracValue, rollData.finalLevel)); $(".span-valeur").remove(); - $("#resolutionValeurs").append(RdDResolutionTable.buildHTMLResults(caracValue, rollLevel)); + $("#resolutionValeurs").append(RdDResolutionTable.buildHTMLResults(rollData.caracValue, rollData.finalLevel)); } // Setup everything onload @@ -228,7 +229,7 @@ export class RdDRoll extends Dialog { const malusEnc = (rollData.surencMalusApply) ? rollData.surencMalusValue : 0; const bonusTactique = RdDBonus.bonusAttaque(rollData.tactique); const malusEncTotal = (rollData.useMalusEncTotal) ? -rollData.encTotal : 0; - const ajustementChance = rollData.selectedCarac.label.toLowerCase().includes('chance') ? rollData.ajustementAstrologique : 0; + const ajustementChance = this._isAjustementAstrologique(rollData) ? rollData.ajustementAstrologique : 0; // Gestion malus armure const malusArmureValue = this._computeMalusArmure(rollData); @@ -239,6 +240,16 @@ export class RdDRoll extends Dialog { return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusEnc + malusEncTotal + malusArmureValue + ajustementChance + bonusTactique; } + _isAjustementAstrologique(rollData) { + if (rollData.selectedCarac.label.toLowerCase().includes('chance')) { + return true; + } + if (rollData.selectedSort && rollData.selectedSort.data.isrituel) { + return true; + } + return false; + } + _computeDiffCompetence(rollData) { if (rollData.competence) { return Misc.toInt(rollData.competence.data.niveau); diff --git a/templates/dialog-competence.html b/templates/dialog-competence.html index a51923d0..01ea28dc 100644 --- a/templates/dialog-competence.html +++ b/templates/dialog-competence.html @@ -60,8 +60,10 @@ {{/if}}