Tested and fixed skill compuations
This commit is contained in:
@@ -37,7 +37,7 @@ export default function computeVariableAsSkill(computation, node, prop){
|
||||
prop.hide = statBase === undefined &&
|
||||
prop.proficiency == 0 ||
|
||||
undefined;
|
||||
prop.value = statBase;
|
||||
prop.value = (statBase || 0) + prop.abilityMod + profBonus;
|
||||
return;
|
||||
}
|
||||
// Combine aggregator
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
import { buildComputationFromProps } from '/imports/api/creature/computation/newEngine/buildCreatureComputation.js';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
|
||||
export default function(){
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const prop = id => computation.propsById[id];
|
||||
|
||||
assert.equal(prop('atheleticsId').proficiency, 2, 'Inherits proficiency from ability');
|
||||
assert.equal(prop('atheleticsId').value, 7, 'calculates value correctly');
|
||||
assert.equal(prop('atheleticsId').advantage, 1, 'Inherits advantage from ability');
|
||||
assert.equal(prop('strengthSaveId').advantage, undefined, 'Saves don\'t inherit effects');
|
||||
assert.equal(prop('strengthSaveId').value, 4, 'Saves calculate correctly');
|
||||
|
||||
assert.equal(prop('acrobaticsId').value, 1);
|
||||
assert.equal(prop('toolsId').value, 7);
|
||||
}
|
||||
|
||||
var testProperties = [
|
||||
clean({
|
||||
_id: 'strengthId',
|
||||
variableName: 'strength',
|
||||
type: 'attribute',
|
||||
attributeType: 'ability',
|
||||
baseValue: {
|
||||
calculation: '12'
|
||||
},
|
||||
}),
|
||||
clean({
|
||||
_id: 'profBonusId',
|
||||
variableName: 'proficiencyBonus',
|
||||
type: 'attribute',
|
||||
attributeType: 'modifier',
|
||||
baseValue: {
|
||||
calculation: '3'
|
||||
},
|
||||
}),
|
||||
clean({
|
||||
_id: 'atheleticsId',
|
||||
variableName: 'athletics',
|
||||
type: 'skill',
|
||||
skillType: 'skill',
|
||||
ability: 'strength',
|
||||
}),
|
||||
clean({
|
||||
_id: 'acrobaticsId',
|
||||
variableName: 'acrobatics',
|
||||
type: 'skill',
|
||||
skillType: 'skill',
|
||||
baseProficiency: 0.49,
|
||||
}),
|
||||
clean({
|
||||
_id: 'toolsId',
|
||||
variableName: 'tools',
|
||||
type: 'skill',
|
||||
skillType: 'tool',
|
||||
baseProficiency: 0.5,
|
||||
baseValue: {
|
||||
calculation: '5',
|
||||
}
|
||||
}),
|
||||
clean({
|
||||
_id: 'strengthAdvantageId',
|
||||
type: 'effect',
|
||||
operation: 'advantage',
|
||||
stats: ['strength'],
|
||||
}),
|
||||
clean({
|
||||
_id: 'strengthProficiencyId',
|
||||
type: 'proficiency',
|
||||
value: 2,
|
||||
stats: ['strength'],
|
||||
}),
|
||||
clean({
|
||||
_id: 'strengthSaveId',
|
||||
variableName: 'strengthSave',
|
||||
type: 'skill',
|
||||
skillType: 'save',
|
||||
ability: 'strength',
|
||||
baseProficiency: 1,
|
||||
}),
|
||||
];
|
||||
@@ -5,6 +5,7 @@ import computeConstants from './computeConstants.testFn.js';
|
||||
import computeInventory from './computeInventory.testFn.js';
|
||||
import computeDamageMultipliers from './computeDamageMultipliers.testFn.js';
|
||||
import computeEffects from './computeEffects.testFn.js';
|
||||
import computeSkills from './computeSkills.testFn.js';
|
||||
|
||||
export default [{
|
||||
text: 'Computes actions',
|
||||
@@ -27,4 +28,7 @@ export default [{
|
||||
},{
|
||||
text: 'Computes effects',
|
||||
fn: computeEffects,
|
||||
},{
|
||||
text: 'Computes skills',
|
||||
fn: computeSkills,
|
||||
}];
|
||||
|
||||
@@ -26,7 +26,7 @@ let AttributeSchema = createPropertySchema({
|
||||
allowedValues: [
|
||||
'ability', //Strength, Dex, Con, etc.
|
||||
'stat', // Speed, Armor Class
|
||||
'modifier', // Proficiency Bonus, Initiative
|
||||
'modifier', // Proficiency Bonus, displayed as +x
|
||||
'hitDice', // d12 hit dice
|
||||
'healthBar', // Hitpoints, Temporary Hitpoints, can take damage
|
||||
'bar', // Displayed as a health bar, can't take damage
|
||||
|
||||
Reference in New Issue
Block a user