From 7a480e333c0c8434b2bf87676b352116d58b41c1 Mon Sep 17 00:00:00 2001 From: ThaumRystra Date: Tue, 15 Oct 2024 21:12:55 +0200 Subject: [PATCH] Fixed saving throws contaminating later saves with their result --- .../action/applyProperties/applySavingThrowProperty.test.ts | 2 +- .../engine/action/applyProperties/applySavingThrowProperty.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/imports/api/engine/action/applyProperties/applySavingThrowProperty.test.ts b/app/imports/api/engine/action/applyProperties/applySavingThrowProperty.test.ts index 78cd18e2..ef44505f 100644 --- a/app/imports/api/engine/action/applyProperties/applySavingThrowProperty.test.ts +++ b/app/imports/api/engine/action/applyProperties/applySavingThrowProperty.test.ts @@ -60,7 +60,7 @@ const actionTargetCreature2 = { ], } -describe.only('Apply saving throw properties', function () { +describe('Apply saving throw properties', function () { // Increase timeout this.timeout(8000); diff --git a/app/imports/api/engine/action/applyProperties/applySavingThrowProperty.ts b/app/imports/api/engine/action/applyProperties/applySavingThrowProperty.ts index d48deb60..f989851e 100644 --- a/app/imports/api/engine/action/applyProperties/applySavingThrowProperty.ts +++ b/app/imports/api/engine/action/applyProperties/applySavingThrowProperty.ts @@ -10,8 +10,6 @@ import { getVariables } from '/imports/api/engine/loadCreatures'; import numberToSignedString from '/imports/api/utility/numberToSignedString'; import { isFiniteNode } from '/imports/parser/parseTree/constant'; -// FIXME saves against multiple targets contaminate later targets scope with the ~saveFailed or ~saveSucceeded variables of the previous targets - export default async function applySavingThrowProperty( task: PropTask, action: EngineAction, result: TaskResult, inputProvider: InputProvider ): Promise { @@ -100,8 +98,10 @@ export default async function applySavingThrowProperty( const saveSuccess = resultValue >= dc; if (saveSuccess) { result.pushScope['~saveSucceeded'] = { value: true }; + result.pushScope['~saveFailed'] = { value: false }; } else { result.pushScope['~saveFailed'] = { value: true }; + result.pushScope['~saveSucceeded'] = { value: false }; } if (!prop.silent) result.appendLog({ name: saveSuccess ? 'Successful save' : 'Failed save',