From fa7196d5d26f8ea143eb55d5b6186576197b093c Mon Sep 17 00:00:00 2001 From: Dapoolp Date: Thu, 4 Sep 2025 15:57:34 +0200 Subject: [PATCH] Fix costs object being updated during getRealCosts --- module/data/fields/action/costField.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/data/fields/action/costField.mjs b/module/data/fields/action/costField.mjs index f4d942b1..4c8fad88 100644 --- a/module/data/fields/action/costField.mjs +++ b/module/data/fields/action/costField.mjs @@ -94,7 +94,8 @@ export default class CostField extends fields.ArrayField { } static getRealCosts(costs) { - const realCosts = costs?.length ? costs.filter(c => c.enabled) : []; + const cloneCosts = foundry.utils.deepClone(costs), + realCosts = cloneCosts?.length ? cloneCosts.filter(c => c.enabled) : []; let mergedCosts = []; realCosts.forEach(c => { const getCost = Object.values(mergedCosts).find(gc => gc.key === c.key);