From 003fa8c43a679bb4d5800aec800b0ad9e9be4fc9 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 22 Jan 2021 23:19:17 +0100 Subject: [PATCH] Plus d'attaque avec l'esquive --- module/actor-sheet.js | 15 +++++---------- templates/actor-sheet.html | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 06db623b..79880544 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -90,16 +90,11 @@ export class RdDActorSheet extends ActorSheet { data.data.combat = duplicate(RdDUtility.checkNull(data.itemsByType['arme'])); data.data.combat = RdDUtility._finalizeArmeList(data.data.combat, data.itemsByType.competence, data.data.carac); - if (data.competenceByCategory && data.competenceByCategory.melee) { - //Specific case for Esquive and Corps à Corps - for (const melee of data.competenceByCategory.melee) { - if (melee.name == "Esquive") - data.data.combat.push({ name: "Esquive", data: { niveau: melee.data.niveau, description: "", force: 6, initiative: "", competence: "Esquive", dommages: 0 } }); - if (melee.name == "Corps à corps") { - let cc_init = RdDUtility.calculInitiative(melee.data.niveau, data.data.carac['melee'].value); - data.data.combat.push(RdDItemArme.mainsNues({ niveau: melee.data.niveau, initiative: cc_init })); - } - } + data.esquive = { name: "Esquive", niveau: data.competenceByCategory?.melee.find(it => it.name == 'Esquive')?.data.niveau ?? -6}; + let corpsACorps = data.competenceByCategory?.melee.find(it => it.name == 'Corps à corps'); + if (corpsACorps) { + let cc_init = RdDUtility.calculInitiative(corpsACorps.data.niveau, data.data.carac['melee'].value); + data.data.combat.push(RdDItemArme.mainsNues({ niveau: corpsACorps.data.niveau, initiative: cc_init })); } this.armesList = duplicate(data.data.combat); diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index f3c9bcc3..5597990d 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -529,14 +529,21 @@ {{#each data.combat as |arme key|}}
  • - {{arme.name}} - {{arme.data.initiative}} + {{arme.name}} + {{arme.data.initiative}} {{arme.data.competence}} - {{numberFormat arme.data.niveau decimals=0 sign=true}} - {{numberFormat arme.data.dommages decimals=0 sign=true}} + {{numberFormat arme.data.niveau decimals=0 sign=true}} + {{numberFormat arme.data.dommages decimals=0 sign=true}}
  • {{/each}} - +
  • + {{esquive.name}} + + + {{numberFormat esquive.niveau decimals=0 sign=true}} + +
  • + {{!-- Compteurs/Blessures Tab --}}