This commit is contained in:
ferricles 2021-02-14 00:01:15 -08:00
commit 4fa951ce23
3 changed files with 56 additions and 28 deletions

View file

@ -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.24"; const BUILD_VERSION = "6.9.27";
function setTitle() { function setTitle() {
let text; let text;

View file

@ -93,7 +93,8 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
// 0th skillpoint is strength, 1st is dex. // 0th skillpoint is strength, 1st is dex.
let str = total_skillpoints[0]; let str = total_skillpoints[0];
let strBoost = 1 + skillPointsToPercentage(str); let strBoost = 1 + skillPointsToPercentage(str);
let staticBoost = (pctModifier / 100.);// + skillPointsToPercentage(str); //let staticBoost = (pctModifier / 100.);
let staticBoost = (pctModifier / 100.) + skillPointsToPercentage(str);
let skillBoost = [0]; let skillBoost = [0];
for (let i in total_skillpoints) { for (let i in total_skillpoints) {
skillBoost.push(skillPointsToPercentage(total_skillpoints[i]) + buildStats.get("damageBonus")[i] / 100.); skillBoost.push(skillPointsToPercentage(total_skillpoints[i]) + buildStats.get("damageBonus")[i] / 100.);
@ -102,14 +103,14 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
for (let i in damages) { for (let i in damages) {
let damageBoost = 1 + skillBoost[i] + staticBoost; let damageBoost = 1 + skillBoost[i] + staticBoost;
damages_results.push([ damages_results.push([
Math.max(damages[i][0] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal min //Math.max(damages[i][0] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal min
Math.max(damages[i][1] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal max //Math.max(damages[i][1] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal max
Math.max(damages[i][0] * strBoost * 2 * Math.max(damageBoost,0) * damageMult, 0), // Crit min //Math.max(damages[i][0] * strBoost * 2 * Math.max(damageBoost,0) * damageMult, 0), // Crit min
Math.max(damages[i][1] * strBoost * 2 * Math.max(damageBoost,0) * damageMult, 0), // Crit max //Math.max(damages[i][1] * strBoost * 2 * Math.max(damageBoost,0) * damageMult, 0), // Crit max
//Math.max(damages[i][0] * Math.max(damageBoost,0) * damageMult, 0), // Normal min Math.max(damages[i][0] * Math.max(damageBoost,0) * damageMult, 0), // Normal min
//Math.max(damages[i][1] * Math.max(damageBoost,0) * damageMult, 0), // Normal max Math.max(damages[i][1] * Math.max(damageBoost,0) * damageMult, 0), // Normal max
//Math.max(damages[i][0] * Math.max(1 + damageBoost, 0) * damageMult, 0), // Crit min Math.max(damages[i][0] * Math.max(1 + damageBoost, 0) * damageMult, 0), // Crit min
//Math.max(damages[i][1] * Math.max(1 + damageBoost, 0) * damageMult, 0), // Crit max Math.max(damages[i][1] * Math.max(1 + damageBoost, 0) * damageMult, 0), // Crit max
]); ]);
totalDamNorm[0] += damages_results[i][0]; totalDamNorm[0] += damages_results[i][0];
totalDamNorm[1] += damages_results[i][1]; totalDamNorm[1] += damages_results[i][1];
@ -117,23 +118,23 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
totalDamCrit[1] += damages_results[i][3]; totalDamCrit[1] += damages_results[i][3];
} }
if (melee) { if (melee) {
totalDamNorm[0] += Math.max(strBoost*rawModifier, -damages_results[0][0]); //totalDamNorm[0] += Math.max(strBoost*rawModifier, -damages_results[0][0]);
totalDamNorm[1] += Math.max(strBoost*rawModifier, -damages_results[0][1]); //totalDamNorm[1] += Math.max(strBoost*rawModifier, -damages_results[0][1]);
totalDamCrit[0] += Math.max(strBoost*2*rawModifier, -damages_results[0][2]); //totalDamCrit[0] += Math.max(strBoost*2*rawModifier, -damages_results[0][2]);
totalDamCrit[1] += Math.max(strBoost*2*rawModifier, -damages_results[0][3]); //totalDamCrit[1] += Math.max(strBoost*2*rawModifier, -damages_results[0][3]);
//totalDamNorm[0] += Math.max(rawModifier, -damages_results[0][0]); totalDamNorm[0] += Math.max(rawModifier, -damages_results[0][0]);
//totalDamNorm[1] += Math.max(rawModifier, -damages_results[0][1]); totalDamNorm[1] += Math.max(rawModifier, -damages_results[0][1]);
//totalDamCrit[0] += Math.max(rawModifier, -damages_results[0][2]); totalDamCrit[0] += Math.max(rawModifier, -damages_results[0][2]);
//totalDamCrit[1] += Math.max(rawModifier, -damages_results[0][3]); totalDamCrit[1] += Math.max(rawModifier, -damages_results[0][3]);
} }
damages_results[0][0] += strBoost*rawModifier; //damages_results[0][0] += strBoost*rawModifier;
damages_results[0][1] += strBoost*rawModifier; //damages_results[0][1] += strBoost*rawModifier;
damages_results[0][2] += strBoost*2*rawModifier; //damages_results[0][2] += strBoost*2*rawModifier;
damages_results[0][3] += strBoost*2*rawModifier; //damages_results[0][3] += strBoost*2*rawModifier;
//damages_results[0][0] += rawModifier; damages_results[0][0] += rawModifier;
//damages_results[0][1] += rawModifier; damages_results[0][1] += rawModifier;
//damages_results[0][2] += rawModifier; damages_results[0][2] += rawModifier;
//damages_results[0][3] += rawModifier; damages_results[0][3] += rawModifier;
if (totalDamNorm[0] < 0) totalDamNorm[0] = 0; if (totalDamNorm[0] < 0) totalDamNorm[0] = 0;
if (totalDamNorm[1] < 0) totalDamNorm[1] = 0; if (totalDamNorm[1] < 0) totalDamNorm[1] = 0;

View file

@ -5,11 +5,15 @@ function calculate_skillpoints(equipment, weapon) {
let fixed = []; let fixed = [];
let consider = []; let consider = [];
let noboost = []; let noboost = [];
let crafted = [];
//console.log(equipment); //console.log(equipment);
for (const item of equipment) { for (const item of equipment) {
if (item.get("reqs").every(x => x === 0)) { if (item.get("reqs").every(x => x === 0)) {
fixed.push(item); fixed.push(item);
} }
else if (item.get("crafted")) {
crafted.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);
@ -96,8 +100,8 @@ function calculate_skillpoints(equipment, weapon) {
let best_total = Infinity; let best_total = Infinity;
let best_activeSetCounts = static_activeSetCounts; let best_activeSetCounts = static_activeSetCounts;
let allFalse = [false, false, false, false, false]; let allFalse = [0, 0, 0, 0, 0];
if (consider.length > 0 || noboost.length > 0) { if (consider.length > 0 || noboost.length > 0 || crafted.length > 0) {
// Try every combination and pick the best one. // Try every combination and pick the best one.
for (let permutation of perm(consider)) { for (let permutation of perm(consider)) {
let activeSetCounts = new Map(static_activeSetCounts); let activeSetCounts = new Map(static_activeSetCounts);
@ -130,6 +134,23 @@ function calculate_skillpoints(equipment, weapon) {
break; break;
} }
} }
// Crafted skillpoint does not count initially.
for (const item of crafted) {
result = apply_to_fit(skillpoints, item, has_skillpoint, activeSetCounts);
needed_skillpoints = result[0];
total_diff = result[1];
for (let i = 0; i < 5; ++i) {
skillpoints_applied[i] += needed_skillpoints[i];
skillpoints[i] += needed_skillpoints[i];
}
}
if (total_applied >= best_total) {
continue;
}
let pre = skillpoints.slice(); let pre = skillpoints.slice();
result = apply_to_fit(skillpoints, weapon, allFalse.slice(), activeSetCounts); result = apply_to_fit(skillpoints, weapon, allFalse.slice(), activeSetCounts);
needed_skillpoints = result[0]; needed_skillpoints = result[0];
@ -142,6 +163,12 @@ function calculate_skillpoints(equipment, weapon) {
apply_skillpoints(skillpoints, weapon, activeSetCounts); apply_skillpoints(skillpoints, weapon, activeSetCounts);
total_applied += total_diff; total_applied += total_diff;
// Applying crafted item skill points last.
for (const item of crafted) {
apply_skillpoints(skillpoints, item, activeSetCounts);
total_applied += total_diff;
}
if (total_applied < best_total) { if (total_applied < best_total) {
best = permutation; best = permutation;
final_skillpoints = skillpoints; final_skillpoints = skillpoints;