minor visual things

This commit is contained in:
ferricles 2021-01-10 18:58:39 -08:00
parent 1906b2f63d
commit 8796ae0fd8
4 changed files with 63 additions and 17 deletions

View file

@ -175,19 +175,21 @@ 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]);
}

View file

@ -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];

View file

@ -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,11 +591,16 @@ 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){

34
test.js
View file

@ -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");