Fix crafted powder application formula (again)
This commit is contained in:
parent
4780e6cd2c
commit
ce6ab17c32
2 changed files with 14 additions and 13 deletions
25
craft.js
25
craft.js
|
@ -211,18 +211,19 @@ class Craft{
|
|||
powders.push(ingred.get("pid"));
|
||||
}
|
||||
}
|
||||
for (const p of powders) {
|
||||
/* Powders as ingredients in crafted weapons are different than powders applied to non-crafted weapons. Thanks to nbcss for showing me the math.
|
||||
*/
|
||||
let powder = powderStats[p]; //use min, max, and convert
|
||||
let element = Math.floor((p+0.01)/6); //[0,4], the +0.01 attempts to prevent division error
|
||||
let diffLow = Math.floor(nDamBaseLow * powder.convert/100);
|
||||
nDamBaseLow -= diffLow;
|
||||
elemDamBaseLow[element] += diffLow + Math.floor( (powder.min + powder.max) / 2 );
|
||||
let diffHigh = Math.floor(nDamBaseHigh * powder.convert/100);
|
||||
nDamBaseHigh -= diffHigh;
|
||||
elemDamBaseHigh[element] += diffHigh + Math.floor( (powder.min + powder.max) / 2 );
|
||||
}
|
||||
// for (const p of powders) {
|
||||
// /* Powders as ingredients in crafted weapons are different than powders applied to non-crafted weapons. Thanks to nbcss for showing me the math.
|
||||
// */
|
||||
// let powder = powderStats[p]; //use min, max, and convert
|
||||
// let element = Math.floor((p+0.01)/6); //[0,4], the +0.01 attempts to prevent division error
|
||||
// let diffLow = Math.floor(nDamBaseLow * powder.convert/100);
|
||||
// nDamBaseLow -= diffLow;
|
||||
// elemDamBaseLow[element] += diffLow + Math.floor( (powder.min + powder.max) / 2 );
|
||||
// let diffHigh = Math.floor(nDamBaseHigh * powder.convert/100);
|
||||
// nDamBaseHigh -= diffHigh;
|
||||
// elemDamBaseHigh[element] += diffHigh + Math.floor( (powder.min + powder.max) / 2 );
|
||||
// }
|
||||
statMap.set("ingredPowders", powders);
|
||||
|
||||
/* I create a separate variable for each low damage range because we need one damage range to calculate damage with, and it's custom to use the maximum range of the range range.
|
||||
*/
|
||||
|
|
|
@ -40,7 +40,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
|||
//1st round - apply each as ingred, 2nd round - apply as normal
|
||||
if (weapon.get("tier") === "Crafted") {
|
||||
let damageBases = buildStats.get("damageBases").slice();
|
||||
for (const p of powders) {
|
||||
for (const p of powders.concat(weapon.get("ingredPowders"))) {
|
||||
let powder = powderStats[p]; //use min, max, and convert
|
||||
let element = Math.floor((p+0.01)/6); //[0,4], the +0.01 attempts to prevent division error
|
||||
let diff = Math.floor(damageBases[0] * powder.convert/100);
|
||||
|
|
Loading…
Reference in a new issue