Added disableRecursiveSpecials option to armorandshields

This commit is contained in:
Russell Champoux committed 2015-03-18 17:19:31 -04:00
1 parent c368663ee6
commit 86304961c3
1 file changed
+5 -1
+5 -1
View File
@@ -669,7 +669,8 @@ var Grimoire = function(config) { // jshint ignore:line
} else if(/GET_ENERGY_RESISTANCE_TYPE/.test(special.name)) {
special.name = special.name.replace(/GET_ENERGY_RESISTANCE_TYPE/, self.getEnergyType(options));
}
} while(options.excludeSpecials.indexOf(special) != -1); //if we get something from our exclusions, try again
} while(_.chain(options.excludeSpecials).map(function(s) { return s.name; }).includes(special.name).value()); //if we get something from our exclusions, try again
specials.push(special);
var roll = chance.d100();
@@ -861,6 +862,7 @@ var Grimoire = function(config) { // jshint ignore:line
options.uniqueType = (options.type == 'armor' ? 'uniqueArmors' :
options.type == 'shield' ? 'uniqueShields' :
chance.pick(['uniqueArmors', 'uniqueShields'])); //50-50 chance if type is not selected
options.disableRecursiveSpecials = options.disableRecursiveSpecials || false;
var sources = options.sources ? options.sources : self.SOURCES;
@@ -1013,6 +1015,7 @@ var Grimoire = function(config) { // jshint ignore:line
item.url = unique.url;
}
else if(action == 'getSpecial') {
if(item.specials.length === 0 || options.disableRecursiveSpecials === false) {
item = self.getArmorOrShield(quality, options);
var specialsBonus = _.chain(item.specials).map(function(s) { return s.bonus; }).sum().value();
@@ -1033,6 +1036,7 @@ var Grimoire = function(config) { // jshint ignore:line
}
}
}
}
var totalBonus = item.bonus + _.sum(_.map(item.specials, function(s) { return s.bonsu; }));