Fix multihit

This commit is contained in:
b 2021-01-09 03:35:18 -06:00
parent 0542acab49
commit 0dabe9b1fa
3 changed files with 22 additions and 8 deletions

View file

@ -142,9 +142,9 @@ const spell_table = {
{ subtitle: "No Damage", type: "none" }
] },
{ title: "Multihit", cost: 8, parts: [
{ subtitle: "Total Damage", type: "damage", multiplier: 380, conversion: [60, 25, 0, 0, 15, 0] },
{ subtitle: "1st to 10th Hit", type: "damage", multiplier: 28, conversion: [60, 25, 0, 0, 15, 0] },
{ subtitle: "Fatality", type: "damage", multiplier: 100, conversion: [20, 0, 30, 50, 0, 0] },
{ subtitle: "1st to 10th Hit", type: "damage", multiplier: 27, conversion: [100, 0, 0, 0, 0, 0] },
{ subtitle: "Fatality", type: "damage", multiplier: 120, conversion: [20, 0, 30, 50, 0, 0] },
{ subtitle: "Total Damage", type: "total", factors: [10, 1] },
] },
{ title: "Smoke Bomb", cost: 8, parts: [
{ subtitle: "Tick Damage", type: "damage", multiplier: 60, conversion: [45, 25, 0, 0, 0, 30] },

View file

@ -261,6 +261,8 @@ function displaySpellDamage(parent_elem, build, spell, spellIdx) {
parent_elem.append(title_elem);
let critChance = skillPointsToPercentage(build.total_skillpoints[1]);
let save_damages = [];
for (const part of spell.parts) {
parent_elem.append(document.createElement("br"));
let part_div = document.createElement("p");
@ -284,11 +286,12 @@ function displaySpellDamage(parent_elem, build, spell, spellIdx) {
}
let nonCritAverage = (totalDamNormal[0]+totalDamNormal[1])/2;
let critAverage = (totalDamCrit[0]+totalDamCrit[1])/2;
let averageDamage = (1-critChance)*nonCritAverage+critChance*critAverage;
let averageDamage = document.createElement("p");
averageDamage.textContent = "Average: "+Math.round((1-critChance)*nonCritAverage+critChance*critAverage);
averageDamage.classList.add("damageSubtitle");
part_div.append(averageDamage);
let averageLabel = document.createElement("p");
averageLabel.textContent = "Average: "+Math.round(averageDamage);
averageLabel.classList.add("damageSubtitle");
part_div.append(averageLabel);
let nonCritLabel = document.createElement("p");
nonCritLabel.textContent = "Non-Crit Average: "+Math.round(nonCritAverage);
@ -321,6 +324,17 @@ function displaySpellDamage(parent_elem, build, spell, spellIdx) {
part_div.append(p);
}
}
save_damages.push(averageDamage);
}
else if (part.type === "total") {
let total_damage = 0;
for (let i in part.factors) {
total_damage += save_damages[i] * factors[i];
}
let averageLabel = document.createElement("p");
averageLabel.textContent = "Average: "+Math.round(total_damage);
averageLabel.classList.add("damageSubtitle");
part_div.append(averageLabel);
}
}
}

View file

@ -11,7 +11,7 @@ console.log(url_tag);
* END testing section
*/
const BUILD_VERSION = "2.2";
const BUILD_VERSION = "2.3";
document.getElementById("header").textContent = "Wynn build calculator "+BUILD_VERSION+" (db version "+DB_VERSION+")";