Removed all UI computations from viewers and components

This commit is contained in:
Stefan Zermatten
2021-01-31 18:42:17 +02:00
parent a5284bf6e8
commit aee899e181
27 changed files with 107 additions and 232 deletions

View File

@@ -44,11 +44,22 @@ function combineAttribute(stat, aggregator, memo){
stat.dependencies.push(...dependencies);
}
stat.currentValue = stat.value - (stat.damage || 0);
// Ability scores get modifiers
if (stat.attributeType === 'ability') {
stat.modifier = Math.floor((stat.currentValue - 10) / 2);
} else {
stat.modifier = undefined;
}
// Hit dice get constitution modifiers
stat.constitutionMod = undefined;
if (stat.attributeType === 'hitDice') {
let conStat = memo.statsByVariableName['constitution'];
if (conStat && 'modifier' in conStat){
stat.constitutionMod = conStat.modifier;
stat.dependencies.push(conStat._id, ...conStat.dependencies);
}
}
// Stats that have no effects can be hidden based on a sheet setting
stat.hide = aggregator.hasNoEffects &&
stat.baseValue === undefined ||
undefined

View File

@@ -6,6 +6,10 @@ export default function computeEndStepProperty(prop, memo){
case 'spell':
computeAction(prop, memo);
break;
case 'adjustment':
case 'damage':
computePropertyField(prop, memo, 'amount', 'compile');
break;
case 'attack':
computeAction(prop, memo);
computeAttack(prop, memo);