From b8f236fa97eaff7bc1d438a62881e01b62b83ece Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 28 Sep 2024 17:45:31 +0200 Subject: [PATCH] Fix esquive avec armure - ajout de champ sans armure/avec armure - calcul correct avec armure --- module/actor/export-scriptarium/mapping.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/module/actor/export-scriptarium/mapping.js b/module/actor/export-scriptarium/mapping.js index e667d81b..082ed1a5 100644 --- a/module/actor/export-scriptarium/mapping.js +++ b/module/actor/export-scriptarium/mapping.js @@ -80,7 +80,8 @@ const MAPPING_BASE = [ { column: "armure", getter: (actor, context) => Mapping.getArmure(actor, context) }, { column: "protection", getter: (actor, context) => Mapping.getProtectionArmure(actor, context) }, { column: "malus-armure", getter: (actor, context) => Mapping.getMalusArmure(actor, context) }, - { column: "esquive", getter: (actor, context) => Mapping.getEsquiveNiveau(context) }, + { column: "esquive", getter: (actor, context) => Mapping.getEsquive(context) }, + { column: "esquive-armure", getter: (actor, context) => Mapping.getEsquiveArmure(context) }, { column: "competences", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_COMPETENCES) }, { column: "draconic", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_DRACONIC) }, ] @@ -181,7 +182,7 @@ export class Mapping { const esquive = esquives[0] return { name: esquive.name, - niveau: Misc.toSignedString(esquive.system.niveau) + niveau: esquive.system.niveau } } return undefined @@ -242,10 +243,16 @@ export class Mapping { return context?.armure?.malus ?? 0 } - static getEsquiveNiveau(context) { + static getEsquive(context) { + if (context.esquive) { + return Misc.toSignedString(context.esquive.niveau) + } + return '' + } + static getEsquiveArmure(context) { if (context.esquive) { const niveau = context.esquive.niveau + context.armure.malus - return niveau > 0 ? ('+' + niveau) : ('' + niveau) + return Misc.toSignedString(niveau) } return '' }