HOTFIX: Raw and % happen in the "same step" now (both based on pre-boost damage)

This commit is contained in:
hppeng 2022-08-10 17:48:41 -07:00
parent 0b56bdbef2
commit 755def77f3

View file

@ -126,15 +126,18 @@ function calculateSpellDamage(stats, weapon, _conversions, use_spell_damage, ign
// These do not count raw damage. I think. Easy enough to change
let total_min = 0;
let total_max = 0;
let save_prop = [];
for (let i in damage_elements) {
save_prop.push(damages[i].slice());
total_min += damages[i][0];
total_max += damages[i][1];
let damage_specific = damage_elements[i] + specific_boost_str + 'Pct';
let damageBoost = 1 + skill_boost[i] + static_boost
+ ((stats.get(damage_specific) + stats.get(damage_elements[i]+'DamPct')) /100);
damages[i][0] *= Math.max(damageBoost, 0);
damages[i][1] *= Math.max(damageBoost, 0);
// Collect total damage post %boost
total_min += damages[i][0];
total_max += damages[i][1];
}
let total_elem_min = total_min - damages[0][0];
@ -144,6 +147,7 @@ function calculateSpellDamage(stats, weapon, _conversions, use_spell_damage, ign
let prop_raw = stats.get(specific_boost_str.toLowerCase()+'Raw') + stats.get('damRaw');
let rainbow_raw = stats.get('r'+specific_boost_str+'Raw') + stats.get('rDamRaw');
for (let i in damages) {
let save_obj = save_prop[i];
let damages_obj = damages[i];
let damage_prefix = damage_elements[i] + specific_boost_str;
// Normie raw
@ -157,22 +161,22 @@ function calculateSpellDamage(stats, weapon, _conversions, use_spell_damage, ign
if (total_max > 0) { // TODO: what about total negative all raw?
// TODO: compute actual chance of 0 damage. For now we just copy max ratio
if (total_min === 0) {
min_boost += (damages_obj[1] / total_max) * prop_raw;
min_boost += (save_obj[1] / total_max) * prop_raw;
}
else {
min_boost += (damages_obj[0] / total_min) * prop_raw;
min_boost += (save_obj[0] / total_min) * prop_raw;
}
max_boost += (damages_obj[1] / total_max) * prop_raw;
max_boost += (save_obj[1] / total_max) * prop_raw;
}
if (i != 0 && total_elem_max > 0) { // rainraw TODO above
// TODO: compute actual chance of 0 damage. For now we just copy max ratio
if (total_elem_min === 0) {
min_boost += (damages_obj[1] / total_elem_max) * rainbow_raw;
min_boost += (save_obj[1] / total_elem_max) * rainbow_raw;
}
else {
min_boost += (damages_obj[0] / total_elem_min) * rainbow_raw;
min_boost += (save_obj[0] / total_elem_min) * rainbow_raw;
}
max_boost += (damages_obj[1] / total_elem_max) * rainbow_raw;
max_boost += (save_obj[1] / total_elem_max) * rainbow_raw;
}
damages_obj[0] += min_boost * total_convert;
damages_obj[1] += max_boost * total_convert;