diff --git a/app/imports/api/properties/ClassLevels.js b/app/imports/api/properties/ClassLevels.js index 97295080..ed1c41e7 100644 --- a/app/imports/api/properties/ClassLevels.js +++ b/app/imports/api/properties/ClassLevels.js @@ -23,6 +23,11 @@ let ClassLevelSchema = new SimpleSchema({ 'nextLevelTags.$': { type: String, }, + // Same as in SlotFillers.js + slotFillerCondition: { + type: String, + optional: true, + }, }); export { ClassLevelSchema }; diff --git a/app/imports/ui/creature/slots/SlotFillDialog.vue b/app/imports/ui/creature/slots/SlotFillDialog.vue index 1276774d..57cc3c1d 100644 --- a/app/imports/ui/creature/slots/SlotFillDialog.vue +++ b/app/imports/ui/creature/slots/SlotFillDialog.vue @@ -179,17 +179,18 @@ export default { // Filter out slotFillers whose condition isn't met or are too big to fit // the quantity to fill nodes = nodes.filter(node => { - if (node.type === 'slotFiller'){ - if (node.slotFillerCondition){ - let context = new CompilationContext(); - let conditionResult = parse(node.slotFillerCondition) - .reduce(this.creature.variables, context); - if (conditionResult && !conditionResult.value) return false; - } - console.log({numToFill: this.numToFill, node}); - if (this.numToFill > 0 && node.slotQuantityFilled > this.numToFill){ - return false; - } + if (node.slotFillerCondition){ + let context = new CompilationContext(); + let conditionResult = parse(node.slotFillerCondition) + .reduce(this.creature.variables, context); + if (conditionResult && !conditionResult.value) return false; + } + if ( + node.type === 'slotFiller' && + this.numToFill > 0 && + node.slotQuantityFilled > this.numToFill + ){ + return false; } return true; }); diff --git a/app/imports/ui/properties/forms/ClassLevelForm.vue b/app/imports/ui/properties/forms/ClassLevelForm.vue index 160bb5ea..9b48318a 100644 --- a/app/imports/ui/properties/forms/ClassLevelForm.vue +++ b/app/imports/ui/properties/forms/ClassLevelForm.vue @@ -27,6 +27,14 @@ @change="change('variableName', ...arguments)" /> +