passive powder special boost functionality????

This commit is contained in:
ferricles 2022-05-13 21:23:54 -07:00
parent 652991067f
commit e24da1c358
4 changed files with 26 additions and 11 deletions

View file

@ -507,7 +507,8 @@
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" min = '0' max = '396' value = '0' step = '1' onchange = "updateArmorPowderSpecials('str_boost_armor')"> <input type = "range" class = "e_slider" id = "str_boost_armor" name = "str-boost-armor" min = '0' max = '400' value = '0' step = '1' onchange = "updateArmorPowderSpecials('str_boost_armor')">
<input type="text" id="str_boost_armor_prev" 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>
</div> </div>
@ -551,6 +552,7 @@
</div> </div>
<div class="col"> <div class="col">
<input type = "range" class = "t_slider" id = "dex_boost_armor" name = "dex-boost-armor" 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" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('dex_boost_armor')">
<input type="text" id="dex_boost_armor_prev" 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>
</div> </div>
@ -594,6 +596,7 @@
</div> </div>
<div class="col"> <div class="col">
<input type = "range" class = "w_slider" id = "int_boost_armor" name = "dex-boost-armor" 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" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('int_boost_armor')">
<input type="text" id="int_boost_armor_prev" 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>
</div> </div>
@ -637,6 +640,7 @@
</div> </div>
<div class="col"> <div class="col">
<input type = "range" class = "f_slider" id = "def_boost_armor" name = "def-boost-armor" 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" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('def_boost_armor')">
<input type="text" id="def_boost_armor_prev" 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>
</div> </div>
@ -680,6 +684,7 @@
</div> </div>
<div class="col"> <div class="col">
<input type = "range" class = "a_slider" id = "agi_boost_armor" name = "agi-boost-armor" 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" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('agi_boost_armor')">
<input type="text" id="agi_boost_armor_prev" 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>
</div> </div>

View file

@ -70,9 +70,6 @@ let powderInputs = [
"weapon-powder", "weapon-powder",
]; ];
//keeps track of the armor powder special sliders. Needed for math. Assumes everything starts at 0.
armor_powder_boosts = [0, 0, 0, 0, 0];
function init() { function init() {
console.log("builder.js init"); console.log("builder.js init");
init_autocomplete(); init_autocomplete();
@ -653,18 +650,27 @@ function updateArmorPowderSpecials(elem_id) {
//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 prev_label = document.getElementById(elem_id + "_prev");
let value = elem.value; 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;
let label = document.getElementById(elem_id + "_label");
label.textContent = label.textContent.split(":")[0] + ": " + value; label.textContent = label.textContent.split(":")[0] + ": " + value;
if (player_build) { if (player_build) {
let dmg_id = elem_chars[skp_names.indexOf(wynn_elem)] + "DamPct"; let dmg_id = elem_chars[skp_names.indexOf(wynn_elem)] + "DamPct";
let new_dmgboost = player_build.externalStats.get(dmg_id) + (value - armor_powder_boosts[skp_names.indexOf(wynn_elem)]); let new_dmgboost = player_build.externalStats.get(dmg_id) + value_diff;
armor_powder_boosts[skp_names.indexOf(wynn_elem)] = value;
//update build stats //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.set(dmg_id, new_dmgboost);
player_build.externalStats.get("damageBonus")[skp_names.indexOf(wynn_elem)] = new_dmgboost;
//calc build stats and display powder special //calc build stats and display powder special
calculateBuildStats(); calculateBuildStats();

View file

@ -41,7 +41,7 @@ function displaysq2BuildStats(parent_id,build,command_group){
// id instruction // id instruction
else { else {
let id = command; let id = command;
if (stats.get(id)) { if (stats.get(id) || build.externalStats.get(id)) {
let style = null; let style = null;
// TODO: add pos and neg style // TODO: add pos and neg style
@ -54,6 +54,10 @@ function displaysq2BuildStats(parent_id,build,command_group){
// ignore // ignore
let id_val = stats.get(id); let id_val = stats.get(id);
if (build.externalStats.has(id)) {
id_val += build.externalStats.get(id);
}
if (reversedIDs.includes(id)) { if (reversedIDs.includes(id)) {
style === "positive" ? style = "negative" : style = "positive"; style === "positive" ? style = "negative" : style = "positive";
} }