Shift defense stats around a bit

This commit is contained in:
b 2021-01-11 16:25:55 -06:00
commit 10fab55aa2
3 changed files with 86 additions and 51 deletions

View file

@ -27,7 +27,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
// Bitwise to force conversion to integer (integer division). // Bitwise to force conversion to integer (integer division).
const element = (powderID/6) | 0; const element = (powderID/6) | 0;
let conversionRatio = powder.convert/100; let conversionRatio = powder.convert/100;
if (neutralRemainingRaw[0] > 0) { if (neutralRemainingRaw[1] > 0) {
let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]); let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]);
let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]); let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]);
damages[element+1][0] = Math.floor(damages[element+1][0] + min_diff); damages[element+1][0] = Math.floor(damages[element+1][0] + min_diff);

View file

@ -130,18 +130,16 @@ function displayBuildStats(build, parent_id){
// normals just display a thing. // normals just display a thing.
let display_commands = [ let display_commands = [
"#ldiv", // "#ldiv",
"!elemental", // "!elemental",
"hp", // "hp",
"fDef", "wDef", "aDef", "tDef", "eDef", // "fDef", "wDef", "aDef", "tDef", "eDef",
"!elemental", // "!elemental",
"#table", "#table",
"str", "dex", "int", "def", "agi", "mr", "ms",
"hpBonus", // "hprRaw", "hprPct",
"hprRaw", "hprPct",
"sdRaw", "sdPct", "sdRaw", "sdPct",
"mdRaw", "mdPct", "mdRaw", "mdPct",
"mr", "ms",
"ref", "thorns", "ref", "thorns",
"ls", "ls",
"poison", "poison",
@ -150,7 +148,7 @@ function displayBuildStats(build, parent_id){
"atkTier", "atkTier",
"!elemental", "!elemental",
"fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct",
"fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", // "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct",
"!elemental", "!elemental",
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
"rainbowRaw", "rainbowRaw",
@ -189,8 +187,10 @@ function displayBuildStats(build, parent_id){
} }
} }
displayDefenseStats(parent_div, build, true);
let stats = build.statMap; let stats = build.statMap;
console.log(build.statMap); //console.log(build.statMap);
let active_elem; let active_elem;
let elemental_format = false; let elemental_format = false;
@ -231,7 +231,7 @@ function displayBuildStats(build, parent_id){
} }
} }
let id_val = stats.get(id); let id_val = stats.get(id);
if(reversedIDs.filter(e => e !== "atkTier").includes(id)){ if (reversedIDs.filter(e => e !== "atkTier").includes(id)) {
style === "positive" ? style = "negative" : style = "positive"; style === "positive" ? style = "negative" : style = "positive";
} }
displayFixedID(active_elem, id, id_val, elemental_format, style); displayFixedID(active_elem, id, id_val, elemental_format, style);
@ -744,15 +744,45 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
parent_elem.append(critStats); parent_elem.append(critStats);
} }
function displayDefenseStats(parent_elem,defenseStats){ function displayDefenseStats(parent_elem, build, insertSummary){
parent_elem.textContent = ""; let defenseStats = build.getDefenseStats();
insertSummary = (typeof insertSummary !== 'undefined') ? insertSummary : false;
if (!insertSummary) {
parent_elem.textContent = "";
}
const stats = defenseStats.slice(); const stats = defenseStats.slice();
let title_elem = document.createElement("p");
title_elem.textContent = "Defense Stats"; if (!insertSummary) {
title_elem.classList.add("title"); let title_elem = document.createElement("p");
title_elem.classList.add("Normal"); title_elem.textContent = "Defense Stats";
title_elem.classList.add("itemp"); title_elem.classList.add("title");
parent_elem.append(title_elem); title_elem.classList.add("Normal");
title_elem.classList.add("itemp");
parent_elem.append(title_elem);
let base_stat_elem = document.createElement("p");
base_stat_elem.id = "base-stat";
parent_elem.append(base_stat_elem);
let mock_item = new Map();
mock_item.set("fixID", true);
let mock_minRolls = new Map();
mock_item.set("minRolls", mock_minRolls);
const stats = ["hp", "hpBonus", "fDef", "wDef", "aDef", "tDef", "eDef",
"fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct"];
for (const stat of stats) {
if (rolledIDs.includes(stat)) {
mock_minRolls.set(stat, build.statMap.get(stat));
}
else {
mock_item.set(stat, build.statMap.get(stat));
}
}
mock_item.set("powders", []);
displayExpandedItem(mock_item, base_stat_elem.id);
}
parent_elem.append(document.createElement("br")); parent_elem.append(document.createElement("br"));
let statsTable = document.createElement("table"); let statsTable = document.createElement("table");
statsTable.classList.add("itemtable"); statsTable.classList.add("itemtable");
@ -767,12 +797,13 @@ function displayDefenseStats(parent_elem,defenseStats){
} }
} }
} }
//total HP //total HP
let hpRow = document.createElement("tr"); let hpRow = document.createElement("tr");
let hp = document.createElement("td"); let hp = document.createElement("td");
hp.classList.add("Health"); hp.classList.add("Health");
hp.classList.add("left"); hp.classList.add("left");
hp.textContent = "HP:"; hp.textContent = "Total HP:";
let boost = document.createElement("td"); let boost = document.createElement("td");
boost.textContent = stats[0]; boost.textContent = stats[0];
boost.classList.add("right"); boost.classList.add("right");
@ -780,6 +811,7 @@ function displayDefenseStats(parent_elem,defenseStats){
hpRow.appendChild(hp); hpRow.appendChild(hp);
hpRow.append(boost); hpRow.append(boost);
statsTable.appendChild(hpRow); statsTable.appendChild(hpRow);
//EHP //EHP
let ehpRow = document.createElement("tr"); let ehpRow = document.createElement("tr");
let ehp = document.createElement("td"); let ehp = document.createElement("td");
@ -812,7 +844,7 @@ function displayDefenseStats(parent_elem,defenseStats){
let hpr = document.createElement("td"); let hpr = document.createElement("td");
hpr.classList.add("Health"); hpr.classList.add("Health");
hpr.classList.add("left"); hpr.classList.add("left");
hpr.textContent = "HP Regen:"; hpr.textContent = "HP Regen (Total):";
boost = document.createElement("td"); boost = document.createElement("td");
boost.textContent = stats[2]; boost.textContent = stats[2];
boost.classList.add("right"); boost.classList.add("right");
@ -820,7 +852,7 @@ function displayDefenseStats(parent_elem,defenseStats){
hprRow.appendChild(hpr); hprRow.appendChild(hpr);
hprRow.appendChild(boost); hprRow.appendChild(boost);
statsTable.appendChild(hprRow); statsTable.appendChild(hprRow);
//EHPR /*//EHPR
let ehprRow = document.createElement("tr"); let ehprRow = document.createElement("tr");
let ehpr = document.createElement("td"); let ehpr = document.createElement("td");
ehpr.classList.add("left"); ehpr.classList.add("left");
@ -845,7 +877,8 @@ function displayDefenseStats(parent_elem,defenseStats){
ehprRow.appendChild(ehpr); ehprRow.appendChild(ehpr);
ehprRow.append(boost); ehprRow.append(boost);
statsTable.append(ehprRow); statsTable.append(ehprRow);*/
//eledefs //eledefs
let eledefs = stats[5]; let eledefs = stats[5];
for (let i = 0; i < eledefs.length; i++){ for (let i = 0; i < eledefs.length; i++){
@ -858,7 +891,7 @@ function displayDefenseStats(parent_elem,defenseStats){
eledefTitle.classList.add(damageClasses[i+1]); eledefTitle.classList.add(damageClasses[i+1]);
let defense = document.createElement("b"); let defense = document.createElement("b");
defense.textContent = " Def: "; defense.textContent = " Def (Total): ";
eledef.appendChild(eledefTitle); eledef.appendChild(eledefTitle);
eledef.appendChild(defense); eledef.appendChild(defense);
@ -871,28 +904,31 @@ function displayDefenseStats(parent_elem,defenseStats){
statsTable.appendChild(eledefElemRow); statsTable.appendChild(eledefElemRow);
} }
//skp
let defRow = document.createElement("tr");
let defElem = document.createElement("td");
defElem.classList.add("left");
defElem.textContent = "Damage Absorbed %:";
boost = document.createElement("td");
boost.classList.add("right");
boost.textContent = stats[4][0] + "%";
defRow.appendChild(defElem);
defRow.appendChild(boost);
statsTable.append(defRow);
let agiRow = document.createElement("tr"); if (!insertSummary) {
let agiElem = document.createElement("td"); //skp
agiElem.classList.add("left"); let defRow = document.createElement("tr");
agiElem.textContent = "Dodge Chance %:"; let defElem = document.createElement("td");
boost = document.createElement("td"); defElem.classList.add("left");
boost.classList.add("right"); defElem.textContent = "Damage Absorbed %:";
boost.textContent = stats[4][1] + "%"; boost = document.createElement("td");
agiRow.appendChild(agiElem); boost.classList.add("right");
agiRow.appendChild(boost); boost.textContent = stats[4][0] + "%";
statsTable.append(agiRow); defRow.appendChild(defElem);
defRow.appendChild(boost);
statsTable.append(defRow);
let agiRow = document.createElement("tr");
let agiElem = document.createElement("td");
agiElem.classList.add("left");
agiElem.textContent = "Dodge Chance %:";
boost = document.createElement("td");
boost.classList.add("right");
boost.textContent = stats[4][1] + "%";
agiRow.appendChild(agiElem);
agiRow.appendChild(boost);
statsTable.append(agiRow);
}
parent_elem.append(statsTable); parent_elem.append(statsTable);
} }
@ -1003,7 +1039,7 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell
save_damages.push(averageDamage); save_damages.push(averageDamage);
} }
else if (part.type === "heal") { else if (part.type === "heal") {
let heal_amount = (part.strength * build.getDefenseStats()[0] * Math.max(0.5,Math.min(1.75, 1 + 0.5 * stats.get("wDamPct")/100)).toFixed(2)); let heal_amount = (part.strength * build.getDefenseStats()[0] * Math.max(0.5,Math.min(1.75, 1 + 0.5 * stats.get("wDamPct")/100))).toFixed(2);
let healLabel = document.createElement("p"); let healLabel = document.createElement("p");
healLabel.textContent = heal_amount; healLabel.textContent = heal_amount;
healLabel.classList.add("damagep"); healLabel.classList.add("damagep");

View file

@ -11,7 +11,7 @@ console.log(url_tag);
* END testing section * END testing section
*/ */
const BUILD_VERSION = "6.3"; const BUILD_VERSION = "6.5";
document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (db version "+DB_VERSION+")"; document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (db version "+DB_VERSION+")";
@ -566,8 +566,7 @@ function calculateBuildStats() {
let meleeStats = player_build.getMeleeStats(); let meleeStats = player_build.getMeleeStats();
displayMeleeDamage(document.getElementById("build-melee-stats"), document.getElementById("build-melee-statsAvg"), meleeStats); displayMeleeDamage(document.getElementById("build-melee-stats"), document.getElementById("build-melee-statsAvg"), meleeStats);
let defenseStats = player_build.getDefenseStats(); displayDefenseStats(document.getElementById("build-defense-stats"),player_build);
displayDefenseStats(document.getElementById("build-defense-stats"),defenseStats);
displayPoisonDamage(document.getElementById("build-poison-stats"),player_build); displayPoisonDamage(document.getElementById("build-poison-stats"),player_build);