@@ -5,7 +5,7 @@ define([ | |||||
) { | ) { | ||||
const percentageStats = [ | const percentageStats = [ | ||||
'addCritChance', | 'addCritChance', | ||||
'addCritemultiplier', | |||||
'addCritMultiplier', | |||||
'addAttackCritChance', | 'addAttackCritChance', | ||||
'addAttackCritMultiplier', | 'addAttackCritMultiplier', | ||||
'addSpellCritChance', | 'addSpellCritChance', | ||||
@@ -4,9 +4,9 @@ const max = Math.max.bind(Math); | |||||
//Helpers | //Helpers | ||||
const scaleStatType = (config, result) => { | const scaleStatType = (config, result) => { | ||||
const { statType, statMult = 1, srcValues } = config; | |||||
const { statType, statMult = 1, srcValues, scaleConfig } = config; | |||||
if (!statType) | |||||
if (!statType || scaleConfig?.statMult === false) | |||||
return; | return; | ||||
let statValue = 0; | let statValue = 0; | ||||
@@ -24,7 +24,10 @@ const scaleStatType = (config, result) => { | |||||
result.amount *= statValue * statMult; | result.amount *= statValue * statMult; | ||||
}; | }; | ||||
const scalePercentMultipliers = ({ isAttack, elementName, srcValues }, result) => { | |||||
const scalePercentMultipliers = ({ isAttack, elementName, srcValues, scaleConfig }, result) => { | |||||
if (scaleConfig?.percentMult === false) | |||||
return; | |||||
const { dmgPercent = 0, physicalPercent = 0, spellPercent = 0 } = srcValues; | const { dmgPercent = 0, physicalPercent = 0, spellPercent = 0 } = srcValues; | ||||
let totalPercent = 100 + dmgPercent; | let totalPercent = 100 + dmgPercent; | ||||
@@ -40,8 +43,8 @@ const scalePercentMultipliers = ({ isAttack, elementName, srcValues }, result) = | |||||
result.amount *= (totalPercent / 100); | result.amount *= (totalPercent / 100); | ||||
}; | }; | ||||
const scaleCrit = ({ noCrit, isAttack, crit: forceCrit, srcValues }, result) => { | |||||
if (noCrit) | |||||
const scaleCrit = ({ noCrit, isAttack, crit: forceCrit, srcValues, scaleConfig }, result) => { | |||||
if (noCrit || scaleConfig?.critMult === false) | |||||
return; | return; | ||||
const { critChance, attackCritChance, spellCritChance } = srcValues; | const { critChance, attackCritChance, spellCritChance } = srcValues; | ||||
@@ -292,7 +292,8 @@ module.exports = { | |||||
isAttack: this.isAttack, | isAttack: this.isAttack, | ||||
noScale: this.noScale, | noScale: this.noScale, | ||||
noMitigate: noMitigate, | noMitigate: noMitigate, | ||||
spell: this | |||||
spell: this, | |||||
scaleConfig: this.scaleConfig | |||||
}; | }; | ||||
if (this.obj.mob) | if (this.obj.mob) | ||||
@@ -75,6 +75,14 @@ module.exports = { | |||||
if (blueprint.isSpell) | if (blueprint.isSpell) | ||||
isSpell = true; | isSpell = true; | ||||
const beforeGenerateItemEvent = { | |||||
blueprint, | |||||
item: null | |||||
}; | |||||
global.instancer.instances[0].eventEmitter.emit('beforeGenerateItem', beforeGenerateItemEvent); | |||||
if (beforeGenerateItemEvent.item) | |||||
return beforeGenerateItemEvent.item; | |||||
if (isSpell) | if (isSpell) | ||||
spellGenerators.forEach(g => g.generate(item, blueprint)); | spellGenerators.forEach(g => g.generate(item, blueprint)); | ||||
else if (isCurrency) | else if (isCurrency) | ||||
@@ -73,32 +73,19 @@ const buildCpnInventory = (mob, blueprint, { drops }, preferStat) => { | |||||
cpnInventory.inventorySize = -1; | cpnInventory.inventorySize = -1; | ||||
cpnInventory.dailyDrops = blueprint.dailyDrops; | cpnInventory.dailyDrops = blueprint.dailyDrops; | ||||
if (!drops?.blueprints || drops?.alsoRandom) { | |||||
generateSlots.forEach(slot => { | |||||
const item = itemGenerator.generate({ | |||||
noSpell: true, | |||||
level, | |||||
slot, | |||||
quality: 4, | |||||
forceStats: [preferStat] | |||||
}); | |||||
delete item.spell; | |||||
item.eq = true; | |||||
cpnInventory.getItem(item); | |||||
generateSlots.forEach(slot => { | |||||
const item = itemGenerator.generate({ | |||||
noSpell: true, | |||||
level, | |||||
slot, | |||||
quality: 4, | |||||
forceStats: [preferStat] | |||||
}); | }); | ||||
} else { | |||||
//TODO: Don't give mobs these items: they'll drop them anyway | |||||
drops.blueprints.forEach(d => { | |||||
if (d.type === 'key') | |||||
return; | |||||
const drop = extend({}, d); | |||||
drop.level = level; | |||||
delete item.spell; | |||||
item.eq = true; | |||||
cpnInventory.getItem(itemGenerator.generate(drop)); | |||||
}); | |||||
} | |||||
cpnInventory.getItem(item); | |||||
}); | |||||
}; | }; | ||||
const buildCpnSpells = (mob, blueprint, typeDefinition, preferStat) => { | const buildCpnSpells = (mob, blueprint, typeDefinition, preferStat) => { | ||||