Implement critDamPct, update melee modifiers to what we see ingame, fix bug with 0 dam raw

This commit is contained in:
hppeng 2022-07-12 09:38:28 -07:00
parent 6cb003f9bd
commit 38fa0b0295
4 changed files with 26 additions and 45 deletions

View file

@ -920,18 +920,12 @@ const atrees = {
"cost": 1, "cost": 1,
"display": { "row": 2, "col": 4, "icon": "node_0"}, "display": { "row": 2, "col": 4, "icon": "node_0"},
"properties": {}, "properties": {},
"effects": [ "effects": [{
{ "type": "add_spell_prop",
"type": "raw_stat", "base_spell": 0,
"bonuses": [ "target_part": "Single Shot",
{ "multipliers": [5, 0, 0, 0, 0, 0]
"type": "stat", }]
"name": "mdPct",
"value": 5
}
]
}
]
}, },
{ {
"display_name": "Cheaper Arrow Bomb", "display_name": "Cheaper Arrow Bomb",
@ -2038,18 +2032,12 @@ const atrees = {
"properties": { "properties": {
"melee_range": 1 "melee_range": 1
}, },
"effects": [ "effects": [{
{ "type": "add_spell_prop",
"type": "raw_stat", "base_spell": 0,
"bonuses": [ "target_part": "melee",
{ "multipliers": [5, 0, 0, 0, 0, 0]
"type": "stat", }]
"name": "mdPct",
"value": 5
}
]
}
]
}, },
{ {
@ -2843,18 +2831,12 @@ const atrees = {
"properties": { "properties": {
"melee_range": 1 "melee_range": 1
}, },
"effects": [ "effects": [{
{ "type": "add_spell_prop",
"type": "raw_stat", "base_spell": 0,
"bonuses": [ "target_part": "melee",
{ "multipliers": [5, 0, 0, 0, 0, 0]
"type": "stat", }]
"name": "mdPct",
"value": 5
}
]
}
]
}, },
{ {

File diff suppressed because one or more lines are too long

View file

@ -129,6 +129,7 @@ class Build{
} }
} }
statMap.set("poisonPct", 100); statMap.set("poisonPct", 100);
statMap.set("critDamPct", 100);
// The stuff relevant for damage calculation!!! @ferricles // The stuff relevant for damage calculation!!! @ferricles
statMap.set("atkSpd", this.weapon.statMap.get("atkSpd")); statMap.set("atkSpd", this.weapon.statMap.get("atkSpd"));

View file

@ -151,15 +151,11 @@ function calculateSpellDamage(stats, weapon, _conversions, use_spell_damage, ign
let min_boost = raw_boost; let min_boost = raw_boost;
let max_boost = raw_boost; let max_boost = raw_boost;
if (total_max > 0) { // TODO: what about total negative all raw? if (total_max > 0) { // TODO: what about total negative all raw?
if (total_min > 0) {
min_boost += (damages_obj[0] / total_min) * prop_raw; min_boost += (damages_obj[0] / total_min) * prop_raw;
}
max_boost += (damages_obj[1] / total_max) * prop_raw; max_boost += (damages_obj[1] / total_max) * prop_raw;
} }
if (i != 0 && total_elem_max > 0) { // rainraw TODO above if (i != 0 && total_elem_max > 0) { // rainraw TODO above
if (total_elem_min > 0) {
min_boost += (damages_obj[0] / total_elem_min) * rainbow_raw; min_boost += (damages_obj[0] / total_elem_min) * rainbow_raw;
}
max_boost += (damages_obj[1] / total_elem_max) * rainbow_raw; max_boost += (damages_obj[1] / total_elem_max) * rainbow_raw;
} }
damages_obj[0] += min_boost * total_convert; damages_obj[0] += min_boost * total_convert;
@ -185,12 +181,14 @@ function calculateSpellDamage(stats, weapon, _conversions, use_spell_damage, ign
damage_mult *= (1 + v/100); damage_mult *= (1 + v/100);
} }
const crit_mult = stats.get("critDamPct")/100;
for (const damage of damages) { for (const damage of damages) {
const res = [ const res = [
damage[0] * strBoost * damage_mult, // Normal min damage[0] * strBoost * damage_mult, // Normal min
damage[1] * strBoost * damage_mult, // Normal max damage[1] * strBoost * damage_mult, // Normal max
damage[0] * (strBoost + 1) * damage_mult, // Crit min damage[0] * (strBoost + crit_mult) * damage_mult, // Crit min
damage[1] * (strBoost + 1) * damage_mult, // Crit max damage[1] * (strBoost + crit_mult) * damage_mult, // Crit max
]; ];
damages_results.push(res); damages_results.push(res);
total_dam_norm[0] += res[0]; total_dam_norm[0] += res[0];