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;
}
function formatOptimalSuggestion(counts) {
return Object.entries(counts)
.filter(([, count]) => count > 0)
.map(([effectId, count]) => {
const effect = effectById(effectId);
return `${count}x ${effect.cap}% ${effect.label.toLowerCase()}`;
})
.join(", ");
}
function formatCurrentEffectAverages(summary) {
return Object.entries(summary)
.filter(([, data]) => data.count > 0)
.map(([effectId, data]) => {
const effect = effectById(effectId);
return `${data.count}x avg ${fmt(data.total / data.count)}% ${effect.label.toLowerCase()}`;
})
.join(", ");
function renderEffectComparisonRows(optimumCounts, currentSummary) {
const rows = EFFECTS.map((effect) => {
const optimumCount = optimumCounts[effect.id] || 0;
const current = currentSummary[effect.id];
return `
<tr>
<th scope="row">${effect.label}</th>
<td>${optimumCount ? optimumCount : ""}</td>
<td>${optimumCount ? `${effect.cap}%` : ""}</td>
<td>${current.count || ""}</td>
<td>${current.count ? `${fmt(current.total / current.count)}%` : ""}</td>
</tr>
`;
});
$("#effectComparisonRows").innerHTML = rows.join("");
}
function renderOptimalDamageSetup(totals, currentDps) {
@@ -747,12 +744,7 @@ function renderOptimalDamageSetup(totals, currentDps) {
$("#optimumDps").textContent = fmt(optimum.dps);
$("#optimumDpsDelta").textContent = formatDelta(delta, "%");
$("#optimumDpsDelta").className = deltaClass(delta);
$("#optimumSuggestion").textContent = effectCount
? 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.";
renderEffectComparisonRows(effectCount ? optimum.counts : {}, currentEffectSummary);
}
function updateEffectImpactHints(totals, currentDps) {