From 0b12daa9681cedf1b3a4aa6815735993098b6fdb Mon Sep 17 00:00:00 2001 From: b Date: Sun, 14 Feb 2021 17:33:37 -0600 Subject: [PATCH 1/6] Fix crafted skillpoint (2) --- builder.js | 2 +- skillpoints.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/builder.js b/builder.js index 9bd9b24..f728cf1 100644 --- a/builder.js +++ b/builder.js @@ -2,7 +2,7 @@ const url_tag = location.hash.slice(1); console.log(url_base); console.log(url_tag); -const BUILD_VERSION = "6.9.27"; +const BUILD_VERSION = "6.9.28"; function setTitle() { let text; diff --git a/skillpoints.js b/skillpoints.js index 5213ee0..6559783 100644 --- a/skillpoints.js +++ b/skillpoints.js @@ -8,12 +8,12 @@ function calculate_skillpoints(equipment, weapon) { let crafted = []; //console.log(equipment); for (const item of equipment) { - if (item.get("reqs").every(x => x === 0)) { - fixed.push(item); - } - else if (item.get("crafted")) { + if (item.get("crafted")) { crafted.push(item); } + else if (item.get("reqs").every(x => x === 0)) { + fixed.push(item); + } // TODO hack: We will treat ALL set items as unsafe :( else if (item.get("skillpoints").every(x => x === 0) && item.get("set") === null) { noboost.push(item); @@ -191,6 +191,6 @@ function calculate_skillpoints(equipment, weapon) { apply_skillpoints(final_skillpoints, weapon, best_activeSetCounts); best_total += total_diff; } - let equip_order = fixed.concat(best); + let equip_order = fixed.concat(best).concat(crafted); return [equip_order, best_skillpoints, final_skillpoints, best_total, best_activeSetCounts]; } From f0225a6317969b0acd4e3091b56d6dce5bfe6279 Mon Sep 17 00:00:00 2001 From: b Date: Mon, 15 Feb 2021 11:38:58 -0600 Subject: [PATCH 2/6] Fix powder typos... --- builder.js | 2 +- powders.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builder.js b/builder.js index f728cf1..8664b2b 100644 --- a/builder.js +++ b/builder.js @@ -2,7 +2,7 @@ const url_tag = location.hash.slice(1); console.log(url_base); console.log(url_tag); -const BUILD_VERSION = "6.9.28"; +const BUILD_VERSION = "6.9.29"; function setTitle() { let text; diff --git a/powders.js b/powders.js index 37ffb18..f94634a 100644 --- a/powders.js +++ b/powders.js @@ -25,10 +25,10 @@ function _p(a,b,c,d,e) { return new Powder(a,b,c,d,e); } //bruh moment let powderStats = [ _p(3,6,17,2,1), _p(6,9,21,4,2), _p(8,14,25,8,3), _p(11,16,31,14,5), _p(15,18,38,22,9), _p(18,22,46,30,13), - _p(1,8,9,3,1), _p(1,13,11,5,1), _p(2,18,14,9,2), _p(3,24,17,14,4), _p(3,32,22,20,7), _p(5,40,28,28,10), + _p(1,8,9,3,1), _p(1,13,11,5,1), _p(2,18,13,9,2), _p(3,24,17,14,4), _p(3,32,22,20,7), _p(5,40,28,28,10), _p(3,4,13,3,1), _p(4,7,15,6,1), _p(6,10,17,11,2), _p(8,12,21,18,4), _p(11,14,26,28,7), _p(13,17,32,40,10), _p(2,5,14,3,1), _p(4,8,16,5,2), _p(6,10,19,9,3), _p(9,13,24,16,5), _p(12,16,30,25,9), _p(15,19,37,36,13), - _p(2,6,11,3,1), _p(4,9,14,6,2), _p(7,10,17,10,3), _p(9,13,22,16,5), _p(13,18,28,24,9), _p(16,18,35,34,13) + _p(2,6,11,3,1), _p(4,9,14,6,2), _p(7,10,17,10,3), _p(9,13,22,16,5), _p(13,17,28,24,9), _p(16,18,35,34,13) ]; class PowderIngredient { From 3124f00bce8c2ed38232a580b7ac795928c843f7 Mon Sep 17 00:00:00 2001 From: b Date: Wed, 17 Feb 2021 01:17:09 -0600 Subject: [PATCH 3/6] Morph --- builder.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/builder.js b/builder.js index 8664b2b..fcfcf5f 100644 --- a/builder.js +++ b/builder.js @@ -2,7 +2,7 @@ const url_tag = location.hash.slice(1); console.log(url_base); console.log(url_tag); -const BUILD_VERSION = "6.9.29"; +const BUILD_VERSION = "6.9.30"; function setTitle() { let text; @@ -388,19 +388,6 @@ function calculateBuild(save_skp, skp){ let name = sName.replace("_", " "); if (elem.classList.contains("toggleOn")) { //toggle the pressed button off elem.classList.remove("toggleOn"); - let special = powderSpecialStats[specialNames.indexOf(sName)]; - console.log(special); - if (special["weaponSpecialEffects"].has("Damage Boost")) { - if (name === "Courage" || name === "Curse") { //courage is universal damage boost - //player_build.damageMultiplier -= special.weaponSpecialEffects.get("Damage Boost")[i-1]/100; - player_build.externalStats.set("sdPct", player_build.externalStats.get("sdPct") - special.weaponSpecialEffects.get("Damage Boost")[i-1]); - player_build.externalStats.set("mdPct", player_build.externalStats.get("mdPct") - special.weaponSpecialEffects.get("Damage Boost")[i-1]); - player_build.externalStats.set("poisonPct", player_build.externalStats.get("poisonPct") - special.weaponSpecialEffects.get("Damage Boost")[i-1]); - } else if (name === "Air Prison") { - player_build.externalStats.set("aDamPct", player_build.externalStats.get("aDamPct") - special.weaponSpecialEffects.get("Damage Boost")[i-1]); - player_build.externalStats.get("damageBonus")[4] -= special.weaponSpecialEffects.get("Damage Boost")[i-1]; - } - } } } } @@ -408,6 +395,14 @@ function calculateBuild(save_skp, skp){ updateBoosts("skip", false); updatePowderSpecials("skip", false); } + let weaponName = getValue(equipmentInputs[8]); + if (weaponName.startsWith("Morph-")) { + let equipment = [ "Morph-Stardust", "Morph-Steel", "Morph-Iron", "Morph-Gold", "Morph-Topaz", "Morph-Emerald", "Morph-Amethyst", "Morph-Ruby", weaponName.substring(6) ]; + for (let i in equipment) { + setValue(equipmentInputs[i], equipment[i]); + } + } + //updatePowderSpecials("skip"); //jank pt 1 save_skp = (typeof save_skp !== 'undefined') ? save_skp : false; /* TODO: implement level changing From d4327ef36f7f813c0968df19275ecd6ba7d70714 Mon Sep 17 00:00:00 2001 From: b Date: Wed, 17 Feb 2021 01:49:56 -0600 Subject: [PATCH 4/6] Fix bug with smoke bomb damage --- damage_calc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/damage_calc.js b/damage_calc.js index 77a50e5..82424aa 100644 --- a/damage_calc.js +++ b/damage_calc.js @@ -230,8 +230,8 @@ const spell_table = { { subtitle: "Total Damage", type: "damage", multiplier: 600, conversion: [45, 25, 0, 0, 0, 30], summary: true }, ], CHERRY_BOMBS: [ - { subtitle: "Total Damage (Cherry Bombs)", type: "damage", multiplier: 330, conversion: [45, 25, 0, 0, 0, 30], summary: true }, - { subtitle: "Per Bomb", type: "damage", multiplier: 110, conversion: [45, 25, 0, 0, 0, 30] } + { subtitle: "Total Damage (Cherry Bombs)", type: "damage", multiplier: 330, conversion: [45, 25, 0, 0, 0, 25], summary: true }, + { subtitle: "Per Bomb", type: "damage", multiplier: 110, conversion: [45, 25, 0, 0, 0, 25] } ] } }, ], From 148e9001e99646b5ecef214b670e954125270130 Mon Sep 17 00:00:00 2001 From: b Date: Wed, 17 Feb 2021 12:08:47 -0600 Subject: [PATCH 5/6] Fix rounding error --- damage_calc.js | 16 ++++++++-------- utils.js | 8 ++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/damage_calc.js b/damage_calc.js index 82424aa..af9a22c 100644 --- a/damage_calc.js +++ b/damage_calc.js @@ -36,10 +36,10 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, let conversionRatio = spellConversions[i+1]/100; let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]); let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]); - damages[i+1][0] = Math.floor(damages[i+1][0] + min_diff); - damages[i+1][1] = Math.floor(damages[i+1][1] + max_diff); - neutralRemainingRaw[0] = Math.floor(neutralRemainingRaw[0] - min_diff); - neutralRemainingRaw[1] = Math.floor(neutralRemainingRaw[1] - max_diff); + damages[i+1][0] = Math.floor(round_near(damages[i+1][0] + min_diff)); + damages[i+1][1] = Math.floor(round_near(damages[i+1][1] + max_diff)); + neutralRemainingRaw[0] = Math.floor(round_near(neutralRemainingRaw[0] - min_diff)); + neutralRemainingRaw[1] = Math.floor(round_near(neutralRemainingRaw[1] - max_diff)); } //console.log(damages); let rawBoosts = [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]; @@ -58,10 +58,10 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, if (neutralRemainingRaw[1] > 0) { let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]); let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]); - damages[element+1][0] = Math.floor(damages[element+1][0] + min_diff); - damages[element+1][1] = Math.floor(damages[element+1][1] + max_diff); - neutralRemainingRaw[0] = Math.floor(neutralRemainingRaw[0] - min_diff); - neutralRemainingRaw[1] = Math.floor(neutralRemainingRaw[1] - max_diff); + damages[element+1][0] = Math.floor(round_near(damages[element+1][0] + min_diff)); + damages[element+1][1] = Math.floor(round_near(damages[element+1][1] + max_diff)); + neutralRemainingRaw[0] = Math.floor(round_near(neutralRemainingRaw[0] - min_diff)); + neutralRemainingRaw[1] = Math.floor(round_near(neutralRemainingRaw[1] - max_diff)); } damages[element+1][0] += powder.min; damages[element+1][1] += powder.max; diff --git a/utils.js b/utils.js index 22e89e5..1b3a213 100644 --- a/utils.js +++ b/utils.js @@ -38,6 +38,14 @@ function perm(a){ return r; } +function round_near(value) { + let eps = 0.00000001; + if (Math.abs(value - Math.round(value)) < eps) { + return Math.round(value); + } + return value; +} + function setText(id, text) { document.getElementById(id).textContent = text; } From dbe0585422347bc258ac7da85ef656b9b814d0d6 Mon Sep 17 00:00:00 2001 From: b Date: Wed, 17 Feb 2021 12:11:16 -0600 Subject: [PATCH 6/6] Bump version --- builder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder.js b/builder.js index fcfcf5f..2abe4d6 100644 --- a/builder.js +++ b/builder.js @@ -2,7 +2,7 @@ const url_tag = location.hash.slice(1); console.log(url_base); console.log(url_tag); -const BUILD_VERSION = "6.9.30"; +const BUILD_VERSION = "6.9.31"; function setTitle() { let text;