diff --git a/module/data/fields/action/costField.mjs b/module/data/fields/action/costField.mjs index f4d942b1..9693ac03 100644 --- a/module/data/fields/action/costField.mjs +++ b/module/data/fields/action/costField.mjs @@ -95,6 +95,14 @@ export default class CostField extends fields.ArrayField { static getRealCosts(costs) { const realCosts = costs?.length ? costs.filter(c => c.enabled) : []; + + // Reset totals in case of repeat calls. + realCosts.forEach(c => { + c.scale = c.scale ?? 0; + c.step = c.step ?? 1; + c.total = c.value + c.scale * c.step; + }); + let mergedCosts = []; realCosts.forEach(c => { const getCost = Object.values(mergedCosts).find(gc => gc.key === c.key); diff --git a/module/dice/dhRoll.mjs b/module/dice/dhRoll.mjs index 6d691c20..f622411e 100644 --- a/module/dice/dhRoll.mjs +++ b/module/dice/dhRoll.mjs @@ -226,16 +226,16 @@ export const registerRollDiceHooks = () => { let updates = []; if (!actor) return; if (config.roll.isCritical || config.roll.result.duality === 1) - updates.push({ key: 'hope', value: 1, total: -1, enabled: true }); - if (config.roll.isCritical) updates.push({ key: 'stress', value: 1, total: -1, enabled: true }); - if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1, total: -1, enabled: true }); + updates.push({ key: 'hope', value: -1, total: -1, enabled: true }); + if (config.roll.isCritical) updates.push({ key: 'stress', value: -1, total: -1, enabled: true }); + if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: -1, total: -1, enabled: true }); if (config.rerolledRoll) { if (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1) - updates.push({ key: 'hope', value: -1, total: 1, enabled: true }); - if (config.rerolledRoll.isCritical) updates.push({ key: 'stress', value: -1, total: 1, enabled: true }); + updates.push({ key: 'hope', value: -1, total: -1, enabled: true }); + if (config.rerolledRoll.isCritical) updates.push({ key: 'stress', value: -1, total: -1, enabled: true }); if (config.rerolledRoll.result.duality === -1) - updates.push({ key: 'fear', value: -1, total: 1, enabled: true }); + updates.push({ key: 'fear', value: -1, total: -1, enabled: true }); } if (updates.length) {