diff --git a/build.js b/build.js index ca273a1..ebc0dac 100644 --- a/build.js +++ b/build.js @@ -57,7 +57,7 @@ class Build{ */ constructor(level,equipment, powders){ // NOTE: powders is just an array of arrays of powder IDs. Not powder objects. - this.powders = powders + this.powders = powders; if(itemMap.get(equipment[0]) && itemMap.get(equipment[0]).type === "helmet") { const helmet = itemMap.get(equipment[0]); this.powders[0] = this.powders[0].slice(0,helmet.slots); @@ -88,25 +88,25 @@ class Build{ } if(itemMap.get(equipment[4]).type === "ring") { const ring = itemMap.get(equipment[4]); - this.ring1 = expandItem(ring, []) + this.ring1 = expandItem(ring, []); }else{ throw new TypeError("No such ring named ", equipment[4]); } if(itemMap.get(equipment[5]).type === "ring") { const ring = itemMap.get(equipment[5]); - this.ring2 = expandItem(ring, []) + this.ring2 = expandItem(ring, []); }else{ throw new TypeError("No such ring named ", equipment[5]); } if(itemMap.get(equipment[6]).type === "bracelet") { const bracelet = itemMap.get(equipment[6]); - this.bracelet = expandItem(bracelet, []) + this.bracelet = expandItem(bracelet, []); }else{ throw new TypeError("No such bracelet named ", equipment[6]); } if(itemMap.get(equipment[7]).type === "necklace") { const necklace = itemMap.get(equipment[7]); - this.necklace = expandItem(necklace, []) + this.necklace = expandItem(necklace, []); }else{ throw new TypeError("No such necklace named ", equipment[7]); } diff --git a/display.js b/display.js index 95684e9..488c69a 100644 --- a/display.js +++ b/display.js @@ -43,13 +43,15 @@ function expandItem(item, powders){ expandedItem.set("powders", powders); return expandedItem; } + + /*An independent helper function that rounds a rolled ID to the nearest integer OR brings the roll away from 0. * @param id */ function idRound(id){ rounded = Math.round(id); if(rounded == 0){ - return 1; + return 1; //this is a hack, will need changing along w/ rest of ID system if anything changes }else{ return rounded; } @@ -349,7 +351,127 @@ function displayFixedID(active, id, value, elemental_format, style) { return p_elem; } } +function displayMeleeDamage(parent_elem, meleeStats){ + let attackSpeeds = ["Super Slow", "Very Slow", "Slow", "Normal", "Fast", "Very Fast", "Super Fast"]; + let damagePrefixes = ["Neutral Damage: ","Earth Damage: ","Thunder Damage: ","Water Damage: ","Fire Damage: ","Air Damage: "]; + parent_elem.textContent = ""; + const stats = meleeStats.slice(); + + for (let i = 0; i < 6; ++i) { + for (let j in stats[i]) { + stats[i][j] = stats[i][j].toFixed(2); + } + } + for (let i = 6; i < 8; ++i) { + for (let j in stats[i]) { + stats[i][j] = stats[i][j].toFixed(2); + } + } + for (let i = 8; i < 11; ++i){ + stats[i] = stats[i].toFixed(2); + } + + //title + let title_elem = document.createElement("p"); + title_elem.classList.add("center"); + title_elem.textContent = "Melee Stats"; + parent_elem.append(title_elem); + parent_elem.append(document.createElement("br")); + + //average DPS + let averageDamage = document.createElement("p"); + averageDamage.classList.add("center"); + averageDamage.textContent = "Average DPS: " + stats[10]; + parent_elem.append(averageDamage); + parent_elem.append(document.createElement("br")); + //attack speed + let atkSpd = document.createElement("p"); + atkSpd.classList.add("center"); + atkSpd.textContent = "Attack Speed: " + attackSpeeds[stats[11]]; + parent_elem.append(atkSpd); + parent_elem.append(document.createElement("br")); + + //Non-Crit: n->elem, total dmg, DPS + let nonCritStats = document.createElement("p"); + nonCritStats.classList.add("center"); + nonCritStats.textContent = "Non-Crit Stats: "; + nonCritStats.append(document.createElement("br")); + let dmg = document.createElement("p"); + for (let i = 0; i < 6; i++){ + if(stats[i][0] > 0){ + dmg.textContent = damagePrefixes[i] + stats[i][0] + " - " + stats[i][1]; + nonCritStats.append(dmg); + } + } + let normalDamage = document.createElement("p"); + normalDamage.textContent = "Total Damage: " + stats[6][0] + " - " + stats[6][1]; + nonCritStats.append(normalDamage); + + let normalDPS = document.createElement("p"); + normalDPS.textContent = "Normal DPS: " + stats[8]; + normalDPS.append(document.createElement("br")); + normalDPS.append(document.createElement("br")); + nonCritStats.append(normalDPS); + + parent_elem.append(nonCritStats); + parent_elem.append(document.createElement("br")); + + //Crit: n->elem, total dmg, DPS + let critStats = document.createElement("p"); + critStats.classList.add("center"); + critStats.textContent = "Crit Stats: "; + critStats.append(document.createElement("br")); + dmg = document.createElement("p"); + for (let i = 0; i < 6; i++){ + if(stats[i][2] > 0){ + dmg.textContent = damagePrefixes[i] + stats[i][2] + " - " + stats[i][3]; + critStats.append(dmg); + } + } + normalDamage = document.createElement("p"); + normalDamage.textContent = "Total Damage: " + stats[7][0] + " - " + stats[7][1]; + critStats.append(normalDamage); + + normalDPS = document.createElement("p"); + normalDPS.textContent = "Crit DPS: " + stats[9]; + normalDPS.append(document.createElement("br")); + normalDPS.append(document.createElement("br")); + critStats.append(normalDPS); + + parent_elem.append(critStats); + parent_elem.append(document.createElement("br")); + + /* + //nDamAdj,eDamAdj,tDamAdj,wDamAdj,fDamAdj,aDamAdj,totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS + + let meleeSummary = ""; + meleeSummary = meleeSummary.concat("
Made by: hppeng and ferricles (JavaScript required to function, nothing works without js)
+Made by hppeng and ferricles (JavaScript required to function, nothing works without js)
Hard refresh the page (Ctrl+Shift+R on windows/chrome) if it isn't updating correctly.
Overall Build Stats: