From 24aac791011109ccebd4612663e336b1fe116df9 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Sat, 27 Jun 2026 22:04:04 +0200 Subject: [PATCH] fix: protection stacking + remove misleading def from combat card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getProtection(): replace threshold sum<4 with hasRealArmor check. Old logic broke when two sub-4 items (e.g. shield 2 + light armor 3) summed >=4 and lost the base+4 bonus — causing protection to decrease when equipping them together. actor-sheet.hbs: remove defenseTotal from top-right combat card. This value excluded Mêlée skill, making it always wrong vs the per-weapon defense shown in the combat tab. --- modules/mournblade-cyd2-actor.js | 14 ++++++++------ templates/actor-sheet.hbs | 4 ---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/mournblade-cyd2-actor.js b/modules/mournblade-cyd2-actor.js index b649e40..33d0c59 100644 --- a/modules/mournblade-cyd2-actor.js +++ b/modules/mournblade-cyd2-actor.js @@ -221,16 +221,18 @@ export class MournbladeCYD2Actor extends Actor { } /* -------------------------------------------- */ getProtection() { - let equipProtection = 0 + let sum = 0 + let hasRealArmor = false for (let armor of this.items) { if (armor.type == "protection" && armor.system.equipped) { - equipProtection += Number(armor.system.protection) + const val = Number(armor.system.protection) + sum += val + if (val >= 4) hasRealArmor = true } } - if (equipProtection < 4) { - return 4 + equipProtection // Cas des boucliers + sans armure - } - return equipProtection // Uniquement la protection des armures + boucliers + if (sum === 0) return 4 // Aucune protection → base 4 + if (hasRealArmor) return sum // Au moins une vraie armure → somme directe + return 4 + sum // Que des boucliers/protections légères → base + bonus } getProtectionTotal() { return this.getProtection() diff --git a/templates/actor-sheet.hbs b/templates/actor-sheet.hbs index 3a2a426..4db2aed 100644 --- a/templates/actor-sheet.hbs +++ b/templates/actor-sheet.hbs @@ -111,10 +111,6 @@ {{combat.initTotal}} -
- - {{combat.defenseTotal}} -
{{protectionTotal}}