Fixed, saving throw changing target of later props

the target will only be changed for the children of
the save
This commit is contained in:
Stefan Zermatten
2023-06-07 15:20:04 +02:00
parent 40b04e519f
commit 9ae8d63fc4

View File

@@ -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;
}