From 60b21c19015be943386b742716a2ed0af8a2872d Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Tue, 8 Nov 2022 18:29:27 +0200 Subject: [PATCH] Fixed bugs with effects they were not providing advantage or conditional benefits --- .../computeVariable/aggregate/aggregateEffect.js | 12 ++++++------ .../creatureProperties/AddCreaturePropertyDialog.vue | 8 -------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/app/imports/api/engine/computation/computeComputation/computeByType/computeVariable/aggregate/aggregateEffect.js b/app/imports/api/engine/computation/computeComputation/computeByType/computeVariable/aggregate/aggregateEffect.js index 3b1b987e..ae609923 100644 --- a/app/imports/api/engine/computation/computeComputation/computeByType/computeVariable/aggregate/aggregateEffect.js +++ b/app/imports/api/engine/computation/computeComputation/computeByType/computeVariable/aggregate/aggregateEffect.js @@ -1,6 +1,6 @@ import { pick } from 'lodash'; -export default function aggregateEffect({node, linkedNode, link}){ +export default function aggregateEffect({ node, linkedNode, link }) { if (link.data !== 'effect') return; // store the effect aggregator, its presence indicates that the variable is // targeted by effects @@ -38,6 +38,7 @@ export default function aggregateEffect({node, linkedNode, link}){ operation: linkedNode.data.operation, amount: effectAmount, type: linkedNode.data.type, + text: linkedNode.data.text, // ancestors: linkedNode.data.ancestors, }); @@ -45,14 +46,13 @@ export default function aggregateEffect({node, linkedNode, link}){ const aggregator = node.data.effectAggregator; // Get the result of the effect const result = linkedNode.data.amount?.value; - // Skip aggregating if the result is not resolved completely - if (typeof result === 'string' || result === undefined) return; + // Aggregate the effect based on its operation - switch(linkedNode.data.operation){ + switch (linkedNode.data.operation) { case 'base': // Take the largest base value - if (Number.isFinite(result)){ - if(Number.isFinite(aggregator.base)){ + if (Number.isFinite(result)) { + if (Number.isFinite(aggregator.base)) { aggregator.base = Math.max(aggregator.base, result); } else { aggregator.base = result; diff --git a/app/imports/ui/creature/creatureProperties/AddCreaturePropertyDialog.vue b/app/imports/ui/creature/creatureProperties/AddCreaturePropertyDialog.vue index 720b4c45..60eea258 100644 --- a/app/imports/ui/creature/creatureProperties/AddCreaturePropertyDialog.vue +++ b/app/imports/ui/creature/creatureProperties/AddCreaturePropertyDialog.vue @@ -24,14 +24,6 @@ > mdi-help -