Fixed proficiency calculations

This commit is contained in:
Thaum Rystra
2020-04-27 13:56:04 +02:00
parent 17c9d270e6
commit 528e53fc9b
6 changed files with 28 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ export default class ComputationMemo {
this.statsByVariableName[variableName] = prop; this.statsByVariableName[variableName] = prop;
if ( if (
prop.type === 'skill' && prop.type === 'skill' &&
includes(['skill', 'check'], prop.skillType) && isSkillCheck(prop) &&
prop.ability prop.ability
){ ){
this.addSkillToAbility(prop, prop.ability) this.addSkillToAbility(prop, prop.ability)
@@ -114,7 +114,7 @@ function isAbility(prop){
} }
function isSkillCheck(prop){ function isSkillCheck(prop){
return includes(['skill', 'check'], prop.skillType); return includes(['skill', 'check', 'save', 'utility'], prop.skillType);
} }
function isSkillOperation(prop){ function isSkillOperation(prop){
@@ -146,6 +146,9 @@ const propDetailsByType = {
computed: false, computed: false,
}; };
}, },
proficiency(){
return {};
},
damageMultiplier(){ damageMultiplier(){
return {}; return {};
}, },

View File

@@ -34,8 +34,9 @@ function combineSkill(stat, aggregator, memo){
stat.abilityMod = ability.modifier; stat.abilityMod = ability.modifier;
} }
// Combine all the child proficiencies // Combine all the child proficiencies
for (let i in stat.proficiencies){ stat.proficiency = stat.baseProficiency || 0;
let prof = stat.proficiencies[i]; for (let i in stat.computationDetails.proficiencies){
let prof = stat.computationDetails.proficiencies[i];
if (prof.value > stat.proficiency) stat.proficiency = prof.value; if (prof.value > stat.proficiency) stat.proficiency = prof.value;
} }
// Get the character's proficiency bonus to apply // Get the character's proficiency bonus to apply

View File

@@ -1,5 +1,5 @@
import Creatures from "/imports/api/creature/Creatures.js"; import Creatures from '/imports/api/creature/Creatures.js';
import CreatureProperties from "/imports/api/creature/CreatureProperties.js"; import CreatureProperties from '/imports/api/creature/CreatureProperties.js';
export default function getCalculationProperties(creatureId){ export default function getCalculationProperties(creatureId){
// First get ids of disabled properties and unequiped items // First get ids of disabled properties and unequiped items
@@ -29,6 +29,7 @@ export default function getCalculationProperties(creatureId){
$eq: creatureId, $eq: creatureId,
$nin: disabledAncestorIds, $nin: disabledAncestorIds,
}, },
removed: {$ne: true},
type: {$in: [ type: {$in: [
'attribute', 'attribute',
'skill', 'skill',

View File

@@ -22,6 +22,8 @@ export default function writeAlteredProperties(memo){
case 'effect': case 'effect':
schema = ComputedOnlyEffectSchema; schema = ComputedOnlyEffectSchema;
break; break;
default:
return;
} }
let op = undefined; let op = undefined;
// Loop through all keys that can be changed by computation // Loop through all keys that can be changed by computation

View File

@@ -20,6 +20,7 @@
<proficiency-select <proficiency-select
label="Proficiency" label="Proficiency"
style="flex-basis: 300px;" style="flex-basis: 300px;"
:clearable="false"
:value="model.value" :value="model.value"
@change="(value, ack) => $emit('change', {path: ['value'], value, ack})" @change="(value, ack) => $emit('change', {path: ['value'], value, ack})"
/> />
@@ -35,10 +36,18 @@
ProficiencySelect, ProficiencySelect,
}, },
props: { props: {
model: { model: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
errors: {
type: Object,
default: () => ({}),
},
debounceTime: {
type: Number,
default: undefined,
},
stats: { stats: {
type: Array, type: Array,
default: () => [], default: () => [],

View File

@@ -1,7 +1,7 @@
<template lang="html"> <template lang="html">
<smart-select <smart-select
append-icon="arrow_drop_down" append-icon="arrow_drop_down"
clearable :clearable="clearable"
class="ml-3" class="ml-3"
v-bind="$attrs" v-bind="$attrs"
:menu-props="{transition: 'slide-y-transition', lazy: true}" :menu-props="{transition: 'slide-y-transition', lazy: true}"
@@ -38,6 +38,10 @@
value: { value: {
type: Number, type: Number,
default: undefined, default: undefined,
},
clearable: {
type: Boolean,
default: true,
}, },
}, },
data(){ return { data(){ return {