From 8796ae0fd8c4682588916bf9f1035ce15b2df922 Mon Sep 17 00:00:00 2001 From: ferricles Date: Sun, 10 Jan 2021 18:58:39 -0800 Subject: [PATCH] minor visual things --- build.js | 12 +++++++----- damage_calc.js | 11 ++++++++--- display.js | 23 +++++++++++++++++------ test.js | 34 +++++++++++++++++++++++++++++++--- 4 files changed, 63 insertions(+), 17 deletions(-) diff --git a/build.js b/build.js index 99dd810..69d026f 100644 --- a/build.js +++ b/build.js @@ -174,20 +174,22 @@ class Build{ // 0 for melee damage. let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], stats.get("mdRaw"), stats.get("mdPct"), 0, this.weapon, this.total_skillpoints); - - //TODO: Account for strength (this.damageMultiplier). + + let dex = this.total_skillpoints[1]; let totalDamNorm = results[0]; let totalDamCrit = results[1]; + totalDamNorm.push(1-skillPointsToPercentage(dex)); + totalDamCrit.push(skillPointsToPercentage(dex)); let damages_results = results[2]; - - let dex = this.total_skillpoints[1]; + //Now do math let normDPS = (totalDamNorm[0]+totalDamNorm[1])/2 * baseDamageMultiplier[adjAtkSpd]; let critDPS = (totalDamCrit[0]+totalDamCrit[1])/2 * baseDamageMultiplier[adjAtkSpd]; let avgDPS = (normDPS * (1 - skillPointsToPercentage(dex))) + (critDPS * (skillPointsToPercentage(dex))); - //console.log([nDamAdj,eDamAdj,tDamAdj,wDamAdj,fDamAdj,aDamAdj,totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS]); + //[[n n n n] [e e e e] [t t t t] [w w w w] [f f f f] [a a a a] [lowtotal hightotal normalChance] [critlowtotal crithightotal critChance] normalDPS critCPS averageDPS adjAttackSpeed] + //console.log(damages_results.concat([totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS,adjAtkSpd])); return damages_results.concat([totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS,adjAtkSpd]); } diff --git a/damage_calc.js b/damage_calc.js index c5eda9c..2f57787 100644 --- a/damage_calc.js +++ b/damage_calc.js @@ -40,9 +40,11 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, } let damageMult = 1; + let melee = false; // If we are doing melee calculations: if (spellMultiplier == 0) { spellMultiplier = 1; + melee = true; } else { damageMult *= spellMultiplier * baseDamageMultiplier[attackSpeeds.indexOf(stats.get("atkSpd"))]; @@ -51,9 +53,12 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, //console.log(damageMult); rawModifier *= spellMultiplier; - - let totalDamNorm = [rawModifier, rawModifier]; - let totalDamCrit = [rawModifier, rawModifier]; + let totalDamNorm = [0, 0]; + let totalDamCrit = [0, 0]; + if(!melee){ + totalDamNorm = [rawModifier, rawModifier]; + totalDamCrit = [rawModifier, rawModifier]; + } let damages_results = []; // 0th skillpoint is strength, 1st is dex. let str = total_skillpoints[0]; diff --git a/display.js b/display.js index e7bc3e4..9318b03 100644 --- a/display.js +++ b/display.js @@ -358,7 +358,8 @@ function displayExpandedItem(item, parent_id){ let powderSuffix = document.createElement("td"); powderSuffix.classList.add("itemp"); powderSuffix.classList.add("left"); - powderSuffix.textContent = " ]"; + powderSuffix.classList.add("nopadding"); + powderSuffix.textContent = "]"; row.appendChild(powderSuffix); wrapper.appendChild(row); @@ -514,7 +515,7 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){ } } for (let i = 6; i < 8; ++i) { - for (let j in stats[i]) { + for (let j = 0; j < 2; j++) { stats[i][j] = stats[i][j].toFixed(2); } } @@ -590,10 +591,15 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){ let normalDPS = document.createElement("p"); normalDPS.textContent = "Normal DPS: " + stats[8]; - normalDPS.append(document.createElement("br")); - normalDPS.append(document.createElement("br")); normalDPS.classList.add("itemp"); nonCritStats.append(normalDPS); + + let normalChance = document.createElement("p"); + normalChance.textContent = "Non-Crit Chance: " + (stats[6][2]*100).toFixed(2) + "%"; + normalChance.classList.add("itemp"); + normalChance.append(document.createElement("br")); + normalChance.append(document.createElement("br")); + nonCritStats.append(normalChance); parent_elem.append(nonCritStats); parent_elem.append(document.createElement("br")); @@ -621,10 +627,15 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){ let critDPS = document.createElement("p"); critDPS.textContent = "Crit DPS: " + stats[9]; critDPS.classList.add("itemp"); - critDPS.append(document.createElement("br")); - critDPS.append(document.createElement("br")); critStats.append(critDPS); + let critChance = document.createElement("p"); + critChance.textContent = "Crit Chance: " + (stats[7][2]*100).toFixed(2) + "%"; + critChance.classList.add("itemp"); + critChance.append(document.createElement("br")); + critChance.append(document.createElement("br")); + critStats.append(critChance); + parent_elem.append(critStats); } function displayDefenseStats(parent_elem,defenseStats){ diff --git a/test.js b/test.js index a2518a4..2ac1d33 100644 --- a/test.js +++ b/test.js @@ -454,10 +454,38 @@ function calculateBuildStats() { let summarybox = document.getElementById("summary-box"); summarybox.textContent = ""; - let skpSummary = document.createElement("p"); - skpSummary.textContent = "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints. Total: ( " + player_build.total_skillpoints.join(" | ") + " )"; + let skpRow = document.createElement("tr"); + //let skpSummary = document.createElement("p"); + //skpSummary.textContent = "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints. Total: ( " + player_build.total_skillpoints.join(" | ") + " )"; + let skpSummary = document.createElement("td"); + skpSummary.textContent = "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints. Total: ("; skpSummary.classList.add("itemp"); - summarybox.append(skpSummary); + skpRow.appendChild(skpSummary); + for (let i = 0; i < skp_order.length; i++){ + let skp = document.createElement("td"); + let boost = document.createElement("td"); + let separator = document.createElement("td"); + skp.classList.add("itemp"); + skp.classList.add("nopadding"); + skp.classList.add(damageClasses[i+1]); + boost.classList.add("itemp"); + boost.classList.add("nopadding"); + boost.textContent = player_build.total_skillpoints[i]; + skpRow.appendChild(skp); + skpRow.appendChild(document.createElement("br")); + skpRow.appendChild(boost); + if(i < 4){ + skpRow.appendChild(separator); + } + } + //summarybox.append(skpSummary); + + let skpEnd = document.createElement("td"); + skpEnd.textContent = ")"; + skpEnd.classList.add("itemp"); + skpRow.append(skpEnd); + + summarybox.append(skpRow); if(player_build.assigned_skillpoints > levelToSkillPoints(player_build.level)){ let skpWarning = document.createElement("p"); skpWarning.classList.add("itemp");