Display Set Bonuses only if set items are used; Replace NaN stats with 0
This commit is contained in:
parent
04e6613b79
commit
0e57e0fed6
2 changed files with 10 additions and 4 deletions
12
display.js
12
display.js
|
@ -104,6 +104,12 @@ function displaySetBonuses(build, parent_id) {
|
||||||
set_summary_elem.textContent = "Set Bonuses:";
|
set_summary_elem.textContent = "Set Bonuses:";
|
||||||
parent_div.append(set_summary_elem);
|
parent_div.append(set_summary_elem);
|
||||||
|
|
||||||
|
if (build.activeSetCounts.size) {
|
||||||
|
parent_div.parentElement.style.visibility = "visible";
|
||||||
|
} else {
|
||||||
|
parent_div.parentElement.style.visibility = "hidden";
|
||||||
|
}
|
||||||
|
|
||||||
for (const [setName, count] of build.activeSetCounts) {
|
for (const [setName, count] of build.activeSetCounts) {
|
||||||
let set_elem = document.createElement('p');
|
let set_elem = document.createElement('p');
|
||||||
set_elem.id = "set-"+setName;
|
set_elem.id = "set-"+setName;
|
||||||
|
@ -1060,9 +1066,9 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell
|
||||||
results[i][j] = results[i][j].toFixed(2);
|
results[i][j] = results[i][j].toFixed(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let nonCritAverage = (totalDamNormal[0]+totalDamNormal[1])/2;
|
let nonCritAverage = (totalDamNormal[0]+totalDamNormal[1])/2 || 0;
|
||||||
let critAverage = (totalDamCrit[0]+totalDamCrit[1])/2;
|
let critAverage = (totalDamCrit[0]+totalDamCrit[1])/2 || 0;
|
||||||
let averageDamage = (1-critChance)*nonCritAverage+critChance*critAverage;
|
let averageDamage = (1-critChance)*nonCritAverage+critChance*critAverage || 0;
|
||||||
|
|
||||||
let averageLabel = document.createElement("p");
|
let averageLabel = document.createElement("p");
|
||||||
averageLabel.textContent = "Average: "+averageDamage.toFixed(2);
|
averageLabel.textContent = "Average: "+averageDamage.toFixed(2);
|
||||||
|
|
|
@ -546,7 +546,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="misc">
|
<div class="misc">
|
||||||
<div class = "center set-info" id = "set-info-div" style = "grid-column:1;grid-row:1">
|
<div class = "center set-info" id = "set-info-div" style = "grid-column:1;grid-row:1; visibility: hidden;">
|
||||||
<div class = "center" id = "set-info">Set info</div>
|
<div class = "center" id = "set-info">Set info</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue