Adjustments for error handling

This commit is contained in:
Blade Barringer
2015-07-18 08:18:31 -05:00
parent 6d5b57d139
commit 163b0545e8
2 changed files with 36 additions and 8 deletions
+13 -8
View File
@@ -23,22 +23,27 @@ function equipmentStatBonus(stat, equipped) {
_(equipmentTypes).each(function(type) {
var equippedItem = equipped[type]
var equipmentStat = gear[equippedItem][stat];
if(gear[equippedItem]) {
var equipmentStat = gear[equippedItem][stat];
total += equipmentStat;
total += equipmentStat;
}
});
return total;
}
function classBonus(user, stat) {
var bonus = user._statsComputed[stat]
- user.stats.buffs[stat]
- levelBonus(user.stats.lvl)
- equipmentStatBonus(stat, user.items.gear.equipped)
- user.stats[stat]
var computedStats = user._statsComputed;
if(computedStats) {
var bonus = computedStats[stat]
- user.stats.buffs[stat]
- levelBonus(user.stats.lvl)
- equipmentStatBonus(stat, user.items.gear.equipped)
- user.stats[stat]
return bonus;
return bonus;
}
}
module.exports = {