diff --git a/build.js b/build.js index b6b0e54..70377a9 100644 --- a/build.js +++ b/build.js @@ -190,6 +190,7 @@ class Build{ boots.statMap.set("powders",this.powders[3].slice()); boots.applyPowders(); this.boots = boots.statMap; + console.log(boots); this.craftedItems.push(boots); } catch (Error) { const boots = itemMap.get("No Boots"); @@ -294,6 +295,7 @@ class Build{ errors.push(new ItemNotFound(equipment[8], "weapon", true)); } } + console.log(this.craftedItems) if (level < 1) { //Should these be constants? this.level = 1; diff --git a/build_utils.js b/build_utils.js index cb771e0..d78c3e6 100644 --- a/build_utils.js +++ b/build_utils.js @@ -16,7 +16,7 @@ function skillPointsToPercentage(skp){ /*Turns the input amount of levels into skillpoints available. * -* @param level - the integer level count te be converted +* @param level - the integer level count to be converted */ function levelToSkillPoints(level){ if(level < 1){ diff --git a/builder.js b/builder.js index 9bd9b24..b4d93cc 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.31"; 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 @@ -567,7 +562,7 @@ function updateStats() { } - //WILL BREAK WEBSITE IF NO BUILD HAS BEEN INITIALIZED! @HPP + let skillpoints = player_build.total_skillpoints; let delta_total = 0; for (let i in skp_order) { diff --git a/damage_calc.js b/damage_calc.js index 55951d9..9199453 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]]; @@ -56,17 +56,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]); - //Wynnbuilder version (consistent w/ monster) - damages[element+1][0] = Math.round(damages[element+1][0] + min_diff); - damages[element+1][1] = Math.round(damages[element+1][1] + max_diff); - neutralRemainingRaw[0] = Math.round(neutralRemainingRaw[0] - min_diff); - neutralRemainingRaw[1] = Math.round(neutralRemainingRaw[1] - max_diff); - - //NBCSS version (consistent w/ thrundacrack) - /*damages[element+1][0] = damages[element+1][0] + Math.floor(min_diff); - damages[element+1][1] = damages[element+1][1] + Math.floor(max_diff); - neutralRemainingRaw[0] = neutralRemainingRaw[0] - Math.floor(min_diff); - neutralRemainingRaw[1] = neutralRemainingRaw[1] - Math.floor(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; @@ -239,8 +232,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] } ] } }, ], diff --git a/display.js b/display.js index 9136abe..7b482c5 100644 --- a/display.js +++ b/display.js @@ -397,8 +397,6 @@ function displayBuildStats(parent_id,build){ title.textContent = "Effective Life Steal:" let value = document.createElement("td"); let defStats = build.getDefenseStats(); - console.log(defStats[1][0]); - console.log(defStats[0]); value.textContent = Math.round(defStats[1][0]*id_val/defStats[0]) + "/4s"; value.classList.add("right"); value.classList.add(style); diff --git a/powders.js b/powders.js index ba10720..f2cd0ac 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 { diff --git a/skillpoints.js b/skillpoints.js index 5213ee0..01c3385 100644 --- a/skillpoints.js +++ b/skillpoints.js @@ -6,14 +6,13 @@ function calculate_skillpoints(equipment, weapon) { let consider = []; let noboost = []; 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); @@ -137,7 +136,9 @@ function calculate_skillpoints(equipment, weapon) { // Crafted skillpoint does not count initially. for (const item of crafted) { + console.log(item) result = apply_to_fit(skillpoints, item, has_skillpoint, activeSetCounts); + console.log(result) needed_skillpoints = result[0]; total_diff = result[1]; @@ -166,7 +167,7 @@ function calculate_skillpoints(equipment, weapon) { // Applying crafted item skill points last. for (const item of crafted) { apply_skillpoints(skillpoints, item, activeSetCounts); - total_applied += total_diff; + //total_applied += total_diff; } if (total_applied < best_total) { @@ -191,6 +192,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]; } diff --git a/utils.js b/utils.js index 9437822..4210178 100644 --- a/utils.js +++ b/utils.js @@ -42,6 +42,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; }