fixed: props all have slotQuantityFilled now

This commit is contained in:
Stefan Zermatten
2023-04-14 12:02:46 +02:00
parent b914415ef0
commit 32e5b0a9f6
2 changed files with 11 additions and 5 deletions

View File

@@ -46,6 +46,12 @@ let CreaturePropertySchema = new SimpleSchema({
regEx: SimpleSchema.RegEx.Id, regEx: SimpleSchema.RegEx.Id,
optional: true, optional: true,
}, },
// Fill more than one quantity in a slot, like feats and ability score
// improvements, filtered out of UI if there isn't space in quantityExpected
slotQuantityFilled: {
type: SimpleSchema.Integer,
optional: true, // Undefined implies 1
},
}); });
const DenormalisedOnlyCreaturePropertySchema = new SimpleSchema({ const DenormalisedOnlyCreaturePropertySchema = new SimpleSchema({

View File

@@ -2,7 +2,7 @@ import { buildComputationFromProps } from '/imports/api/engine/computation/build
import { assert } from 'chai'; import { assert } from 'chai';
import clean from '../../utility/cleanProp.testFn.js'; import clean from '../../utility/cleanProp.testFn.js';
export default function(){ export default function () {
const computation = buildComputationFromProps(testProperties); const computation = buildComputationFromProps(testProperties);
const totalFilled = computation.propsById['slotId'].totalFilled; const totalFilled = computation.propsById['slotId'].totalFilled;
assert.equal(totalFilled, 4); assert.equal(totalFilled, 4);
@@ -13,7 +13,7 @@ var testProperties = [
clean({ clean({
_id: 'slotId', _id: 'slotId',
type: 'propertySlot', type: 'propertySlot',
ancestors: [{id: 'charId'}], ancestors: [{ id: 'charId' }],
}), }),
// Children // Children
clean({ clean({
@@ -21,16 +21,16 @@ var testProperties = [
type: 'slotFiller', type: 'slotFiller',
slotQuantityFilled: 3, slotQuantityFilled: 3,
slotFillerType: 'item', slotFillerType: 'item',
ancestors: [{id: 'charId'}, {id: 'slotId'}], ancestors: [{ id: 'charId' }, { id: 'slotId' }],
}), }),
clean({ clean({
_id: 'slotChildId', _id: 'slotChildId',
type: 'item', type: 'item',
ancestors: [{id: 'charId'}, {id: 'slotId'}], ancestors: [{ id: 'charId' }, { id: 'slotId' }],
}), }),
clean({ clean({
_id: 'slotGrandchildId', _id: 'slotGrandchildId',
type: 'effect', type: 'effect',
ancestors: [{id: 'charId'}, {id: 'slotId'}, {id: 'slotChildId'}], ancestors: [{ id: 'charId' }, { id: 'slotId' }, { id: 'slotChildId' }],
}), }),
]; ];