Fixed skill and attribute effect lists

Now using effectId lists
This commit is contained in:
ThaumRystra
2023-11-12 17:38:51 +02:00
parent b32b6db21a
commit 2e3e6e22b6
8 changed files with 94 additions and 88 deletions

View File

@@ -1,21 +1,28 @@
export default function aggregateProficiency({node, linkedNode, link}){
export default function aggregateProficiency({ node, linkedNode, link }) {
if (
link.data !== 'proficiency' &&
!(link.data === 'definition' && linkedNode.data.type === 'skill')
) return;
let proficiency;
if (link.data === 'proficiency'){
if (link.data === 'proficiency') {
proficiency = linkedNode.data.value || 0;
} else if (link.data === 'definition' && linkedNode.data.type === 'skill'){
} else if (link.data === 'definition' && linkedNode.data.type === 'skill') {
proficiency = linkedNode.data.baseProficiency || 0;
} else {
return;
}
if (proficiency) {
// Store a link to the proficiency
node.data.proficiencyIds = node.data.proficiencyIds || [];
node.data.proficiencyIds.push(linkedNode.data._id);
}
// Store the highest proficiency
if (
node.data.proficiency === undefined ||
proficiency > node.data.proficiency
){
) {
node.data.proficiency = proficiency;
}
}

View File

@@ -48,6 +48,7 @@ export default function computeVariableAsAttribute(computation, node, prop) {
prop.baseValue === undefined ||
undefined
// Store effects
// Store effects and proficiencies
prop.effectIds = node.data.effectIds;
prop.proficiencyIds = node.data.proficiencyIds;
}

View File

@@ -33,8 +33,9 @@ export default function computeVariableAsSkill(computation, node, prop) {
const aggregator = node.data.effectAggregator;
const aggregatorBase = aggregator?.base || 0;
// Store effects
// Store effects and proficiencies
prop.effectIds = node.data.effectIds;
prop.proficiencyIds = node.data.proficiencyIds;
// If there is no aggregator, determine if the prop can hide, then exit
if (!aggregator) {