Added advantage to attributes

ability checks will be automatically made with adv
when appropriate
This commit is contained in:
Stefan Zermatten
2023-06-07 12:29:29 +02:00
parent 15ff16bb8c
commit 4d6c6b6094

View File

@@ -9,6 +9,18 @@ export default function computeVariableAsAttribute(computation, node, prop){
// Proficiency
prop.proficiency = node.data.proficiency;
// Advantage/disadvantage
const aggregator = node.data.effectAggregator;
if (aggregator) {
if (aggregator.advantage && !aggregator.disadvantage) {
prop.advantage = 1;
} else if (aggregator.disadvantage && !aggregator.advantage) {
prop.advantage = -1;
} else {
prop.advantage = 0;
}
}
// Ability scores get modifiers
if (prop.attributeType === 'ability') {
prop.modifier = Math.floor((prop.value - 10) / 2);