From a07819611e677e73ca1cb2eedbddd6cda7473e05 Mon Sep 17 00:00:00 2001 From: Dapoulp <74197441+Dapoulp@users.noreply.github.com> Date: Sat, 16 Aug 2025 01:05:05 +0200 Subject: [PATCH] Fix armor slot reduction (#968) * Temp ActionField attack type missing * Move missing attack type to getModel * Fix armor slot reduction if armor as part of damage --- module/documents/actor.mjs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index 84dd6d18..4a6d2d67 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -571,10 +571,20 @@ export default class DhpActor extends Actor { if (armorSlotResult) { const { modifiedDamage, armorSpent, stressSpent } = armorSlotResult; updates.find(u => u.key === 'hitPoints').value = modifiedDamage; - updates.push( - ...(armorSpent ? [{ value: armorSpent, key: 'armor' }] : []), - ...(stressSpent ? [{ value: stressSpent, key: 'stress' }] : []) - ); + if(armorSpent) { + const armorUpdate = updates.find(u => u.key === 'armor'); + if(armorUpdate) + armorUpdate.value += armorSpent; + else + updates.push({ value: armorSpent, key: 'armor' }); + } + if(stressSpent) { + const stressUpdate = updates.find(u => u.key === 'stress'); + if(stressUpdate) + stressUpdate.value += stressSpent; + else + updates.push({ value: stressSpent, key: 'stress' }); + } } } }