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;
if (
prop.type === 'skill' &&
includes(['skill', 'check'], prop.skillType) &&
isSkillCheck(prop) &&
prop.ability
){
this.addSkillToAbility(prop, prop.ability)
@@ -114,7 +114,7 @@ function isAbility(prop){
}
function isSkillCheck(prop){
return includes(['skill', 'check'], prop.skillType);
return includes(['skill', 'check', 'save', 'utility'], prop.skillType);
}
function isSkillOperation(prop){
@@ -146,6 +146,9 @@ const propDetailsByType = {
computed: false,
};
},
proficiency(){
return {};
},
damageMultiplier(){
return {};
},

View File

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

View File

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

View File

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

View File

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

View File

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