Merge feature-nested-sets into develop
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
|
||||
@@ -33,7 +33,6 @@ var testProperties = [
|
||||
clean({
|
||||
_id: 'actionId',
|
||||
type: 'action',
|
||||
ancestors: [{id: 'charId'}],
|
||||
summary: {
|
||||
text: 'test summary {1 + 2} without referencing anything {3 + 4}',
|
||||
},
|
||||
@@ -61,14 +60,17 @@ var testProperties = [
|
||||
calculation: 'nonExistantProperty + 7',
|
||||
},
|
||||
usesUsed: 5,
|
||||
left: 1,
|
||||
right: 2,
|
||||
}),
|
||||
clean({
|
||||
_id: 'rolledDescriptionId',
|
||||
type: 'action',
|
||||
ancestors: [{id: 'charId'}],
|
||||
summary: {
|
||||
text: 'test roll gets compiled {4 + (2 + 2)} properly',
|
||||
},
|
||||
left: 3,
|
||||
right: 4,
|
||||
}),
|
||||
clean({
|
||||
_id: 'numItemsConumedId',
|
||||
@@ -77,6 +79,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '3',
|
||||
},
|
||||
left: 5,
|
||||
right: 6,
|
||||
}),
|
||||
clean({
|
||||
_id: 'numResourceConumedId',
|
||||
@@ -85,6 +89,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '4',
|
||||
},
|
||||
left: 7,
|
||||
right: 8,
|
||||
}),
|
||||
clean({
|
||||
_id: 'resourceVarId',
|
||||
@@ -94,6 +100,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '9',
|
||||
},
|
||||
left: 9,
|
||||
right: 10,
|
||||
}),
|
||||
clean({
|
||||
_id: 'inlineRefResourceId',
|
||||
@@ -102,6 +110,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '1 + 5',
|
||||
},
|
||||
left: 11,
|
||||
right: 12,
|
||||
}),
|
||||
clean({
|
||||
_id: 'arrowId',
|
||||
@@ -110,5 +120,7 @@ var testProperties = [
|
||||
quantity: 27,
|
||||
icon: 'itemIcon',
|
||||
color: 'itemColor',
|
||||
left: 13,
|
||||
right: 14,
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
@@ -27,6 +27,8 @@ var testProperties = [
|
||||
_id: 'emptyId',
|
||||
type: 'attribute',
|
||||
attributeType: 'ability',
|
||||
left: 1,
|
||||
right: 2,
|
||||
}),
|
||||
clean({
|
||||
_id: 'noVariableNameId',
|
||||
@@ -35,6 +37,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '8'
|
||||
},
|
||||
left: 3,
|
||||
right: 4,
|
||||
}),
|
||||
clean({
|
||||
_id: 'strengthId',
|
||||
@@ -44,6 +48,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '12'
|
||||
},
|
||||
left: 5,
|
||||
right: 6,
|
||||
}),
|
||||
clean({
|
||||
_id: 'overriddenDexId',
|
||||
@@ -54,6 +60,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '15'
|
||||
},
|
||||
left: 7,
|
||||
right: 8,
|
||||
}),
|
||||
clean({
|
||||
_id: 'dexterityId',
|
||||
@@ -64,6 +72,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '15'
|
||||
},
|
||||
left: 9,
|
||||
right: 10,
|
||||
}),
|
||||
clean({
|
||||
_id: 'constitutionId',
|
||||
@@ -73,6 +83,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '21'
|
||||
},
|
||||
left: 11,
|
||||
right: 12,
|
||||
}),
|
||||
clean({
|
||||
_id: 'referencesDexId',
|
||||
@@ -81,6 +93,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: 'dexterity.modifier + 2'
|
||||
},
|
||||
left: 13,
|
||||
right: 14,
|
||||
}),
|
||||
clean({
|
||||
_id: 'hitDiceId',
|
||||
@@ -91,6 +105,8 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '4'
|
||||
},
|
||||
left: 15,
|
||||
right: 16,
|
||||
}),
|
||||
clean({
|
||||
_id: 'parseErrorId',
|
||||
@@ -100,5 +116,7 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: '12 +'
|
||||
},
|
||||
left: 17,
|
||||
right: 18,
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
import { applyNestedSetProperties } from '/imports/api/parenting/parentingFunctions';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const scope = id => computation.scope[id];
|
||||
@@ -20,41 +21,37 @@ var testProperties = [
|
||||
type: 'class',
|
||||
variableName: 'wizard',
|
||||
classType: 'startingClass',
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
clean({
|
||||
_id: 'rangerId',
|
||||
type: 'class',
|
||||
variableName: 'ranger',
|
||||
classType: 'multiClass',
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
clean({
|
||||
_id: 'wiz1Id',
|
||||
type: 'classLevel',
|
||||
variableName: 'wizard',
|
||||
level: 1,
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
clean({
|
||||
_id: 'wiz2Id',
|
||||
type: 'classLevel',
|
||||
variableName: 'wizard',
|
||||
level: 2,
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
clean({
|
||||
_id: 'wiz4Id',
|
||||
type: 'classLevel',
|
||||
variableName: 'wizard',
|
||||
level: 4,
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
clean({
|
||||
_id: 'rang1Id',
|
||||
type: 'classLevel',
|
||||
variableName: 'ranger',
|
||||
level: 1,
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
];
|
||||
|
||||
applyNestedSetProperties(testProperties);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
import { applyNestedSetProperties } from '/imports/api/parenting/parentingFunctions';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const prop = id => computation.propsById[id];
|
||||
@@ -23,6 +24,7 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: 'arrayConstant[3]',
|
||||
},
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
];
|
||||
|
||||
applyNestedSetProperties(testProperties);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const scope = id => computation.scope[id];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import { propsFromForest } from '/imports/api/properties/tests/propTestBuilder.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
import { applyNestedSetProperties, compareOrder } from '/imports/api/parenting/parentingFunctions';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const prop = id => computation.propsById[id];
|
||||
@@ -13,9 +14,8 @@ export default function(){
|
||||
assert.equal(scope('valueEquipment'), 3);
|
||||
|
||||
assert.equal(scope('itemsAttuned'), 1);
|
||||
|
||||
assert.equal(prop('childContainerId').carriedWeight, 69);
|
||||
assert.equal(prop('childContainerId').contentsWeight, 69);
|
||||
assert.equal(prop('childContainerId').carriedWeight, 69, 'Calculates container carried weight correctly');
|
||||
assert.equal(prop('childContainerId').contentsWeight, 69, 'Calculates container contents weight correctly');
|
||||
|
||||
assert.equal(scope('weightCarried'), 104);
|
||||
assert.equal(scope('valueCarried'), 129);
|
||||
@@ -32,7 +32,6 @@ var testProperties = [
|
||||
attuned: true,
|
||||
weight: 2,
|
||||
value: 3,
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
clean({
|
||||
_id: 'containerId',
|
||||
@@ -40,22 +39,13 @@ var testProperties = [
|
||||
carried: true,
|
||||
weight: 5,
|
||||
value: 7,
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
clean({
|
||||
_id: 'childContainerId',
|
||||
type: 'container',
|
||||
carried: true,
|
||||
weight: 11,
|
||||
value: 13,
|
||||
ancestors: [{id: 'charId'}, {id: 'containerId'}],
|
||||
}),
|
||||
clean({
|
||||
_id: 'childItemId',
|
||||
type: 'item',
|
||||
weight: 17,
|
||||
value: 19,
|
||||
ancestors: [{id: 'charId'}, {id: 'containerId'}],
|
||||
parentId: 'containerId',
|
||||
}),
|
||||
clean({
|
||||
_id: 'grandchildItemId',
|
||||
@@ -63,6 +53,16 @@ var testProperties = [
|
||||
weight: 23, // 69 total
|
||||
value: 29, // 87 total
|
||||
quantity: 3,
|
||||
ancestors: [{id: 'charId'}, {id: 'containerId'}, {id: 'childContainerId'}],
|
||||
parentId: 'childContainerId',
|
||||
}),
|
||||
clean({
|
||||
_id: 'childContainerId',
|
||||
type: 'container',
|
||||
carried: true,
|
||||
weight: 11,
|
||||
value: 13,
|
||||
parentId: 'containerId',
|
||||
}),
|
||||
];
|
||||
applyNestedSetProperties(testProperties);
|
||||
testProperties.sort(compareOrder);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
import { applyNestedSetProperties, compareOrder } from '/imports/api/parenting/parentingFunctions';
|
||||
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
const hasLink = computation.dependencyGraph.hasLink;
|
||||
computeCreatureComputation(computation);
|
||||
const prop = id => computation.propsById[id];
|
||||
assert.equal(
|
||||
@@ -38,7 +40,6 @@ var testProperties = [
|
||||
clean({
|
||||
_id: 'actionId',
|
||||
type: 'action',
|
||||
ancestors: [{ id: 'charId' }],
|
||||
attackRoll: {
|
||||
calculation: 'strength.modifier',
|
||||
},
|
||||
@@ -48,7 +49,6 @@ var testProperties = [
|
||||
_id: 'profBonusId',
|
||||
type: 'attribute',
|
||||
variableName: 'proficiencyBonus',
|
||||
ancestors: [{ id: 'charId' }],
|
||||
baseValue: {
|
||||
calculation: '13'
|
||||
},
|
||||
@@ -62,3 +62,5 @@ var testProperties = [
|
||||
targetTags: ['martial weapon']
|
||||
}),
|
||||
];
|
||||
applyNestedSetProperties(testProperties);
|
||||
testProperties.sort(compareOrder);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const prop = id => computation.propsById[id];
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import computeAction from './computeAction.testFn.js';
|
||||
import computeAttribute from './computeAttribute.testFn.js';
|
||||
import computeCalculations from './computeCalculations.testFn.js';
|
||||
import computeClasses from './computeClasses.testFn.js';
|
||||
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';
|
||||
import computePointBuys from './computePointBuys.testFn.js';
|
||||
import computeProficiencies from './computeProficiencies.testFn.js';
|
||||
import computeAction from './computeAction.testFn';
|
||||
import computeAttribute from './computeAttribute.testFn';
|
||||
import computeClasses from './computeClasses.testFn';
|
||||
import computeConstants from './computeConstants.testFn';
|
||||
import computeInventory from './computeInventory.testFn';
|
||||
import computeDamageMultipliers from './computeDamageMultipliers.testFn';
|
||||
import computeEffects from './computeEffects.testFn';
|
||||
import computeSkills from './computeSkills.testFn';
|
||||
import computeProficiencies from './computeProficiencies.testFn';
|
||||
|
||||
export default [{
|
||||
text: 'Computes actions',
|
||||
|
||||
Reference in New Issue
Block a user