appear to have fixed crafted skp bug, needs more testing
This commit is contained in:
commit
87de6f5b7e
8 changed files with 41 additions and 44 deletions
2
build.js
2
build.js
|
@ -190,6 +190,7 @@ class Build{
|
||||||
boots.statMap.set("powders",this.powders[3].slice());
|
boots.statMap.set("powders",this.powders[3].slice());
|
||||||
boots.applyPowders();
|
boots.applyPowders();
|
||||||
this.boots = boots.statMap;
|
this.boots = boots.statMap;
|
||||||
|
console.log(boots);
|
||||||
this.craftedItems.push(boots);
|
this.craftedItems.push(boots);
|
||||||
} catch (Error) {
|
} catch (Error) {
|
||||||
const boots = itemMap.get("No Boots");
|
const boots = itemMap.get("No Boots");
|
||||||
|
@ -294,6 +295,7 @@ class Build{
|
||||||
errors.push(new ItemNotFound(equipment[8], "weapon", true));
|
errors.push(new ItemNotFound(equipment[8], "weapon", true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(this.craftedItems)
|
||||||
|
|
||||||
if (level < 1) { //Should these be constants?
|
if (level < 1) { //Should these be constants?
|
||||||
this.level = 1;
|
this.level = 1;
|
||||||
|
|
|
@ -16,7 +16,7 @@ function skillPointsToPercentage(skp){
|
||||||
|
|
||||||
/*Turns the input amount of levels into skillpoints available.
|
/*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){
|
function levelToSkillPoints(level){
|
||||||
if(level < 1){
|
if(level < 1){
|
||||||
|
|
25
builder.js
25
builder.js
|
@ -2,7 +2,7 @@ const url_tag = location.hash.slice(1);
|
||||||
console.log(url_base);
|
console.log(url_base);
|
||||||
console.log(url_tag);
|
console.log(url_tag);
|
||||||
|
|
||||||
const BUILD_VERSION = "6.9.27";
|
const BUILD_VERSION = "6.9.31";
|
||||||
|
|
||||||
function setTitle() {
|
function setTitle() {
|
||||||
let text;
|
let text;
|
||||||
|
@ -388,19 +388,6 @@ function calculateBuild(save_skp, skp){
|
||||||
let name = sName.replace("_", " ");
|
let name = sName.replace("_", " ");
|
||||||
if (elem.classList.contains("toggleOn")) { //toggle the pressed button off
|
if (elem.classList.contains("toggleOn")) { //toggle the pressed button off
|
||||||
elem.classList.remove("toggleOn");
|
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);
|
updateBoosts("skip", false);
|
||||||
updatePowderSpecials("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
|
//updatePowderSpecials("skip"); //jank pt 1
|
||||||
save_skp = (typeof save_skp !== 'undefined') ? save_skp : false;
|
save_skp = (typeof save_skp !== 'undefined') ? save_skp : false;
|
||||||
/* TODO: implement level changing
|
/* 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 skillpoints = player_build.total_skillpoints;
|
||||||
let delta_total = 0;
|
let delta_total = 0;
|
||||||
for (let i in skp_order) {
|
for (let i in skp_order) {
|
||||||
|
|
|
@ -36,10 +36,10 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
||||||
let conversionRatio = spellConversions[i+1]/100;
|
let conversionRatio = spellConversions[i+1]/100;
|
||||||
let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]);
|
let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]);
|
||||||
let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]);
|
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][0] = Math.floor(round_near(damages[i+1][0] + min_diff));
|
||||||
damages[i+1][1] = Math.floor(damages[i+1][1] + max_diff);
|
damages[i+1][1] = Math.floor(round_near(damages[i+1][1] + max_diff));
|
||||||
neutralRemainingRaw[0] = Math.floor(neutralRemainingRaw[0] - min_diff);
|
neutralRemainingRaw[0] = Math.floor(round_near(neutralRemainingRaw[0] - min_diff));
|
||||||
neutralRemainingRaw[1] = Math.floor(neutralRemainingRaw[1] - max_diff);
|
neutralRemainingRaw[1] = Math.floor(round_near(neutralRemainingRaw[1] - max_diff));
|
||||||
}
|
}
|
||||||
//console.log(damages);
|
//console.log(damages);
|
||||||
let rawBoosts = [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]];
|
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) {
|
if (neutralRemainingRaw[1] > 0) {
|
||||||
let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]);
|
let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]);
|
||||||
let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]);
|
let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]);
|
||||||
//Wynnbuilder version (consistent w/ monster)
|
damages[element+1][0] = Math.floor(round_near(damages[element+1][0] + min_diff));
|
||||||
damages[element+1][0] = Math.round(damages[element+1][0] + min_diff);
|
damages[element+1][1] = Math.floor(round_near(damages[element+1][1] + max_diff));
|
||||||
damages[element+1][1] = Math.round(damages[element+1][1] + max_diff);
|
neutralRemainingRaw[0] = Math.floor(round_near(neutralRemainingRaw[0] - min_diff));
|
||||||
neutralRemainingRaw[0] = Math.round(neutralRemainingRaw[0] - min_diff);
|
neutralRemainingRaw[1] = Math.floor(round_near(neutralRemainingRaw[1] - max_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] += powder.min;
|
damages[element+1][0] += powder.min;
|
||||||
damages[element+1][1] += powder.max;
|
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 },
|
{ subtitle: "Total Damage", type: "damage", multiplier: 600, conversion: [45, 25, 0, 0, 0, 30], summary: true },
|
||||||
],
|
],
|
||||||
CHERRY_BOMBS: [
|
CHERRY_BOMBS: [
|
||||||
{ subtitle: "Total Damage (Cherry Bombs)", type: "damage", multiplier: 330, conversion: [45, 25, 0, 0, 0, 30], summary: true },
|
{ 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, 30] }
|
{ subtitle: "Per Bomb", type: "damage", multiplier: 110, conversion: [45, 25, 0, 0, 0, 25] }
|
||||||
]
|
]
|
||||||
} },
|
} },
|
||||||
],
|
],
|
||||||
|
|
|
@ -397,8 +397,6 @@ function displayBuildStats(parent_id,build){
|
||||||
title.textContent = "Effective Life Steal:"
|
title.textContent = "Effective Life Steal:"
|
||||||
let value = document.createElement("td");
|
let value = document.createElement("td");
|
||||||
let defStats = build.getDefenseStats();
|
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.textContent = Math.round(defStats[1][0]*id_val/defStats[0]) + "/4s";
|
||||||
value.classList.add("right");
|
value.classList.add("right");
|
||||||
value.classList.add(style);
|
value.classList.add(style);
|
||||||
|
|
|
@ -25,10 +25,10 @@ function _p(a,b,c,d,e) { return new Powder(a,b,c,d,e); } //bruh moment
|
||||||
|
|
||||||
let powderStats = [
|
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(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(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,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 {
|
class PowderIngredient {
|
||||||
|
|
|
@ -6,14 +6,13 @@ function calculate_skillpoints(equipment, weapon) {
|
||||||
let consider = [];
|
let consider = [];
|
||||||
let noboost = [];
|
let noboost = [];
|
||||||
let crafted = [];
|
let crafted = [];
|
||||||
//console.log(equipment);
|
|
||||||
for (const item of equipment) {
|
for (const item of equipment) {
|
||||||
if (item.get("reqs").every(x => x === 0)) {
|
if (item.get("crafted")) {
|
||||||
fixed.push(item);
|
|
||||||
}
|
|
||||||
else if (item.get("crafted")) {
|
|
||||||
crafted.push(item);
|
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 :(
|
// TODO hack: We will treat ALL set items as unsafe :(
|
||||||
else if (item.get("skillpoints").every(x => x === 0) && item.get("set") === null) {
|
else if (item.get("skillpoints").every(x => x === 0) && item.get("set") === null) {
|
||||||
noboost.push(item);
|
noboost.push(item);
|
||||||
|
@ -137,7 +136,9 @@ function calculate_skillpoints(equipment, weapon) {
|
||||||
|
|
||||||
// Crafted skillpoint does not count initially.
|
// Crafted skillpoint does not count initially.
|
||||||
for (const item of crafted) {
|
for (const item of crafted) {
|
||||||
|
console.log(item)
|
||||||
result = apply_to_fit(skillpoints, item, has_skillpoint, activeSetCounts);
|
result = apply_to_fit(skillpoints, item, has_skillpoint, activeSetCounts);
|
||||||
|
console.log(result)
|
||||||
needed_skillpoints = result[0];
|
needed_skillpoints = result[0];
|
||||||
total_diff = result[1];
|
total_diff = result[1];
|
||||||
|
|
||||||
|
@ -166,7 +167,7 @@ function calculate_skillpoints(equipment, weapon) {
|
||||||
// Applying crafted item skill points last.
|
// Applying crafted item skill points last.
|
||||||
for (const item of crafted) {
|
for (const item of crafted) {
|
||||||
apply_skillpoints(skillpoints, item, activeSetCounts);
|
apply_skillpoints(skillpoints, item, activeSetCounts);
|
||||||
total_applied += total_diff;
|
//total_applied += total_diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (total_applied < best_total) {
|
if (total_applied < best_total) {
|
||||||
|
@ -191,6 +192,6 @@ function calculate_skillpoints(equipment, weapon) {
|
||||||
apply_skillpoints(final_skillpoints, weapon, best_activeSetCounts);
|
apply_skillpoints(final_skillpoints, weapon, best_activeSetCounts);
|
||||||
best_total += total_diff;
|
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];
|
return [equip_order, best_skillpoints, final_skillpoints, best_total, best_activeSetCounts];
|
||||||
}
|
}
|
||||||
|
|
8
utils.js
8
utils.js
|
@ -42,6 +42,14 @@ function perm(a){
|
||||||
return r;
|
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) {
|
function setText(id, text) {
|
||||||
document.getElementById(id).textContent = text;
|
document.getElementById(id).textContent = text;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue