total armor powder special reset on weapon change
This commit is contained in:
parent
0684e5f8bd
commit
b1c4a5e8ed
3 changed files with 64 additions and 37 deletions
|
@ -507,7 +507,7 @@
|
||||||
Rage (Passive)
|
Rage (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "e_slider" id = "str_boost_armor" name = "str-boost-armor" autocomplete = "off" min = '0' max = '400' value = '0' step = '1' onchange = "updateArmorPowderSpecials('str_boost_armor')">
|
<input type = "range" class = "e_slider" id = "str_boost_armor" name = "str-boost-armor" autocomplete = "off" min = '0' max = '400' value = '0' step = '1' onchange = "updateArmorPowderSpecials('str_boost_armor', true)">
|
||||||
<input type="text" id="str_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
<input type="text" id="str_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "str_boost_armor_label" for="str-boost-armor">% Earth Dmg Boost: 0</label>
|
<label id = "str_boost_armor_label" for="str-boost-armor">% Earth Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -551,7 +551,7 @@
|
||||||
Kill Streak (Passive)
|
Kill Streak (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "t_slider" id = "dex_boost_armor" name = "dex-boost-armor" autocomplete = "off" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('dex_boost_armor')">
|
<input type = "range" class = "t_slider" id = "dex_boost_armor" name = "dex-boost-armor" autocomplete = "off" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('dex_boost_armor', true)">
|
||||||
<input type="text" id="dex_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
<input type="text" id="dex_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "dex_boost_armor_label" for="dex-boost-armor">% Thunder Dmg Boost: 0</label>
|
<label id = "dex_boost_armor_label" for="dex-boost-armor">% Thunder Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -595,7 +595,7 @@
|
||||||
Concentration (Passive)
|
Concentration (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "w_slider" id = "int_boost_armor" name = "dex-boost-armor" autocomplete = "off" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('int_boost_armor')">
|
<input type = "range" class = "w_slider" id = "int_boost_armor" name = "dex-boost-armor" autocomplete = "off" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('int_boost_armor', true)">
|
||||||
<input type="text" id="int_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
<input type="text" id="int_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "int_boost_armor_label" for="dex-boost-armor">% Water Dmg Boost: 0</label>
|
<label id = "int_boost_armor_label" for="dex-boost-armor">% Water Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -639,7 +639,7 @@
|
||||||
Endurance (Passive)
|
Endurance (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "f_slider" id = "def_boost_armor" name = "def-boost-armor" autocomplete = "off" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('def_boost_armor')">
|
<input type = "range" class = "f_slider" id = "def_boost_armor" name = "def-boost-armor" autocomplete = "off" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('def_boost_armor', true)">
|
||||||
<input type="text" id="def_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
<input type="text" id="def_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "def_boost_armor_label" for="def-boost-armor">% Fire Dmg Boost: 0</label>
|
<label id = "def_boost_armor_label" for="def-boost-armor">% Fire Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -683,7 +683,7 @@
|
||||||
Dodge (Passive)
|
Dodge (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "a_slider" id = "agi_boost_armor" name = "agi-boost-armor" autocomplete = "off" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('agi_boost_armor')">
|
<input type = "range" class = "a_slider" id = "agi_boost_armor" name = "agi-boost-armor" autocomplete = "off" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('agi_boost_armor', true)">
|
||||||
<input type="text" id="agi_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
<input type="text" id="agi_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "agi_boost_armor_label" for="agi-boost-armor">% Air Dmg Boost: 0</label>
|
<label id = "agi_boost_armor_label" for="agi-boost-armor">% Air Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,6 +24,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector("#level-choice").setAttribute("oninput", "calcBuildSchedule()")
|
document.querySelector("#level-choice").setAttribute("oninput", "calcBuildSchedule()")
|
||||||
|
document.querySelector("#weapon-choice").setAttribute("oninput", document.querySelector("#weapon-choice").getAttribute("oninput") + "resetArmorPowderSpecials();");
|
||||||
|
|
||||||
|
|
||||||
let skp_fields = document.getElementsByClassName("skp-update");
|
let skp_fields = document.getElementsByClassName("skp-update");
|
||||||
|
|
||||||
|
@ -41,7 +43,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
margin: {
|
margin: {
|
||||||
x: 20,
|
x: 20,
|
||||||
y: 20,
|
y: 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -500,6 +500,7 @@ function updateStats() {
|
||||||
player_build.assigned_skillpoints += delta_total;
|
player_build.assigned_skillpoints += delta_total;
|
||||||
if(player_build){
|
if(player_build){
|
||||||
updatePowderSpecials("skip", false);
|
updatePowderSpecials("skip", false);
|
||||||
|
updateArmorPowderSpecials("skip", false);
|
||||||
updateBoosts("skip", false);
|
updateBoosts("skip", false);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -645,43 +646,67 @@ function updatePowderSpecials(buttonId, recalcStats) {
|
||||||
|
|
||||||
/* Updates PASSIVE powder special boosts (armors)
|
/* Updates PASSIVE powder special boosts (armors)
|
||||||
*/
|
*/
|
||||||
function updateArmorPowderSpecials(elem_id) {
|
function updateArmorPowderSpecials(elem_id, recalc_stats) {
|
||||||
console.log(player_build);
|
|
||||||
//we only update the powder special + external stats if the player has a build
|
//we only update the powder special + external stats if the player has a build
|
||||||
if (player_build !== undefined) {
|
if (elem_id !== "skip") {
|
||||||
let wynn_elem = elem_id.split("_")[0]; //str, dex, int, def, agi
|
if (player_build !== undefined && player_build.weapon !== undefined && player_build.weapon.get("name") !== "No Weapon") {
|
||||||
|
let wynn_elem = elem_id.split("_")[0]; //str, dex, int, def, agi
|
||||||
|
|
||||||
//update the label associated w/ the slider
|
//update the label associated w/ the slider
|
||||||
let elem = document.getElementById(elem_id);
|
let elem = document.getElementById(elem_id);
|
||||||
let label = document.getElementById(elem_id + "_label");
|
let label = document.getElementById(elem_id + "_label");
|
||||||
let prev_label = document.getElementById(elem_id + "_prev");
|
let prev_label = document.getElementById(elem_id + "_prev");
|
||||||
|
|
||||||
let value = elem.value;
|
|
||||||
|
|
||||||
//for use in editing build stats
|
|
||||||
let prev_value = prev_label.value;
|
|
||||||
let value_diff = value - prev_value;
|
|
||||||
|
|
||||||
//update the "previous" label
|
|
||||||
prev_label.value = value;
|
|
||||||
|
|
||||||
label.textContent = label.textContent.split(":")[0] + ": " + value;
|
|
||||||
|
|
||||||
let dmg_id = elem_chars[skp_names.indexOf(wynn_elem)] + "DamPct";
|
|
||||||
let new_dmgboost = player_build.externalStats.get(dmg_id) + value_diff;
|
|
||||||
|
|
||||||
//update build external stats - the second one is the relevant one for damage calc purposes
|
|
||||||
player_build.externalStats.set(dmg_id, new_dmgboost);
|
|
||||||
player_build.externalStats.get("damageBonus")[skp_names.indexOf(wynn_elem)] = new_dmgboost;
|
|
||||||
|
|
||||||
|
let value = elem.value;
|
||||||
|
|
||||||
|
//for use in editing build stats
|
||||||
|
let prev_value = prev_label.value;
|
||||||
|
let value_diff = value - prev_value;
|
||||||
|
|
||||||
|
//update the "previous" label
|
||||||
|
prev_label.value = value;
|
||||||
|
|
||||||
|
label.textContent = label.textContent.split(":")[0] + ": " + value;
|
||||||
|
|
||||||
|
let dmg_id = elem_chars[skp_names.indexOf(wynn_elem)] + "DamPct";
|
||||||
|
let new_dmgboost = player_build.externalStats.get(dmg_id) + value_diff;
|
||||||
|
|
||||||
|
//update build external stats - the second one is the relevant one for damage calc purposes
|
||||||
|
player_build.externalStats.set(dmg_id, new_dmgboost);
|
||||||
|
player_build.externalStats.get("damageBonus")[skp_names.indexOf(wynn_elem)] = new_dmgboost;
|
||||||
|
|
||||||
|
//update the slider's graphics
|
||||||
|
let bg_color = elem_colors[skp_names.indexOf(wynn_elem)];
|
||||||
|
let pct = Math.round(100 * value / powderSpecialStats[skp_names.indexOf(wynn_elem)].cap);
|
||||||
|
elem.style.background = `linear-gradient(to right, ${bg_color}, ${bg_color} ${pct}%, #AAAAAA ${pct}%, #AAAAAA 100%)`;
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < skp_names.length; ++i) {
|
||||||
|
skp_name = skp_names[i];
|
||||||
|
skp_char = elem_chars[i];
|
||||||
|
build.externalStats.set(skp_char + "DamPct", build.externalStats.get(skp_char + "DamPct") - document.getElementById(skp_name+"_boost_armor").value);
|
||||||
|
build.externalStats.get("damageBonus")[i] -= document.getElementById(skp_name+"_boost_armor").value;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (recalc_stats) {
|
||||||
//calc build stats and display powder special
|
//calc build stats and display powder special
|
||||||
calculateBuildStats();
|
calculateBuildStats();
|
||||||
// displaysq2PowderSpecials(document.getElementById("powder-special-stats"), powderSpecials, player_build, true);
|
// displaysq2PowderSpecials(document.getElementById("powder-special-stats"), powderSpecials, player_build, true);
|
||||||
|
}
|
||||||
//update the slider's graphics
|
|
||||||
let bg_color = elem_colors[skp_names.indexOf(wynn_elem)];
|
}
|
||||||
let pct = Math.round(100 * value / powderSpecialStats[skp_names.indexOf(wynn_elem)].cap);
|
|
||||||
elem.style.background = `linear-gradient(to right, ${bg_color}, ${bg_color} ${pct}%, #AAAAAA ${pct}%, #AAAAAA 100%)`;
|
function resetArmorPowderSpecials() {
|
||||||
|
for (const skp of skp_names) {
|
||||||
|
document.getElementById(skp + "_boost_armor").value = 0;
|
||||||
|
document.getElementById(skp + "_boost_armor_prev").value = 0;
|
||||||
|
|
||||||
|
document.getElementById(skp + "_boost_armor").style.background = `linear-gradient(to right, #AAAAAA, #AAAAAA 0%, #AAAAAA 100%)`;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue