diff --git a/build.js b/build.js index 5829c61..336e342 100644 --- a/build.js +++ b/build.js @@ -173,7 +173,7 @@ class Build{ } // 0 for melee damage. - let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], stats.get("mdRaw"), stats.get("mdPct"), 0, this.weapon, this.total_skillpoints); + let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], stats.get("mdRaw"), stats.get("mdPct"), 0, this.weapon, this.total_skillpoints, this.damageMultiplier); let dex = this.total_skillpoints[1]; diff --git a/damage_calc.js b/damage_calc.js index 3cfc042..6b2ca75 100644 --- a/damage_calc.js +++ b/damage_calc.js @@ -1,6 +1,7 @@ +const damageMultipliers = new Map([ ["allytotem", .35], ["yourtotem", .35], ["vanish", 0.80], ["warscream", 0.10] ]); // Calculate spell damage given a spell elemental conversion table, and a spell multiplier. // If spell mult is 0, its melee damage and we don't multiply by attack speed. -function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, spellMultiplier, weapon, total_skillpoints) { +function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, spellMultiplier, weapon, total_skillpoints, damageMultiplier) { // Array of neutral + ewtfa damages. Each entry is a pair (min, max). let damages = []; for (const damage_string of stats.get("damageRaw")) { @@ -39,7 +40,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, damages[element+1][1] += powder.max; } - let damageMult = 1; + let damageMult = damageMultiplier; let melee = false; // If we are doing melee calculations: if (spellMultiplier == 0) { @@ -99,6 +100,8 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, return [totalDamNorm, totalDamCrit, damages_results]; } + + const spell_table = { "wand": [ { title: "Heal", cost: 6, parts: [ diff --git a/display.js b/display.js index 6ade78f..6d5f566 100644 --- a/display.js +++ b/display.js @@ -273,7 +273,7 @@ function displayExpandedItem(item, parent_id){ stats.set("atkSpd", item.get("atkSpd")); stats.set("damageBonus", [0, 0, 0, 0, 0]); stats.set("damageRaw", [item.get("nDam"), item.get("eDam"), item.get("tDam"), item.get("wDam"), item.get("fDam"), item.get("aDam")]); - let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0]); + let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0], 1); let damages = results[2]; let damage_keys = [ "nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_" ]; for (const i in damage_keys) { @@ -988,7 +988,7 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell let _results = calculateSpellDamage(stats, part.conversion, stats.get("sdRaw"), stats.get("sdPct"), - part.multiplier / 100, build.weapon, build.total_skillpoints); + part.multiplier / 100, build.weapon, build.total_skillpoints, build.damageMultiplier); let totalDamNormal = _results[0]; let totalDamCrit = _results[1]; let results = _results[2]; diff --git a/index.html b/index.html index 30603ac..f3b7f20 100644 --- a/index.html +++ b/index.html @@ -176,6 +176,37 @@ Summary:

+
+ + +

+ Spell Boosts & Powder Specials: +

+ + + + + + + +
+ + + + + + + +
+
diff --git a/styles.css b/styles.css index 013c115..b8521a5 100644 --- a/styles.css +++ b/styles.css @@ -236,3 +236,8 @@ input { .restrict, .warning { color: #ff8180; } + +button.toggleOn{ + background-color:#0a0; + border: 3 px solid rgb(0, 70, 0); +} \ No newline at end of file diff --git a/test.js b/test.js index 6b8d88f..c96cb42 100644 --- a/test.js +++ b/test.js @@ -345,6 +345,8 @@ function decodeBuild(url_tag) { } } +/* Stores the entire build in a string using B64 encryption and adds it to the URL. +*/ function encodeBuild() { if (player_build) { let build_string = "3_" + Base64.fromIntN(player_build.helmet.get("id"), 3) + @@ -445,6 +447,8 @@ function calculateBuild(save_skp, skp){ } +/* Updates all build statistics based on (for now) the skillpoint input fields and then calculates build stats. +*/ function updateStats() { //WILL BREAK WEBSITE IF NO BUILD HAS BEEN INITIALIZED! @HPP let skillpoints = player_build.total_skillpoints; @@ -459,9 +463,26 @@ function updateStats() { player_build.assigned_skillpoints += delta_total; calculateBuildStats(); } +/* Updates all external boosts (boosts from spells + powders) +*/ +function updateBoosts(buttonId) { + let elem = document.getElementById(buttonId); + if (elem.classList.contains("toggleOn")) { + player_build.damageMultiplier -= damageMultipliers.get(buttonId.split("-")[0]); + elem.classList.remove("toggleOn"); + elem.classList.add("toggleOff"); + }else{ + player_build.damageMultiplier += damageMultipliers.get(buttonId.split("-")[0]); + elem.classList.remove("toggleOff"); + elem.classList.add("toggleOn"); + } + //displayPowderBoosts(); TODO WRITE + calculateBuildStats(); +} +/* Calculates all build statistics and updates the entire display. +*/ function calculateBuildStats() { - const assigned = player_build.base_skillpoints; const skillpoints = player_build.total_skillpoints; let skp_effects = ["% more damage dealt.","% chance to crit.","% spell cost reduction.","% less damage taken.","% chance to dodge."]; diff --git a/utils.js b/utils.js index 25b29f6..912a2b5 100644 --- a/utils.js +++ b/utils.js @@ -119,7 +119,7 @@ function rawToPct(raw, pct){ if (raw < 0){ final = (Math.min(0, raw - (raw * pct) )); }else if(raw > 0){ - final = (Math.max(0, raw + (raw * pct))); + final = raw + (raw * pct); }else{ //do nothing - final's already 0 } return final;