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
|
@ -103,6 +103,12 @@ function displaySetBonuses(build, parent_id) {
|
|||
set_summary_elem.classList.add('itemcenter');
|
||||
set_summary_elem.textContent = "Set Bonuses:";
|
||||
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) {
|
||||
let set_elem = document.createElement('p');
|
||||
|
@ -1060,9 +1066,9 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell
|
|||
results[i][j] = results[i][j].toFixed(2);
|
||||
}
|
||||
}
|
||||
let nonCritAverage = (totalDamNormal[0]+totalDamNormal[1])/2;
|
||||
let critAverage = (totalDamCrit[0]+totalDamCrit[1])/2;
|
||||
let averageDamage = (1-critChance)*nonCritAverage+critChance*critAverage;
|
||||
let nonCritAverage = (totalDamNormal[0]+totalDamNormal[1])/2 || 0;
|
||||
let critAverage = (totalDamCrit[0]+totalDamCrit[1])/2 || 0;
|
||||
let averageDamage = (1-critChance)*nonCritAverage+critChance*critAverage || 0;
|
||||
|
||||
let averageLabel = document.createElement("p");
|
||||
averageLabel.textContent = "Average: "+averageDamage.toFixed(2);
|
||||
|
|
|
@ -546,7 +546,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue