Fixed some issues with skill display

This commit is contained in:
Stefan Zermatten
2022-08-19 14:03:03 +02:00
parent 6d42eb62f0
commit 28307e26c3
5 changed files with 16 additions and 40 deletions

View File

@@ -4,7 +4,7 @@
// by computeVariableAsSkill
export default function computeSkill(computation, node){
const prop = node.data;
prop.proficiency = prop.baseProficiency;
prop.proficiency = prop.baseProficiency || 0;
let profBonus = computation.scope['proficiencyBonus']?.value || 0;
// Multiply the proficiency bonus by the actual proficiency
if(prop.proficiency === 0.49){

View File

@@ -33,6 +33,9 @@ export default function computeVariableAsSkill(computation, node, prop){
const aggregator = node.data.effectAggregator;
const aggregatorBase = aggregator?.base || 0;
// Store effects
prop.effects = node.data.effects;
// If there is no aggregator, determine if the prop can hide, then exit
if (!aggregator){
prop.hide = statBase === undefined &&
@@ -71,8 +74,6 @@ export default function computeVariableAsSkill(computation, node, prop){
prop.fail = aggregator.fail;
// Rollbonus
prop.rollBonuses = aggregator.rollBonus;
// Store effects
prop.effects = node.data.effects;
}
function aggregateAbilityEffects({computation, skillNode, abilityNode}){

View File

@@ -135,6 +135,7 @@ let ComputedOnlySkillSchema = createPropertySchema({
effects: {
type: Array,
optional: true,
removeBeforeCompute: true,
},
'effects.$': {
type: Object,

View File

@@ -8,7 +8,7 @@
<v-list-item-title class="d-flex align-center">
<roll-popup
v-if="!hideModifier"
class="prof-mod mr-1"
class="prof-mod mr-1 flex-shrink-0"
button-class="pl-3 pr-2"
text
:roll-text="displayedModifier"
@@ -43,7 +43,7 @@
:value="model.proficiency"
class="prof-icon ml-3 mr-2"
/>
<div>
<div class="text-truncate">
{{ model.name }}
<template v-if="model.conditionalBenefits && model.conditionalBenefits.length">
*

View File

@@ -47,6 +47,12 @@
name="Passive score"
:value="passiveScore"
/>
<property-field
v-if="model.overridden"
:cols="{cols: 6, md: 12}"
name="Overridden"
value="Overriden by another property with the same variable name"
/>
</v-row>
<v-row dense>
<property-description
@@ -55,7 +61,7 @@
/>
</v-row>
<v-row
v-if="baseEffects.length || ability || effects.length"
v-if="ability || (effects && effects.length)"
dense
>
<property-field
@@ -63,14 +69,6 @@
name="Effects"
>
<v-list style="width: 100%">
<attribute-effect
v-for="effect in baseEffects"
:key="effect._id === model._id ? 'this_base' : effect._id"
:model="effect"
:hide-breadcrumbs="effect._id === model._id"
:data-id="effect._id"
@click="effect._id !== model._id && clickEffect(effect._id)"
/>
<attribute-effect
v-if="ability"
:key="ability._id"
@@ -188,32 +186,8 @@ export default {
variables(){
return CreatureVariables.findOne({_creatureId: this.context.creatureId}) || {};
},
baseEffects(){
if (this.context.creatureId){
let creatureId = this.context.creatureId;
return CreatureProperties.find({
'ancestors.id': creatureId,
type: 'skill',
variableName: this.model.variableName,
removed: {$ne: true},
inactive: {$ne: true},
}).map( prop => ({
_id: prop._id,
name: 'Skill base value',
operation: 'base',
calculation: prop.baseValueCalculation,
amount: {value: prop.baseValue?.value},
stats: [prop.variableName],
ancestors: prop.ancestors,
}) ).filter(effect => effect.amount?.value);
} else {
return [];
}
},
effects() {
return CreatureProperties.find({
_id: { $in: this.model.effects?.map(e => e._id) || [] }
});
return this.model.effects;
},
baseProficiencies(){
if (this.context.creatureId){
@@ -265,7 +239,7 @@ export default {
return {
_id: abilityProp._id,
name: abilityProp.name,
operation: 'base',
operation: 'add',
amount: {value: abilityProp.modifier},
stats: [this.model.variableName],
ancestors: abilityProp.ancestors,