Build display working, still have to do edit ids / skillpoints

This commit is contained in:
hppeng 2022-06-19 13:59:16 -07:00
parent 81dfe767a3
commit 7980980f9a
8 changed files with 78 additions and 78 deletions

View file

@ -1391,7 +1391,6 @@
<script type="text/javascript" src="../js/damage_calc.js"></script>
<script type="text/javascript" src="../js/display_constants.js"></script>
<script type="text/javascript" src="../js/sq2display_constants.js"></script>
<script type="text/javascript" src="../js/display.js"></script>

View file

@ -221,19 +221,19 @@ class Build{
//EHP
let ehp = [totalHp, totalHp];
let defMult = classDefenseMultipliers.get(this.weapon.statMap.get("type"));
ehp[0] /= ((1-def_pct)*(1-agi_pct)*(2-defMult)*(2-this.defenseMultiplier));
ehp[1] /= ((1-def_pct)*(2-defMult)*(2-this.defenseMultiplier));
ehp[0] /= (1-def_pct)*(1-agi_pct)*(2-defMult);
ehp[1] /= (1-def_pct)*(2-defMult);
defenseStats.push(ehp);
//HPR
let totalHpr = rawToPct(stats.get("hprRaw"), stats.get("hprPct")/100.);
defenseStats.push(totalHpr);
//EHPR
let ehpr = [totalHpr, totalHpr];
ehpr[0] /= ((1-def_pct)*(1-agi_pct)*(2-defMult)*(2-this.defenseMultiplier));
ehpr[1] /= ((1-def_pct)*(2-defMult)*(2-this.defenseMultiplier));
ehpr[0] /= (1-def_pct)*(1-agi_pct)*(2-defMult);
ehpr[1] /= (1-def_pct)*(2-defMult);
defenseStats.push(ehpr);
//skp stats
defenseStats.push([ (1 - ((1-def_pct) * (2 - this.defenseMultiplier)))*100, agi_pct*100]);
defenseStats.push([ def_pct*100, agi_pct*100]);
//eledefs - TODO POWDERS
let eledefs = [0, 0, 0, 0, 0];
for(const i in skp_elements){ //kinda jank but ok

View file

@ -101,6 +101,7 @@ let armor_keys = ['helmet', 'chestplate', 'leggings', 'boots'];
let accessory_keys= ['ring1', 'ring2', 'bracelet', 'necklace'];
let powderable_keys = ['helmet', 'chestplate', 'leggings', 'boots', 'weapon'];
let equipment_keys = ['helmet', 'chestplate', 'leggings', 'boots', 'ring1', 'ring2', 'bracelet', 'necklace', 'weapon'];
let tome_keys = ['weaponTome1', 'weaponTome2', 'armorTome1', 'armorTome2', 'armorTome3', 'armorTome4', 'guildTome1'];
let spell_disp = ['spell0-info', 'spell1-info', 'spell2-info', 'spell3-info'];
let other_disp = ['build-order', 'set-info', 'int-info'];

View file

@ -51,16 +51,16 @@ const armorTypes = [ "helmet", "chestplate", "leggings", "boots" ];
const accessoryTypes = [ "ring", "bracelet", "necklace" ];
const weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ];
const consumableTypes = [ "potion", "scroll", "food"];
const tomeTypes = ["armorTome", "weaponTome", "guildTome"]; //"dungeonTome", "gatheringTome", "slayingTome"
const tome_types = ['weaponTome', 'armorTome', 'guildTome'];
const attackSpeeds = ["SUPER_SLOW", "VERY_SLOW", "SLOW", "NORMAL", "FAST", "VERY_FAST", "SUPER_FAST"];
const baseDamageMultiplier = [ 0.51, 0.83, 1.5, 2.05, 2.5, 3.1, 4.3 ];
//0.51, 0.82, 1.50, 2.05, 2.50, 3.11, 4.27
const classes = ["Warrior", "Assassin", "Mage", "Archer", "Shaman"];
const tiers = ["Normal", "Unique", "Rare", "Legendary", "Fabled", "Mythic", "Set", "Crafted"] //I'm not sure why you would make a custom crafted but if you do you should be able to use it w/ the correct powder formula
const types = armorTypes.concat(accessoryTypes).concat(weaponTypes).concat(consumableTypes).concat(tomeTypes).map(x => x.substring(0,1).toUpperCase() + x.substring(1));
const types = armorTypes.concat(accessoryTypes).concat(weaponTypes).concat(consumableTypes).concat(tome_types).map(x => x.substring(0,1).toUpperCase() + x.substring(1));
//weaponTypes.push("sword");
//console.log(types)
let itemTypes = armorTypes.concat(accessoryTypes).concat(weaponTypes).concat(tomeTypes);
let itemTypes = armorTypes.concat(accessoryTypes).concat(weaponTypes).concat(tome_types);
let elementIcons = ["\u2724","\u2726", "\u2749", "\u2739", "\u274b" ];
let skpReqs = skp_order.map(x => x + "Req");

View file

@ -383,6 +383,12 @@ class BuildDisplayNode extends ComputeNode {
displayBuildStats('overall-stats', build, build_all_display_commands);
displayBuildStats("offensive-stats", build, build_offensive_display_commands);
displaySetBonuses("set-info", build);
let meleeStats = build.getMeleeStats();
displayMeleeDamage(document.getElementById("build-melee-stats"), document.getElementById("build-melee-statsAvg"), meleeStats);
displayDefenseStats(document.getElementById("defensive-stats"), build);
displayPoisonDamage(document.getElementById("build-poison-stats"), build);
}
}

