fixed spell + powder special boosts not unapplying on updating stats or build.
This commit is contained in:
parent
224f5ad3d2
commit
8754b060be
4 changed files with 94 additions and 30 deletions
44
builder.js
44
builder.js
|
@ -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.
|
||||
*/
|
||||
|
@ -768,8 +773,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);
|
||||
|
|
68
display.js
68
display.js
|
@ -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,54 @@ function displayExpandedItem(item, parent_id){
|
|||
}
|
||||
}
|
||||
|
||||
function displayNextCosts(parent_id, build) {
|
||||
let p_elem = document.getElementById(parent_id);
|
||||
let stats = build.statMap;
|
||||
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("smalltitle");
|
||||
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 = (build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) == 1 ? 1 : build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) - 1);
|
||||
next_cost.classList.add("Mana");
|
||||
let int_needed = document.createElement("b");
|
||||
int_needed.textContent = ": " + (0) + " int"; //DO MATH
|
||||
|
||||
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)){
|
||||
|
@ -1133,16 +1181,12 @@ 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");
|
||||
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 +1314,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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:visible;">
|
||||
<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:hidden;">
|
||||
<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>
|
||||
|
|
|
@ -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;*/
|
||||
|
|
Loading…
Add table
Reference in a new issue