From e24da1c358b4c80f0553d6fcb17f40e2d6896a56 Mon Sep 17 00:00:00 2001 From: ferricles Date: Fri, 13 May 2022 21:23:54 -0700 Subject: [PATCH] passive powder special boost functionality???? --- builder/index.html | 7 ++++++- js/damage_calc.js | 2 +- js/sq2builder.js | 22 ++++++++++++++-------- js/sq2display.js | 6 +++++- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/builder/index.html b/builder/index.html index de7d513..207cc52 100644 --- a/builder/index.html +++ b/builder/index.html @@ -507,7 +507,8 @@ Rage (Passive)
- + +
@@ -551,6 +552,7 @@
+
@@ -594,6 +596,7 @@
+
@@ -637,6 +640,7 @@
+
@@ -680,6 +684,7 @@
+
diff --git a/js/damage_calc.js b/js/damage_calc.js index f27e9d0..564ab2e 100644 --- a/js/damage_calc.js +++ b/js/damage_calc.js @@ -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: = "]]; diff --git a/js/sq2builder.js b/js/sq2builder.js index b8f1521..24074ee 100644 --- a/js/sq2builder.js +++ b/js/sq2builder.js @@ -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(); diff --git a/js/sq2display.js b/js/sq2display.js index 794b73c..4bdce78 100644 --- a/js/sq2display.js +++ b/js/sq2display.js @@ -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"; }