Round near fix..

This commit is contained in:
b 2021-03-27 15:09:16 -07:00
parent a9aa37b672
commit 4780e6cd2c

View file

@ -42,7 +42,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
let damageBases = buildStats.get("damageBases").slice(); let damageBases = buildStats.get("damageBases").slice();
for (const p of powders) { for (const p of powders) {
let powder = powderStats[p]; //use min, max, and convert let powder = powderStats[p]; //use min, max, and convert
let element = round_near(p/6); 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); let diff = Math.floor(damageBases[0] * powder.convert/100);
damageBases[0] -= diff; damageBases[0] -= diff;
damageBases[element+1] += diff + Math.floor( (powder.min + powder.max) / 2 ); damageBases[element+1] += diff + Math.floor( (powder.min + powder.max) / 2 );