Fixed bugs with effects

they were not providing advantage or conditional benefits
This commit is contained in:
Stefan Zermatten
2022-11-08 18:29:27 +02:00
parent 03f87b0afa
commit 60b21c1901
2 changed files with 6 additions and 14 deletions

View File

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

View File

@@ -24,14 +24,6 @@
>
<v-icon>mdi-help</v-icon>
</v-btn>
<v-switch
v-if="tab === 0"
:input-value="showPropertyHelp"
append-icon="mdi-help"
hide-details
flat
@change="propertyHelpChanged"
/>
<text-field
v-if="tab === 2"
prepend-inner-icon="mdi-magnify"