Fix damage calc

This commit is contained in:
b 2021-01-12 16:49:57 -06:00
parent 96b837fcc6
commit 837dfca985
3 changed files with 16 additions and 6 deletions

View file

@ -1,7 +1,7 @@
const baseDamageMultiplier = [ 0.51, 0.83, 1.5, 2.05, 2.5, 3.1, 4.3 ]; const baseDamageMultiplier = [ 0.51, 0.83, 1.5, 2.05, 2.5, 3.1, 4.3 ];
const attackSpeeds = ["SUPER_SLOW", "VERY_SLOW", "SLOW", "NORMAL", "FAST", "VERY_FAST", "SUPER_FAST"]; const attackSpeeds = ["SUPER_SLOW", "VERY_SLOW", "SLOW", "NORMAL", "FAST", "VERY_FAST", "SUPER_FAST"];
const classDefenseMultipliers = new Map([ ["relik",0.60], ["bow",0.60], ["wand", 0.80], ["dagger", 1.0], ["spear",1.20] ]); const classDefenseMultipliers = new Map([ ["relik",0.50], ["bow",0.60], ["wand", 0.80], ["dagger", 1.0], ["spear",1.20] ]);
/*Turns the input amount of skill points into a float precision percentage. /*Turns the input amount of skill points into a float precision percentage.
* @param skp - the integer skillpoint count to be converted * @param skp - the integer skillpoint count to be converted
@ -183,14 +183,15 @@ class Build{
totalDamCrit.push(skillPointsToPercentage(dex)); totalDamCrit.push(skillPointsToPercentage(dex));
let damages_results = results[2]; let damages_results = results[2];
let singleHitTotal = ((totalDamNorm[0]+totalDamNorm[1])*(totalDamNorm[2])
+(totalDamCrit[0]+totalDamCrit[1])*(totalDamCrit[2]))/2;
//Now do math //Now do math
let normDPS = (totalDamNorm[0]+totalDamNorm[1])/2 * baseDamageMultiplier[adjAtkSpd]; let normDPS = (totalDamNorm[0]+totalDamNorm[1])/2 * baseDamageMultiplier[adjAtkSpd];
let critDPS = (totalDamCrit[0]+totalDamCrit[1])/2 * baseDamageMultiplier[adjAtkSpd]; let critDPS = (totalDamCrit[0]+totalDamCrit[1])/2 * baseDamageMultiplier[adjAtkSpd];
let avgDPS = (normDPS * (1 - skillPointsToPercentage(dex))) + (critDPS * (skillPointsToPercentage(dex))); let avgDPS = (normDPS * (1 - skillPointsToPercentage(dex))) + (critDPS * (skillPointsToPercentage(dex)));
//[[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] //[[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, singleHit]
//console.log(damages_results.concat([totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS,adjAtkSpd])); return damages_results.concat([totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS,adjAtkSpd, singleHitTotal]);
return damages_results.concat([totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS,adjAtkSpd]);
} }
/* /*

View file

@ -1,4 +1,4 @@
const damageMultipliers = new Map([ ["allytotem", .35], ["yourtotem", .35], ["vanish", 0.80], ["warscream", 0.10] ]); const damageMultipliers = new Map([ ["allytotem", .15], ["yourtotem", .35], ["vanish", 0.80], ["warscream", 0.10] ]);
// Calculate spell damage given a spell elemental conversion table, and a spell multiplier. // Calculate spell damage given a spell elemental conversion table, and a spell multiplier.
// If spell mult is 0, its melee damage and we don't multiply by attack speed. // If spell mult is 0, its melee damage and we don't multiply by attack speed.
function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, spellMultiplier, weapon, total_skillpoints, damageMultiplier) { function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, spellMultiplier, weapon, total_skillpoints, damageMultiplier) {
@ -53,7 +53,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
//console.log(damages); //console.log(damages);
//console.log(damageMult); //console.log(damageMult);
rawModifier *= spellMultiplier; rawModifier *= spellMultiplier * damageMultiplier;
let totalDamNorm = [0, 0]; let totalDamNorm = [0, 0];
let totalDamCrit = [0, 0]; let totalDamCrit = [0, 0];
if(!melee){ if(!melee){

View file

@ -694,6 +694,7 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
nonCritStats.append(dmg); nonCritStats.append(dmg);
} }
} }
let normalDamage = document.createElement("p"); let normalDamage = document.createElement("p");
normalDamage.textContent = "Total: " + stats[6][0] + "-" + stats[6][1]; normalDamage.textContent = "Total: " + stats[6][0] + "-" + stats[6][1];
normalDamage.classList.add("itemp"); normalDamage.classList.add("itemp");
@ -703,6 +704,14 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
normalDPS.textContent = "Normal DPS: " + stats[8]; normalDPS.textContent = "Normal DPS: " + stats[8];
normalDPS.classList.add("itemp"); normalDPS.classList.add("itemp");
nonCritStats.append(normalDPS); nonCritStats.append(normalDPS);
//overall average DPS
let singleHitDamage = document.createElement("p");
singleHitDamage.classList.add("itemp");
console.log(stats);
singleHitDamage.textContent = "Single Hit Average: " + stats[12].toFixed(2);
overallparent_elem.append(singleHitDamage);
overallparent_elem.append(document.createElement("br"));
let normalChance = document.createElement("p"); let normalChance = document.createElement("p");
normalChance.textContent = "Non-Crit Chance: " + (stats[6][2]*100).toFixed(2) + "%"; normalChance.textContent = "Non-Crit Chance: " + (stats[6][2]*100).toFixed(2) + "%";