Show hit and crit damage in DPS metric
This commit is contained in:
@@ -214,13 +214,15 @@ function renderGear() {
|
||||
function updateAnalysis() {
|
||||
const profile = PROFILES[state.profile];
|
||||
const totals = calculateTotals();
|
||||
const dps = calculateDps(totals, state.combatStyle);
|
||||
const damageDetails = calculateDamageDetails(totals, state.combatStyle);
|
||||
const dps = damageDetails.dps;
|
||||
const survivability = calculateSurvivability(totals);
|
||||
const pieceScores = state.pieces.map((piece) => scorePiece(piece, profile, totals));
|
||||
|
||||
$("#totalDamage").textContent = fmt(totals.baseDamage);
|
||||
$("#totalHealth").textContent = fmt(totals.baseHealth);
|
||||
$("#dpsValue").textContent = fmt(dps);
|
||||
$("#hitDamageDetails").innerHTML = `Hit ${fmt(damageDetails.singleHit)}<br>Crit ${fmt(damageDetails.critHit)}`;
|
||||
$("#defenseScore").textContent = fmt(calculateGroupScore(totals, profile, ["defense", "hybrid"], "health"));
|
||||
|
||||
document.querySelectorAll(".gear-card").forEach((card, index) => {
|
||||
@@ -247,17 +249,27 @@ function calculateTotals() {
|
||||
}
|
||||
|
||||
function calculateDps(totals, combatStyle = "melee") {
|
||||
return calculateDamageDetails(totals, combatStyle).dps;
|
||||
}
|
||||
|
||||
function calculateDamageDetails(totals, combatStyle = "melee") {
|
||||
const effects = totals.effects;
|
||||
const baseDamage = Math.max(0, totals.baseDamage);
|
||||
const globalDamage = 1 + effects.damage / 100;
|
||||
const styleDamage = 1 + getStyleDamageBonus(effects, combatStyle) / 100;
|
||||
const singleHit = baseDamage * globalDamage * styleDamage;
|
||||
const attackSpeed = 1 + effects.attackSpeed / 100;
|
||||
const doubleHit = 1 + effects.doubleChance / 100;
|
||||
const critChance = effects.critChance / 100;
|
||||
const critDamage = effects.critDamage / 100;
|
||||
const crit = 1 + critChance * critDamage;
|
||||
const critHit = singleHit * (1 + critDamage);
|
||||
const cooldown = combatStyle === "skill" ? 1 / Math.max(0.05, 1 - effects.skillCooldown / 100) : 1;
|
||||
return baseDamage * globalDamage * styleDamage * attackSpeed * doubleHit * crit * cooldown;
|
||||
return {
|
||||
singleHit,
|
||||
critHit,
|
||||
dps: singleHit * attackSpeed * doubleHit * crit * cooldown,
|
||||
};
|
||||
}
|
||||
|
||||
function calculateSurvivability(totals) {
|
||||
|
||||
Reference in New Issue
Block a user