From b866c95ebd43e86c3e64170ab526521d77170b2a Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 5 Oct 2024 12:57:02 +0200 Subject: [PATCH] Correction de la protection --- module/actor/export-scriptarium/mapping.js | 10 +++++----- templates/actor/export-scriptarium/carac-derivee.hbs | 5 ++++- templates/actor/export-scriptarium/protection.hbs | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/module/actor/export-scriptarium/mapping.js b/module/actor/export-scriptarium/mapping.js index eb79530b..baa94bc2 100644 --- a/module/actor/export-scriptarium/mapping.js +++ b/module/actor/export-scriptarium/mapping.js @@ -80,7 +80,7 @@ const MAPPING_BASE = [ { column: "endurance", getter: (actor, context) => actor.system.sante.endurance.max }, { column: "description", getter: (actor, context) => Mapping.getDescription(actor) }, { column: "armure", getter: (actor, context) => Mapping.getArmure(actor, context) }, - { column: "protection", getter: (actor, context) => Mapping.getProtectionArmure(actor, context) }, + { column: "protectionarmure", colName: 'Protection', getter: (actor, context) => Mapping.getProtectionArmure(actor, context) }, { column: "malus_armure", getter: (actor, context) => Mapping.getMalusArmure(actor, context) }, { column: "esquive", getter: (actor, context) => Mapping.getEsquive(context) }, { column: "esquive_armure", getter: (actor, context) => Mapping.getEsquiveArmure(context) }, @@ -273,14 +273,14 @@ export class Mapping { } static getProtectionArmure(actor, context) { - const protection = Number(actor.system.attributs.protection.value) + const naturelle = Number(actor.system.attributs.protection.value) if (context?.armure?.protection == undefined) { - return protection + return naturelle } if (Number.isNumeric(context?.armure?.protection)) { - return Number(context?.armure?.protection ?? 0) + protection + return Number(context?.armure?.protection ?? 0) + naturelle } - return context?.armure.protection + (protection > 0 ? `+${protection}` : '') + return context?.armure.protection + (naturelle > 0 ? `+${naturelle}` : '') } static getMalusArmure(actor, context) { diff --git a/templates/actor/export-scriptarium/carac-derivee.hbs b/templates/actor/export-scriptarium/carac-derivee.hbs index 0ff88f65..d850534c 100644 --- a/templates/actor/export-scriptarium/carac-derivee.hbs +++ b/templates/actor/export-scriptarium/carac-derivee.hbs @@ -1 +1,4 @@ -
{{upperFirst carac.colName}}
{{carac.value}}
+
+
{{upperFirst carac.colName}}
+
{{carac.value}}
+
diff --git a/templates/actor/export-scriptarium/protection.hbs b/templates/actor/export-scriptarium/protection.hbs index 15ac8712..0adaca74 100644 --- a/templates/actor/export-scriptarium/protection.hbs +++ b/templates/actor/export-scriptarium/protection.hbs @@ -1,7 +1,8 @@ {{#if protectionnaturelle.value}} - {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" protectionnaturelle}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" carac=protectionnaturelle}} {{/if}} -{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" protection}} +{{log 'protectionarmure' protectionarmure}} +{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" carac=protectionarmure}} {{#if armure.value}}
{{armure.value}}
{{/if}}