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)
</div>
<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>
</div>
</div>
@ -551,6 +552,7 @@
</div>
<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="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>
</div>
</div>
@ -594,6 +596,7 @@
</div>
<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="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>
</div>
</div>
@ -637,6 +640,7 @@
</div>
<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="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>
</div>
</div>
@ -680,6 +684,7 @@
</div>
<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="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>
</div>
</div>

View file

@ -4,7 +4,7 @@ const damageMultipliers = new Map([ ["allytotem", .15], ["yourtotem", .35], ["va
// externalStats should be a map
function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, spellMultiplier, weapon, total_skillpoints, damageMultiplier, externalStats) {
let buildStats = new Map(stats);
let tooltipinfo = new Map();
let tooltipinfo = new Map();
//6x for damages, normal min normal max crit min crit max
let damageformulas = [["Min: = ","Max: = ","Min: = ","Max: = "],["Min: = ","Max: = ","Min: = ","Max: = "],["Min: = ","Max: = ","Min: = ","Max: = "],["Min: = ","Max: = ","Min: = ","Max: = "],["Min: = ","Max: = ","Min: = ","Max: = "],["Min: = ","Max: = ","Min: = ","Max: = "]];

View file

@ -26,7 +26,7 @@ for (let i of skp_order) {
let elem = document.getElementById(i+"-skp");
elem.addEventListener("change", (event) => {
elem.classList.add("highlight");
});
});
editable_elems.push(elem);
}
@ -70,9 +70,6 @@ let powderInputs = [
"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() {
console.log("builder.js init");
init_autocomplete();
@ -653,18 +650,27 @@ function updateArmorPowderSpecials(elem_id) {
//update the label associated w/ the slider
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;
//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;
if (player_build) {
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)]);
armor_powder_boosts[skp_names.indexOf(wynn_elem)] = value;
//update build stats
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;
//calc build stats and display powder special
calculateBuildStats();

View file

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