diff --git a/app/imports/api/creature/computation/ComputationMemo.js b/app/imports/api/creature/computation/ComputationMemo.js index fc5e4dd3..998a2765 100644 --- a/app/imports/api/creature/computation/ComputationMemo.js +++ b/app/imports/api/creature/computation/ComputationMemo.js @@ -63,46 +63,6 @@ export default class ComputationMemo { }); return prop; } - /* - storeHighestClassLevel(name, prop, isBaseClass){ - // Only store the highest level classLevel - let stat = this.statsByVariableName[name] - if (!stat){ - this.statsByVariableName[name] = prop; - if (isBaseClass){ - this.classes[name] = prop; - } - } else if (!has(stat, 'level')){ - // Stat is overriden by an attribute - return; - } else if (stat.level < prop.level) { - this.statsByVariableName[name] = prop; - if (isBaseClass){ - this.classes[name] = prop; - } - } - this.updateLevel(); - } - updateLevel(){ - let currentLevel = this.statsByVariableName['level']; - if (!currentLevel){ - currentLevel = { - value: 0, - computationDetails: { - builtIn: true, - computed: true, - } - }; - this.statsByVariableName['level'] = currentLevel; - } - // bail out if overriden by an attribute - if (!currentLevel.computationDetails.builtIn) return; - let level = 0; - for (let name in this.classes){ - level += this.classes[name].level || 0; - } - this.statsByVariableName['level'].value = level; - }*/ addToggle(prop){ prop = this.registerProperty(prop); this.togglesById[prop._id] = prop; diff --git a/app/imports/api/creature/computation/EffectAggregator.js b/app/imports/api/creature/computation/EffectAggregator.js index a4b2fd16..8f93bbfb 100644 --- a/app/imports/api/creature/computation/EffectAggregator.js +++ b/app/imports/api/creature/computation/EffectAggregator.js @@ -16,6 +16,7 @@ export default class EffectAggregator{ this.disadvantage = 0; this.passiveAdd = 0; this.fail = 0; + this.set = undefined; this.conditional = []; this.rollBonus = []; } @@ -45,6 +46,10 @@ export default class EffectAggregator{ // Take the smallest max value this.max = result < this.max ? result : this.max; break; + case 'set': + // Take the highest set value + this.set = this.set === undefined || result > this.set ? result : this.set; + break; case 'advantage': // Sum number of advantages this.advantage++; diff --git a/app/imports/api/creature/computation/combineStat.js b/app/imports/api/creature/computation/combineStat.js index 9efb0023..03273d56 100644 --- a/app/imports/api/creature/computation/combineStat.js +++ b/app/imports/api/creature/computation/combineStat.js @@ -15,6 +15,7 @@ function combineAttribute(stat, aggregator){ let result = (aggregator.base + aggregator.add) * aggregator.mul; if (result < aggregator.min) result = aggregator.min; if (result > aggregator.max) result = aggregator.max; + if (aggregator.set !== undefined) result = aggregator.set; if (!stat.decimal) result = Math.floor(result); stat.value = result; stat.baseValue = aggregator.statBaseValue; diff --git a/app/imports/api/properties/Effects.js b/app/imports/api/properties/Effects.js index 677b3c2d..d1ed3adc 100644 --- a/app/imports/api/properties/Effects.js +++ b/app/imports/api/properties/Effects.js @@ -18,6 +18,7 @@ let EffectSchema = new SimpleSchema({ 'mul', 'min', 'max', + 'set', 'advantage', 'disadvantage', 'passiveAdd', diff --git a/app/imports/ui/properties/forms/EffectForm.vue b/app/imports/ui/properties/forms/EffectForm.vue index 42124421..2c18c180 100644 --- a/app/imports/ui/properties/forms/EffectForm.vue +++ b/app/imports/ui/properties/forms/EffectForm.vue @@ -78,7 +78,8 @@ {value: 'add', text: 'Add'}, {value: 'mul', text: 'Multiply'}, {value: 'min', text: 'Minimum'}, - {value: 'max', text: 'Maximum'}, + {value: 'max', text: 'Maximum'}, + {value: 'set', text: 'Set'}, {value: 'advantage', text: 'Advantage'}, {value: 'disadvantage', text: 'Disadvantage'}, {value: 'passiveAdd', text: 'Passive Bonus'}, @@ -93,7 +94,8 @@ case 'add': return true; case 'mul': return true; case 'min': return true; - case 'max': return true; + case 'max': return true; + case 'set': return true; case 'advantage': return false; case 'disadvantage': return false; case 'passiveAdd': return true;