Floating point damage display, fix shaman totem damage

This commit is contained in:
b 2021-01-09 05:01:57 -06:00
parent 0451a4a8ea
commit bc9a8be57e
3 changed files with 10 additions and 9 deletions

View file

@ -20,6 +20,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
neutralRemainingRaw[0] = Math.floor(neutralRemainingRaw[0] - min_diff); neutralRemainingRaw[0] = Math.floor(neutralRemainingRaw[0] - min_diff);
neutralRemainingRaw[1] = Math.floor(neutralRemainingRaw[1] - max_diff); neutralRemainingRaw[1] = Math.floor(neutralRemainingRaw[1] - max_diff);
} }
console.log(damages);
let rawBoosts = [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]; let rawBoosts = [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]];
for (const powderID of weapon.get("powders")) { for (const powderID of weapon.get("powders")) {
const powder = powderStats[powderID]; const powder = powderStats[powderID];
@ -154,7 +155,7 @@ const spell_table = {
"relik": [ "relik": [
{ title: "Totem", cost: 4, parts: [ { title: "Totem", cost: 4, parts: [
{ subtitle: "Smash Damage", type: "damage", multiplier: 100, conversion: [80, 0, 0, 0, 20, 0]}, { subtitle: "Smash Damage", type: "damage", multiplier: 100, conversion: [80, 0, 0, 0, 20, 0]},
{ subtitle: "Damage Tick", type: "damage", multiplier: 100, conversion: [80, 0, 0, 0, 0, 20]}, { subtitle: "Damage Tick", type: "damage", multiplier: 20, conversion: [80, 0, 0, 0, 0, 20]},
{ subtitle: "Heal Tick", type: "heal", strength: 0.04 }, { subtitle: "Heal Tick", type: "heal", strength: 0.04 },
] }, ] },
{ title: "Haul", cost: 1, parts: [ { title: "Haul", cost: 1, parts: [

View file

@ -281,7 +281,7 @@ function displaySpellDamage(parent_elem, build, spell, spellIdx) {
let results = _results[2]; let results = _results[2];
for (let i = 0; i < 6; ++i) { for (let i = 0; i < 6; ++i) {
for (let j in results[i]) { for (let j in results[i]) {
results[i][j] = Math.round(results[i][j]); results[i][j] = results[i][j].toFixed(2);
} }
} }
let nonCritAverage = (totalDamNormal[0]+totalDamNormal[1])/2; let nonCritAverage = (totalDamNormal[0]+totalDamNormal[1])/2;
@ -289,19 +289,19 @@ function displaySpellDamage(parent_elem, build, spell, spellIdx) {
let averageDamage = (1-critChance)*nonCritAverage+critChance*critAverage; let averageDamage = (1-critChance)*nonCritAverage+critChance*critAverage;
let averageLabel = document.createElement("p"); let averageLabel = document.createElement("p");
averageLabel.textContent = "Average: "+Math.round(averageDamage); averageLabel.textContent = "Average: "+averageDamage.toFixed(2);
averageLabel.classList.add("damageSubtitle"); averageLabel.classList.add("damageSubtitle");
part_div.append(averageLabel); part_div.append(averageLabel);
let nonCritLabel = document.createElement("p"); let nonCritLabel = document.createElement("p");
nonCritLabel.textContent = "Non-Crit Average: "+Math.round(nonCritAverage); nonCritLabel.textContent = "Non-Crit Average: "+nonCritAverage.toFixed(2);
nonCritLabel.classList.add("damageSubtitle"); nonCritLabel.classList.add("damageSubtitle");
part_div.append(nonCritLabel); part_div.append(nonCritLabel);
let damageClasses = ["Neutral","Earth","Thunder","Water","Fire","Air"]; let damageClasses = ["Neutral","Earth","Thunder","Water","Fire","Air"];
console.log(results); console.log(results);
for (let i = 0; i < 6; i++){ for (let i = 0; i < 6; i++){
if (results[i][0] > 0){ if (results[i][1] > 0){
let p = document.createElement("p"); let p = document.createElement("p");
p.classList.add("damagep"); p.classList.add("damagep");
p.classList.add(damageClasses[i]); p.classList.add(damageClasses[i]);
@ -311,12 +311,12 @@ function displaySpellDamage(parent_elem, build, spell, spellIdx) {
} }
//part_div.append(document.createElement("br")); //part_div.append(document.createElement("br"));
let critLabel = document.createElement("p"); let critLabel = document.createElement("p");
critLabel.textContent = "Crit Average: "+Math.round(critAverage); critLabel.textContent = "Crit Average: "+critAverage.toFixed(2);
critLabel.classList.add("damageSubtitle"); critLabel.classList.add("damageSubtitle");
part_div.append(critLabel); part_div.append(critLabel);
for (let i = 0; i < 6; i++){ for (let i = 0; i < 6; i++){
if (results[i][0] > 0){ if (results[i][1] > 0){
let p = document.createElement("p"); let p = document.createElement("p");
p.classList.add("damagep"); p.classList.add("damagep");
p.classList.add(damageClasses[i]); p.classList.add(damageClasses[i]);
@ -332,7 +332,7 @@ function displaySpellDamage(parent_elem, build, spell, spellIdx) {
total_damage += save_damages[i] * part.factors[i]; total_damage += save_damages[i] * part.factors[i];
} }
let averageLabel = document.createElement("p"); let averageLabel = document.createElement("p");
averageLabel.textContent = "Average: "+Math.round(total_damage); averageLabel.textContent = "Average: "+total_damage.toFixed(2);
averageLabel.classList.add("damageSubtitle"); averageLabel.classList.add("damageSubtitle");
part_div.append(averageLabel); part_div.append(averageLabel);
} }

View file

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