This commit is contained in:
b 2021-01-15 17:34:23 -06:00
commit 8eb78bbac9
6 changed files with 122 additions and 33 deletions

View file

@ -160,7 +160,7 @@ class Build{
getSpellCost(spellIdx, cost) {
cost = Math.ceil(cost * (1 - skillPointsToPercentage(this.total_skillpoints[2])));
cost += this.statMap.get("spRaw"+spellIdx);
return Math.max(1, Math.floor(cost * (1 + this.statMap.get("spPct"+spellIdx) / 100)))
return Math.max(1, Math.floor(cost * (1 + this.statMap.get("spPct"+spellIdx) / 100)));
}

View file

@ -11,7 +11,7 @@ console.log(url_tag);
* END testing section
*/
const BUILD_VERSION = "6.9.1";
const BUILD_VERSION = "6.9.2";
function setTitle() {
document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (db version "+DB_VERSION+")";
@ -389,10 +389,6 @@ function encodeBuild() {
function calculateBuild(save_skp, skp){
try {
for (const boost of ["vanish", "warscream", "yourtotem", "allytotem", "bash"]) {
let elem = document.getElementById(boost+"-boost");
elem.classList.remove("toggleOn");
}
let specialNames = ["Quake", "Chain_Lightning", "Curse", "Courage", "Air_Prison"];
for (const sName of specialNames) {
for (let i = 1; i < 6; i++) {
@ -417,6 +413,7 @@ function calculateBuild(save_skp, skp){
}
}
if(player_build){
updateBoosts("skip");
updatePowderSpecials("skip");
}
//updatePowderSpecials("skip"); //jank pt 1
@ -508,11 +505,7 @@ function calculateBuild(save_skp, skp){
/* Updates all build statistics based on (for now) the skillpoint input fields and then calculates build stats.
*/
function updateStats() {
//direct copy of the ext buff un-check code from calculateBuild(). Redo if possible.
for (const boost of ["vanish", "warscream", "yourtotem", "allytotem", "bash"]) {
let elem = document.getElementById(boost+"-boost");
elem.classList.remove("toggleOn");
}
let specialNames = ["Quake", "Chain_Lightning", "Curse", "Courage", "Air_Prison"];
for (const sName of specialNames) {
for (let i = 1; i < 6; i++) {
@ -536,9 +529,7 @@ function updateStats() {
}
}
}
if(player_build){
updatePowderSpecials("skip");
}
//WILL BREAK WEBSITE IF NO BUILD HAS BEEN INITIALIZED! @HPP
let skillpoints = player_build.total_skillpoints;
@ -561,12 +552,17 @@ function updateStats() {
}
player_build.assigned_skillpoints += delta_total;
calculateBuildStats();
if(player_build){
updatePowderSpecials("skip");
updateBoosts("skip");
}
}
/* Updates all spell boosts
*/
function updateBoosts(buttonId) {
let elem = document.getElementById(buttonId);
let name = buttonId.split("-")[0];
let elem = document.getElementById(buttonId);
let name = buttonId.split("-")[0];
if(buttonId !== "skip") {
if (elem.classList.contains("toggleOn")) {
player_build.damageMultiplier -= damageMultipliers.get(name);
if (name === "warscream") {
@ -581,6 +577,16 @@ function updateBoosts(buttonId) {
elem.classList.add("toggleOn");
}
updatePowderSpecials("skip"); //jank pt 1
} else {
for (const [key, value] of damageMultipliers) {
let elem = document.getElementById(key + "-boost")
if (elem.classList.contains("toggleOn")) {
elem.classList.remove("toggleOn");
player_build.damageMultiplier -= value;
if (key === "warscream") { player_build.defenseMultiplier -= .10 }
}
}
}
calculateBuildStats();
}
@ -588,6 +594,7 @@ function updateBoosts(buttonId) {
*/
function updatePowderSpecials(buttonId){
//console.log(player_build.statMap);
let name = (buttonId).split("-")[0];
let power = (buttonId).split("-")[1]; // [1, 5]
let specialNames = ["Quake", "Chain Lightning", "Curse", "Courage", "Air Prison"];
@ -666,9 +673,7 @@ function updatePowderSpecials(buttonId){
}
displayPowderSpecials(document.getElementById("powder-special-stats"), powderSpecials, player_build);
if (name !== "skip") {
calculateBuildStats(); //also make damage boosts apply ;-;
}
calculateBuildStats(); //also make damage boosts apply ;-;
}
/* Calculates all build statistics and updates the entire display.
*/
@ -769,8 +774,9 @@ function calculateBuildStats() {
displayExpandedItem(player_build.items[i], buildFields[i]);
}
displayBuildStats(player_build, "build-overall-stats");
displaySetBonuses(player_build, "set-info");
displayBuildStats("build-overall-stats",player_build);
displaySetBonuses("set-info",player_build);
displayNextCosts("int-info",player_build);
let meleeStats = player_build.getMeleeStats();
displayMeleeDamage(document.getElementById("build-melee-stats"), document.getElementById("build-melee-statsAvg"), meleeStats);

View file

@ -99,7 +99,6 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
totalDamCrit[0] += damages_results[i][2];
totalDamCrit[1] += damages_results[i][3];
}
console.log(damages_results);
if (melee) {
totalDamNorm[0] += Math.max(rawModifier, -damages_results[0][0]);
totalDamNorm[1] += Math.max(rawModifier, -damages_results[0][1]);

View file

@ -95,7 +95,7 @@ function apply_elemental_format(p_elem, id, suffix) {
p_elem.appendChild(i_elem2);
}
function displaySetBonuses(build, parent_id) {
function displaySetBonuses(parent_id,build) {
setHTML(parent_id, "");
let parent_div = document.getElementById(parent_id);
@ -134,7 +134,7 @@ function displaySetBonuses(build, parent_id) {
}
}
function displayBuildStats(build, parent_id){
function displayBuildStats(parent_id,build){
// Commands to "script" the creation of nice formatting.
// #commands create a new element.
// !elemental is some janky hack for elemental damage.
@ -556,6 +556,80 @@ function displayExpandedItem(item, parent_id){
}
}
function displayNextCosts(parent_id, build) {
let p_elem = document.getElementById(parent_id);
let int = build.total_skillpoints[2];
let spells = spell_table[build.weapon.get("type")];
p_elem.textContent = "";
let title = document.createElement("p");
title.classList.add("title");
title.classList.add("Normal");
title.textContent = "Next Spell Costs";
let int_title = document.createElement("p");
int_title.classList.add("itemp");
int_title.textContent = int + " Intelligence points.";
p_elem.append(title);
p_elem.append(int_title);
for (const spell of spells) { //warp
let spellp = document.createElement("p");
let spelltitle = document.createElement("p");
spelltitle.classList.add("itemp");
spelltitle.textContent = spell.title;
spellp.appendChild(spelltitle);
let row = document.createElement("p");
row.classList.add("itemp");
let init_cost = document.createElement("b");
init_cost.textContent = build.getSpellCost(spells.indexOf(spell) + 1, spell.cost);
init_cost.classList.add("Mana");
let arrow = document.createElement("b");
arrow.textContent = "\u279C";
let next_cost = document.createElement("b");
next_cost.textContent = (init_cost.textContent === "1" ? 1 : build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) - 1);
next_cost.classList.add("Mana");
let int_needed = document.createElement("b");
if (init_cost.textContent === "1") {
int_needed.textContent = ": n/a (+0)";
}else { //do math
let target = build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) - 1;
let needed = int;
let noUpdate = false;
//forgive me... I couldn't inverse ceil, floor, and max.
while (build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) > target) {
if(needed > 150) {
noUpdate = true;
break;
}
needed++;
build.total_skillpoints[2] = needed;
}
let missing = needed - int;
//in rare circumstances, the next spell cost can jump.
if (noUpdate) {
next_cost.textContent = (init_cost.textContent === "1" ? 1 : build.getSpellCost(spells.indexOf(spell) + 1, spell.cost)-1);
}else {
next_cost.textContent = (init_cost.textContent === "1" ? 1 : build.getSpellCost(spells.indexOf(spell) + 1, spell.cost));
}
build.total_skillpoints[2] = int;//forgive me pt 2
int_needed.textContent = ": " + (needed > 150 ? ">150" : needed) + " int (+" + (needed > 150 ? "n/a" : missing) + ")";
}
row.appendChild(init_cost);
row.appendChild(arrow);
row.appendChild(next_cost);
row.appendChild(int_needed);
spellp.appendChild(row);
p_elem.append(spellp);
}
}
function displayFixedID(active, id, value, elemental_format, style) {
if (style) {
/*if(reversedIDs.filter(e => e !== "atkTier").includes(id)){
@ -1132,17 +1206,13 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell
if (spellIdx != 0) {
title_elem.textContent = spell.title + " (" + build.getSpellCost(spellIdx, spell.cost) + ")";
let first = document.createElement("b");
first.classList.add("space");
let first = document.createElement("b");
first.textContent = spell.title + " (";
title_elemavg.appendChild(first);
let second = document.createElement("b");
second.textContent = build.getSpellCost(spellIdx, spell.cost);
second.classList.add("Legendary");
second.classList.add("Mana");
title_elemavg.appendChild(second);
let third = document.createElement("b");
third.classList.add("Water");
title_elemavg.appendChild(third);
let fourth = document.createElement("b");
fourth.textContent = ")";
title_elemavg.appendChild(fourth);
@ -1270,8 +1340,16 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell
part_div.append(averageLabel);
let overallaverageLabel = document.createElement("p");
overallaverageLabel.textContent = "Average: "+total_damage.toFixed(2);
overallaverageLabel.classList.add("damageSubtitle");
let overallaverageLabelFirst = document.createElement("b");
let overallaverageLabelSecond = document.createElement("b");
overallaverageLabelFirst.textContent = "Average: ";
overallaverageLabelSecond.textContent = total_damage.toFixed(2);
overallaverageLabelSecond.classList.add("Damage");
overallaverageLabel.appendChild(overallaverageLabelFirst);
overallaverageLabel.appendChild(overallaverageLabelSecond);
part_divavg.append(overallaverageLabel);
}
}

View file

@ -551,9 +551,12 @@
</div>
</div>
<div class="misc">
<div class = "center set-info" id = "set-info-div" style = "grid-column:1;grid-row:1; visibility: hidden;">
<div class = "center set-info" id = "set-info-div" style = "grid-column:1;grid-row:1;visibility:hidden;">
<div class = "center" id = "set-info">Set info</div>
</div>
<div class = "center int-info" id = "int-info-div" style = "grid-column:4;grid-row:1;visibility:visible;">
<div class = "center" id = "int-info">Next Spell Costs</div>
</div>
</div>
<div class="center" id="header2">
<p>Made by <b class = "hppeng">hppeng</b> and <b class = "ferricles">ferricles</b> with Atlas Inc (JavaScript required to function, nothing works without js)</p>

View file

@ -78,7 +78,7 @@ a.link{
text-align: left;
}
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order, .build-overall, .build-melee-stats, .build-defense-stats, .spell-info, .set-info, .powder-special, .powder-special-stats {
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order, .build-overall, .build-melee-stats, .build-defense-stats, .spell-info, .set-info, .powder-special, .powder-special-stats, .int-info {
color: #aaa;
background: #121516;
border: 3px solid #BCBCBC;
@ -161,6 +161,9 @@ a.link{
.Neutral:before { content: "\2724" ' '; }
.Damage { color: rgb(255, 198, 85)}
.Mana { color: #5ff;}
.Mana:after { content: "\2749"}
.Health {
color: #a00;
/*text-shadow: 2px 2px 0 #2a0000;*/