View file

@ -1116,7 +1116,6 @@ function displayEquipOrder(parent_elem, buildOrder){
}
function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats) {
let tooltipinfo = meleeStats[13];
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 = "";
@ -1136,8 +1135,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats) {
for (let i = 8; i < 11; ++i) {
stats[i] = stats[i].toFixed(2);
}
//tooltipelem, tooltiptext
let tooltip; let tooltiptext;
//title
let title_elem = document.createElement("p");
@ -1155,9 +1152,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats) {
let averageDamage = document.createElement("p");
averageDamage.classList.add("left");
averageDamage.textContent = "Average DPS: " + stats[10];
tooltiptext = `= ((${stats[8]} * ${(stats[6][2]).toFixed(2)}) + (${stats[9]} * ${(stats[7][2]).toFixed(2)}))`
tooltip = createTooltip(tooltip, "p", tooltiptext, averageDamage, ["melee-tooltip"]);
averageDamage.appendChild(tooltip);
parent_elem.append(averageDamage);
//overall average DPS
@ -1203,31 +1197,16 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats) {
dmg.textContent = stats[i][0] + " \u2013 " + stats[i][1];
dmg.classList.add(damageClasses[i]);
dmg.classList.add("itemp");
tooltiptext = tooltipinfo.get("damageformulas")[i].slice(0,2).join("\n");
tooltip = createTooltip(tooltip, "p", tooltiptext, dmg, ["melee-tooltip"]);
nonCritStats.append(dmg);
}
}
let normalDamage = document.createElement("p");
normalDamage.textContent = "Total: " + stats[6][0] + " \u2013 " + stats[6][1];
let tooltiparr = ["Min: = ", "Max: = "]
let arr = []; let arr2 = [];
for (let i = 0; i < 6; i++) {
if (stats[i][0] != 0) {
arr.push(stats[i][0]);
arr2.push(stats[i][1]);
}
}
tooltiptext = tooltiparr[0] + arr.join(" + ") + "\n" + tooltiparr[1] + arr2.join(" + ");
tooltip = createTooltip(tooltip, "p", tooltiptext, normalDamage, ["melee-tooltip"]);
nonCritStats.append(normalDamage);
let normalDPS = document.createElement("p");
normalDPS.textContent = "Normal DPS: " + stats[8];
normalDPS.classList.add("tooltip");
tooltiptext = ` = ((${stats[6][0]} + ${stats[6][1]}) / 2) * ${baseDamageMultiplier[stats[11]]}`;
tooltip = createTooltip(tooltip, "p", tooltiptext, normalDPS, ["melee-tooltip"]);
nonCritStats.append(normalDPS);
//overall average DPS
@ -1237,9 +1216,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats) {
let singleHitDamageSecond = document.createElement("span");
singleHitDamageSecond.classList.add("Damage");
singleHitDamageSecond.textContent = stats[12].toFixed(2);
tooltiptext = ` = ((${stats[6][0]} + ${stats[6][1]}) / 2) * ${stats[6][2].toFixed(2)} + ((${stats[7][0]} + ${stats[7][1]}) / 2) * ${stats[7][2].toFixed(2)}`;
// tooltip = createTooltip(tooltip, "p", tooltiptext, singleHitDamage, ["melee-tooltip", "summary-tooltip"]);
singleHitDamage.appendChild(singleHitDamageFirst);
singleHitDamage.appendChild(singleHitDamageSecond);
overallparent_elem.append(singleHitDamage);
@ -1264,30 +1240,15 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats) {
dmg.textContent = stats[i][2] + " \u2013 " + stats[i][3];
dmg.classList.add(damageClasses[i]);
dmg.classList.add("itemp");
tooltiptext = tooltipinfo.get("damageformulas")[i].slice(2,4).join("\n");
tooltip = createTooltip(tooltip, "p", tooltiptext, dmg, ["melee-tooltip"]);
critStats.append(dmg);
}
}
let critDamage = document.createElement("p");
critDamage.textContent = "Total: " + stats[7][0] + " \u2013 " + stats[7][1];
tooltiparr = ["Min: = ", "Max: = "]
arr = []; arr2 = [];
for (let i = 0; i < 6; i++) {
if (stats[i][0] != 0) {
arr.push(stats[i][2]);
arr2.push(stats[i][3]);
}
}
tooltiptext = tooltiparr[0] + arr.join(" + ") + "\n" + tooltiparr[1] + arr2.join(" + ");
tooltip = createTooltip(tooltip, "p", tooltiptext, critDamage, ["melee-tooltip"]);
critStats.append(critDamage);
let critDPS = document.createElement("p");
critDPS.textContent = "Crit DPS: " + stats[9];
tooltiptext = ` = ((${stats[7][0]} + ${stats[7][1]}) / 2) * ${baseDamageMultiplier[stats[11]]}`;
tooltip = createTooltip(tooltip, "p", tooltiptext, critDPS, ["melee-tooltip"]);
critStats.append(critDPS);
let critChance = document.createElement("p");
@ -1343,8 +1304,6 @@ function displayDefenseStats(parent_elem, build, insertSummary){
statsTable.appendChild(hpRow);
}
let tooltip; let tooltiptext;
let defMult = build.statMap.get("defMult");
if (!defMult) {defMult = 1}
@ -1360,9 +1319,6 @@ function displayDefenseStats(parent_elem, build, insertSummary){
boost.textContent = stats[1][0];
boost.classList.add("col");
boost.classList.add("text-end");
tooltiptext = `= ${stats[0]} / ((1 - ${skillPointsToPercentage(build.total_skillpoints[3]).toFixed(3)}) * (1 - ${skillPointsToPercentage(build.total_skillpoints[4]).toFixed(3)}) * (2 - ${defMult}) * (2 - ${build.defenseMultiplier}))`
// tooltip = createTooltip(tooltip, "p", tooltiptext, boost, ["def-tooltip"]);
ehpRow.appendChild(ehp);
ehpRow.append(boost);
@ -1383,12 +1339,13 @@ function displayDefenseStats(parent_elem, build, insertSummary){
boost.textContent = stats[1][1];
boost.classList.add("col");
boost.classList.add("text-end");
tooltiptext = `= ${stats[0]} / ((1 - ${skillPointsToPercentage(build.total_skillpoints[3]).toFixed(3)}) * (2 - ${defMult}) * (2 - ${build.defenseMultiplier}))`
// tooltip = createTooltip(tooltip, "p", tooltiptext, boost, ["def-tooltip"]);
ehpRow.appendChild(ehp);
ehpRow.append(boost);
if (insertSummary) {
parent_elem.appendChild(ehpRow)
} else {
statsTable.append(ehpRow);
}
//total HPR
let hprRow = document.createElement("div");
@ -1424,12 +1381,14 @@ function displayDefenseStats(parent_elem, build, insertSummary){
boost.textContent = stats[3][0];
boost.classList.add("col");
boost.classList.add("text-end");
tooltiptext = `= ${stats[2]} / ((1 - ${skillPointsToPercentage(build.total_skillpoints[3]).toFixed(3)}) * (1 - ${skillPointsToPercentage(build.total_skillpoints[4]).toFixed(3)}) * (2 - ${defMult}) * (2 - ${build.defenseMultiplier}))`
// tooltip = createTooltip(tooltip, "p", tooltiptext, boost, ["def-tooltip"]);
ehprRow.appendChild(ehpr);
ehprRow.append(boost);
statsTable.append(ehprRow);
if (insertSummary) {
parent_elem.appendChild(ehprRow);
} else {
statsTable.appendChild(ehprRow);
}
//eledefs
let eledefs = stats[5];
@ -1461,13 +1420,9 @@ function displayDefenseStats(parent_elem, build, insertSummary){
let defPct = build.statMap.get("defBonus")[i]/100;
if (defRaw < 0) {
defPct >= 0 ? defPct = "- " + defPct: defPct = "+ " + defPct;
tooltiptext = `= min(0, ${defRaw} * (1 ${defPct}))`
} else {
defPct >= 0 ? defPct = "+ " + defPct: defPct = "- " + defPct;
tooltiptext = `= ${defRaw} * (1 ${defPct})`
}
// tooltip = createTooltip(tooltip, "p", tooltiptext, boost, ["def-tooltip"]);
eledefElemRow.appendChild(boost);
if (insertSummary) {

View file

@ -209,8 +209,8 @@ let posModSuffixes = {
/*
* Display commands
*/
let build_overall_display_commands = [
"#table",
let build_all_display_commands = [
"#defense-stats",
"str", "dex", "int", "def", "agi",
"mr", "ms",
"hprRaw", "hprPct",
@ -235,26 +235,51 @@ let build_overall_display_commands = [
"gXp", "gSpd",
];
let item_display_commands = [
"#cdiv",
let build_offensive_display_commands = [
"str", "dex", "int", "def", "agi",
"mr", "ms",
"sdRaw", "sdPct",
"mdRaw", "mdPct",
"ref", "thorns",
"ls",
"poison",
"expd",
"spd",
"atkTier",
"rainbowRaw",
"!elemental",
"fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct",
"!elemental",
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
];
let build_basic_display_commands = [
'#defense-stats',
// defense stats [hp, ehp, hpr, ]
// "sPot", // base * atkspd + spell raws
// melee potential
// "mPot", // melee% * (base * atkspd) + melee raws
"mr", "ms",
"ls",
"poison",
"spd",
"atkTier",
]
let sq2_item_display_commands = [
"displayName",
//"type", //REPLACE THIS WITH SKIN
"#ldiv",
"atkSpd",
"#ldiv",
"!elemental",
"hp",
"nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_",
"!spacer",
"fDef", "wDef", "aDef", "tDef", "eDef",
"!elemental",
"#ldiv",
"classReq",
"lvl",
"strReq", "dexReq", "intReq", "defReq","agiReq",
"#ldiv",
"!spacer",
"str", "dex", "int", "def", "agi",
"#table",
"str", "dex", "int", "def", "agi", //jank lmao
"hpBonus",
"hprRaw", "hprPct",
"sdRaw", "sdPct",
@ -278,11 +303,25 @@ let item_display_commands = [
"spRegen",
"eSteal",
"gXp", "gSpd",
"#ldiv",
"majorIds",
"!spacer",
"slots",
"!spacer",
"set",
"lore",
"quest",
"restrict"
];
let sq2_ing_display_order = [
"displayName", //tier will be displayed w/ name
"!spacer",
"ids",
"!spacer",
"posMods",
"itemIDs",
"consumableIDs",
"!spacer",
"lvl",
"skills",
]

View file

@ -128,7 +128,7 @@ function init_tome_maps() {
tomeIDMap = new Map();
tomeRedirectMap = new Map();
for (const it of tomeTypes) {
for (const it of tome_types) {
tomeLists.set(it, []);
}