From f34db764cbb1f50f0467cff259f64873e686e10a Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 8 Dec 2023 22:26:29 +0100 Subject: [PATCH] Permettre les jets de chance sans astrologie MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quand on fait un jet de chance pour la journée, permettre de ne pas utiliser l'ajustement astrologique --- module/rdd-bonus.js | 4 ---- module/rdd-roll.js | 6 ++++++ module/rdd-utility.js | 9 +++++---- module/rolldata-ajustements.js | 19 +++++++++++++------ styles/simple.css | 4 ++++ templates/dialog-roll-carac.html | 3 ++- templates/dialog-roll.html | 3 ++- templates/partial-roll-astrologique.hbs | 6 ++++++ 8 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 templates/partial-roll-astrologique.hbs diff --git a/module/rdd-bonus.js b/module/rdd-bonus.js index 2df1b670..93c1d36e 100644 --- a/module/rdd-bonus.js +++ b/module/rdd-bonus.js @@ -19,10 +19,6 @@ export class RdDBonus { } - static isAjustementAstrologique(rollData) { - return RdDCarac.isChance(rollData.selectedCarac) || - rollData.selectedSort?.system.isrituel; - } /* -------------------------------------------- */ static isDefenseAttaqueFinesse(rollData) { if (rollData.isEmpoignade && rollData.rolled?.isPart) { diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 801d9175..c41f74ec 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -44,6 +44,7 @@ export class RdDRoll extends Dialog { diffLibre: rollData.competence?.system.default_diffLibre ?? 0, perteMoralEchec: false, /* Pour l'affichage dans le chat */ use: { + astrologique: true, moral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */ libre: true, coeur: undefined, @@ -214,6 +215,10 @@ export class RdDRoll extends Dialog { this.rollData[attribute] = event.currentTarget.checked; this.updateRollResult(html); }); + this.html.find('input.use-astrologique').change((event) => { + this.rollData.use.astrologique = event.currentTarget.checked; + this.updateRollResult(html); + }); this.html.find('input.use-encTotal').change((event) => { this.rollData.use.encTotal = event.currentTarget.checked; this.updateRollResult(html); @@ -314,6 +319,7 @@ export class RdDRoll extends Dialog { HtmlUtility.showControlWhen(this.html.find(".use-encTotal"), rollData.ajustements.encTotal.visible && RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac)); HtmlUtility.showControlWhen(this.html.find(".use-surenc"), rollData.ajustements.surenc.visible && RdDCarac.isActionPhysique(rollData.selectedCarac)); + HtmlUtility.showControlWhen(this.html.find(".use-astrologique"), rollData.ajustements.astrologique.visible); HtmlUtility.showControlWhen(this.html.find(".utilisation-moral"), rollData.use.appelAuMoral); HtmlUtility.showControlWhen(this.html.find(".divAppelAuMoral"), rollData.use.appelAuMoral); HtmlUtility.showControlWhen(this.html.find(".utilisation-coeur"), rollData.ajustements.coeur.visible); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index e25a71d9..5baefcfe 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -215,15 +215,16 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html', + 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-astrologique.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-coeur.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-competences.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.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-moral.html', - 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-coeur.hbs', '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-roll-moral.html', + 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-item-hautrevant.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-item-frequence.html', diff --git a/module/rolldata-ajustements.js b/module/rolldata-ajustements.js index df601186..cff5de65 100644 --- a/module/rolldata-ajustements.js +++ b/module/rolldata-ajustements.js @@ -74,6 +74,17 @@ export const referenceAjustements = { getLabel: (rollData, actor) => 'Sur-encombrement', getValue: (rollData, actor) => actor.computeMalusSurEncombrement() }, + rituel: { + isUsed: (rollData, actor) => actor.isPersonnage() && ReglesOptionnelles.isUsing("astrologie") && rollData.selectedSort?.system.isrituel, + getLabel: (rollData, actor) => 'Astrologique', + getValue: (rollData, actor) => actor.ajustementAstrologique() + }, + astrologique: { + isVisible: (rollData, actor) => actor.isPersonnage() && ReglesOptionnelles.isUsing("astrologie") && RdDCarac.isChance(rollData.selectedCarac), + isUsed: (rollData, actor) => RdDCarac.isChance(rollData.selectedCarac) && rollData.use.astrologique, + getLabel: (rollData, actor) => 'Astrologique', + getValue: (rollData, actor) => actor.ajustementAstrologique() + }, moral: { isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.use?.moral, isUsed: (rollData, actor) => rollData.use.moral, @@ -84,18 +95,13 @@ export const referenceAjustements = { isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isVolonte(rollData.selectedCarac), isUsed: (rollData, actor) => rollData.use.coeur != undefined, getLabel: (rollData, actor) => 'Ajustement de cœur', - getValue: (rollData, actor) => -2 * (rollData.use?.coeur?.coeur ?? 0) + getValue: (rollData, actor) => -2 * (rollData.use.coeur?.coeur ?? 0) }, moralTotal: { isUsed: (rollData, actor) => RdDCarac.isVolonte(rollData.selectedCarac), getLabel: (rollData, actor) => 'Moral', getValue: (rollData, actor) => actor.getMoralTotal() }, - astrologique: { - isUsed: (rollData, actor) => ReglesOptionnelles.isUsing("astrologie") && RdDBonus.isAjustementAstrologique(rollData), - getLabel: (rollData, actor) => 'Astrologique', - getValue: (rollData, actor) => actor.ajustementAstrologique() - }, facteurSign: { isUsed: (rollData, actor) => rollData.diviseurSignificative > 1, getLabel: (rollData, actor) => Misc.getFractionHtml(rollData.diviseurSignificative), @@ -193,4 +199,5 @@ export class RollDataAjustements { RdDCarac.isChance(selectedCarac) || (RdDCarac.isReve(selectedCarac) && !rollData.competence); } + } diff --git a/styles/simple.css b/styles/simple.css index a526734f..80d9a24e 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -788,6 +788,10 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) { .rdd-roll-dialog div.dialog-content input { font-size: 1rem; } +.rdd-roll-dialog div.dialog-content input[type="checkbox"]{ + width: 1rem; + vertical-align: sub; +} .rdd-roll-part { align-items: center; border-radius: 6px; padding: 3px; diff --git a/templates/dialog-roll-carac.html b/templates/dialog-roll-carac.html index e981e997..700b511a 100644 --- a/templates/dialog-roll-carac.html +++ b/templates/dialog-roll-carac.html @@ -6,9 +6,10 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-competences.html"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-astrologique.hbs"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-coeur.hbs"}} {{>"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-coeur.hbs"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html"}} diff --git a/templates/dialog-roll.html b/templates/dialog-roll.html index 3d7b98e1..3b4c6ddd 100644 --- a/templates/dialog-roll.html +++ b/templates/dialog-roll.html @@ -8,9 +8,10 @@ {{>"systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-competences.html"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-astrologique.hbs"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-coeur.hbs"}} {{>"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-coeur.hbs"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html"}} diff --git a/templates/partial-roll-astrologique.hbs b/templates/partial-roll-astrologique.hbs new file mode 100644 index 00000000..d665b825 --- /dev/null +++ b/templates/partial-roll-astrologique.hbs @@ -0,0 +1,6 @@ +
+ +