From 9ae8d63fc4f934c6130c0d6d0c43c9a0da94e291 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 7 Jun 2023 15:20:04 +0200 Subject: [PATCH] Fixed, saving throw changing target of later props the target will only be changed for the children of the save --- .../engine/actions/applyPropertyByType/applySavingThrow.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/imports/api/engine/actions/applyPropertyByType/applySavingThrow.js b/app/imports/api/engine/actions/applyPropertyByType/applySavingThrow.js index 2e2133e8..e0803109 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/applySavingThrow.js +++ b/app/imports/api/engine/actions/applyPropertyByType/applySavingThrow.js @@ -8,6 +8,7 @@ import { applyUnresolvedEffects } from '/imports/api/engine/actions/doCheck.js'; export default function applySavingThrow(node, actionContext) { applyNodeTriggers(node, 'before', actionContext); const prop = node.node; + const originalTargets = actionContext.targets; let saveTargets = prop.target === 'self' ? [actionContext.creature] : actionContext.targets; @@ -45,8 +46,8 @@ export default function applySavingThrow(node, actionContext) { delete scope['~saveRoll']; const applyChildren = function () { - applyNodeTriggers(node, 'after', actionContext); actionContext.targets = [target] + applyNodeTriggers(node, 'after', actionContext); node.children.forEach(child => applyProperty(child, actionContext)); }; @@ -106,4 +107,6 @@ export default function applySavingThrow(node, actionContext) { }); return applyChildren(); }); + // reset the targets after the save to each child + actionContext.targets = originalTargets; }