Added 'set' operation to effects, it overrides all other numerical effects
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -18,6 +18,7 @@ let EffectSchema = new SimpleSchema({
|
||||
'mul',
|
||||
'min',
|
||||
'max',
|
||||
'set',
|
||||
'advantage',
|
||||
'disadvantage',
|
||||
'passiveAdd',
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user