Show damage optimizer effects in table

This commit is contained in:
Jan Bader
2026-06-20 23:55:56 +02:00
parent 8a3c703961
commit 630d6d6fd6
3 changed files with 51 additions and 40 deletions
+16 -24
View File
@@ -717,24 +717,21 @@ function findOptimalDamageSetup(totals, effectCount, combatStyle) {
return best; return best;
} }
function formatOptimalSuggestion(counts) { function renderEffectComparisonRows(optimumCounts, currentSummary) {
return Object.entries(counts) const rows = EFFECTS.map((effect) => {
.filter(([, count]) => count > 0) const optimumCount = optimumCounts[effect.id] || 0;
.map(([effectId, count]) => { const current = currentSummary[effect.id];
const effect = effectById(effectId); return `
return `${count}x ${effect.cap}% ${effect.label.toLowerCase()}`; <tr>
}) <th scope="row">${effect.label}</th>
.join(", "); <td>${optimumCount ? optimumCount : ""}</td>
} <td>${optimumCount ? `${effect.cap}%` : ""}</td>
<td>${current.count || ""}</td>
function formatCurrentEffectAverages(summary) { <td>${current.count ? `${fmt(current.total / current.count)}%` : ""}</td>
return Object.entries(summary) </tr>
.filter(([, data]) => data.count > 0) `;
.map(([effectId, data]) => { });
const effect = effectById(effectId); $("#effectComparisonRows").innerHTML = rows.join("");
return `${data.count}x avg ${fmt(data.total / data.count)}% ${effect.label.toLowerCase()}`;
})
.join(", ");
} }
function renderOptimalDamageSetup(totals, currentDps) { function renderOptimalDamageSetup(totals, currentDps) {
@@ -747,12 +744,7 @@ function renderOptimalDamageSetup(totals, currentDps) {
$("#optimumDps").textContent = fmt(optimum.dps); $("#optimumDps").textContent = fmt(optimum.dps);
$("#optimumDpsDelta").textContent = formatDelta(delta, "%"); $("#optimumDpsDelta").textContent = formatDelta(delta, "%");
$("#optimumDpsDelta").className = deltaClass(delta); $("#optimumDpsDelta").className = deltaClass(delta);
$("#optimumSuggestion").textContent = effectCount renderEffectComparisonRows(effectCount ? optimum.counts : {}, currentEffectSummary);
? formatOptimalSuggestion(optimum.counts)
: "Add effects to your current build to see an optimized max-roll damage mix.";
$("#currentEffectAverages").textContent = effectCount
? formatCurrentEffectAverages(currentEffectSummary)
: "No current effects entered.";
} }
function updateEffectImpactHints(totals, currentDps) { function updateEffectImpactHints(totals, currentDps) {
+13 -4
View File
@@ -99,10 +99,19 @@
<div><span>Optimal DPS</span><strong id="optimumDps">0</strong></div> <div><span>Optimal DPS</span><strong id="optimumDps">0</strong></div>
<div><span>Difference vs current</span><strong id="optimumDpsDelta">0</strong></div> <div><span>Difference vs current</span><strong id="optimumDpsDelta">0</strong></div>
</div> </div>
<p id="optimumSuggestion" class="optimum-suggestion"></p> <div class="effect-comparison-wrap">
<div class="current-effect-summary"> <table class="effect-comparison-table">
<h3>Current effects</h3> <thead>
<p id="currentEffectAverages" class="optimum-suggestion"></p> <tr>
<th>Effect name</th>
<th>Optimum count</th>
<th>Optimum effect</th>
<th>Current count</th>
<th>Current avg</th>
</tr>
</thead>
<tbody id="effectComparisonRows"></tbody>
</table>
</div> </div>
</section> </section>
+22 -12
View File
@@ -278,22 +278,32 @@ h3 { margin-bottom: 0; }
margin-bottom: 0.25rem; margin-bottom: 0.25rem;
} }
.optimum-results strong { font-size: 1.35rem; } .optimum-results strong { font-size: 1.35rem; }
.optimum-suggestion { .effect-comparison-wrap { overflow-x: auto; }
margin: 0; .effect-comparison-table {
color: var(--accent); width: 100%;
font-weight: 800; border-collapse: collapse;
overflow-wrap: anywhere; min-width: 680px;
} }
.current-effect-summary { .effect-comparison-table th,
border-top: 1px solid var(--border); .effect-comparison-table td {
padding-top: 0.75rem; border-bottom: 1px solid var(--border);
padding: 0.55rem 0.65rem;
text-align: right;
white-space: nowrap;
} }
.current-effect-summary h3 { .effect-comparison-table thead th {
color: var(--muted); color: var(--muted);
font-size: 0.95rem; font-size: 0.82rem;
margin-bottom: 0.35rem; font-weight: 700;
} }
.current-effect-summary .optimum-suggestion { color: var(--text); } .effect-comparison-table th:first-child,
.effect-comparison-table td:first-child { text-align: left; }
.effect-comparison-table tbody th {
color: var(--text);
font-weight: 700;
}
.effect-comparison-table tbody td { color: var(--accent); font-weight: 800; }
.effect-comparison-table tbody td:empty::after { content: ""; }
.swap-actions { .swap-actions {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;