Merge branch 'dev' of https://github.com/hppeng-wynn/hppeng-wynn.github.io into dev
This commit is contained in:
commit
4fa951ce23
3 changed files with 56 additions and 28 deletions
|
@ -2,7 +2,7 @@ const url_tag = location.hash.slice(1);
|
|||
console.log(url_base);
|
||||
console.log(url_tag);
|
||||
|
||||
const BUILD_VERSION = "6.9.24";
|
||||
const BUILD_VERSION = "6.9.27";
|
||||
|
||||
function setTitle() {
|
||||
let text;
|
||||
|
|
|
@ -93,7 +93,8 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
|||
// 0th skillpoint is strength, 1st is dex.
|
||||
let str = total_skillpoints[0];
|
||||
let strBoost = 1 + skillPointsToPercentage(str);
|
||||
let staticBoost = (pctModifier / 100.);// + skillPointsToPercentage(str);
|
||||
//let staticBoost = (pctModifier / 100.);
|
||||
let staticBoost = (pctModifier / 100.) + skillPointsToPercentage(str);
|
||||
let skillBoost = [0];
|
||||
for (let i in total_skillpoints) {
|
||||
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) {
|
||||
let damageBoost = 1 + skillBoost[i] + staticBoost;
|
||||
damages_results.push([
|
||||
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][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][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][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][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][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][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][0] * Math.max(1 + damageBoost, 0) * damageMult, 0), // Crit min
|
||||
Math.max(damages[i][1] * Math.max(1 + damageBoost, 0) * damageMult, 0), // Crit max
|
||||
]);
|
||||
totalDamNorm[0] += damages_results[i][0];
|
||||
totalDamNorm[1] += damages_results[i][1];
|
||||
|
@ -117,23 +118,23 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
|||
totalDamCrit[1] += damages_results[i][3];
|
||||
}
|
||||
if (melee) {
|
||||
totalDamNorm[0] += Math.max(strBoost*rawModifier, -damages_results[0][0]);
|
||||
totalDamNorm[1] += Math.max(strBoost*rawModifier, -damages_results[0][1]);
|
||||
totalDamCrit[0] += Math.max(strBoost*2*rawModifier, -damages_results[0][2]);
|
||||
totalDamCrit[1] += Math.max(strBoost*2*rawModifier, -damages_results[0][3]);
|
||||
//totalDamNorm[0] += Math.max(rawModifier, -damages_results[0][0]);
|
||||
//totalDamNorm[1] += Math.max(rawModifier, -damages_results[0][1]);
|
||||
//totalDamCrit[0] += Math.max(rawModifier, -damages_results[0][2]);
|
||||
//totalDamCrit[1] += Math.max(rawModifier, -damages_results[0][3]);
|
||||
//totalDamNorm[0] += Math.max(strBoost*rawModifier, -damages_results[0][0]);
|
||||
//totalDamNorm[1] += Math.max(strBoost*rawModifier, -damages_results[0][1]);
|
||||
//totalDamCrit[0] += Math.max(strBoost*2*rawModifier, -damages_results[0][2]);
|
||||
//totalDamCrit[1] += Math.max(strBoost*2*rawModifier, -damages_results[0][3]);
|
||||
totalDamNorm[0] += Math.max(rawModifier, -damages_results[0][0]);
|
||||
totalDamNorm[1] += Math.max(rawModifier, -damages_results[0][1]);
|
||||
totalDamCrit[0] += Math.max(rawModifier, -damages_results[0][2]);
|
||||
totalDamCrit[1] += Math.max(rawModifier, -damages_results[0][3]);
|
||||
}
|
||||
damages_results[0][0] += strBoost*rawModifier;
|
||||
damages_results[0][1] += strBoost*rawModifier;
|
||||
damages_results[0][2] += strBoost*2*rawModifier;
|
||||
damages_results[0][3] += strBoost*2*rawModifier;
|
||||
//damages_results[0][0] += rawModifier;
|
||||
//damages_results[0][1] += rawModifier;
|
||||
//damages_results[0][2] += rawModifier;
|
||||
//damages_results[0][3] += rawModifier;
|
||||
//damages_results[0][0] += strBoost*rawModifier;
|
||||
//damages_results[0][1] += strBoost*rawModifier;
|
||||
//damages_results[0][2] += strBoost*2*rawModifier;
|
||||
//damages_results[0][3] += strBoost*2*rawModifier;
|
||||
damages_results[0][0] += rawModifier;
|
||||
damages_results[0][1] += rawModifier;
|
||||
damages_results[0][2] += rawModifier;
|
||||
damages_results[0][3] += rawModifier;
|
||||
|
||||
if (totalDamNorm[0] < 0) totalDamNorm[0] = 0;
|
||||
if (totalDamNorm[1] < 0) totalDamNorm[1] = 0;
|
||||
|
|
|
@ -5,11 +5,15 @@ function calculate_skillpoints(equipment, weapon) {
|
|||
let fixed = [];
|
||||
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")) {
|
||||
crafted.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);
|
||||
|
@ -96,8 +100,8 @@ function calculate_skillpoints(equipment, weapon) {
|
|||
let best_total = Infinity;
|
||||
let best_activeSetCounts = static_activeSetCounts;
|
||||
|
||||
let allFalse = [false, false, false, false, false];
|
||||
if (consider.length > 0 || noboost.length > 0) {
|
||||
let allFalse = [0, 0, 0, 0, 0];
|
||||
if (consider.length > 0 || noboost.length > 0 || crafted.length > 0) {
|
||||
// Try every combination and pick the best one.
|
||||
for (let permutation of perm(consider)) {
|
||||
let activeSetCounts = new Map(static_activeSetCounts);
|
||||
|
@ -130,6 +134,23 @@ function calculate_skillpoints(equipment, weapon) {
|
|||
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();
|
||||
result = apply_to_fit(skillpoints, weapon, allFalse.slice(), activeSetCounts);
|
||||
needed_skillpoints = result[0];
|
||||
|
@ -142,6 +163,12 @@ function calculate_skillpoints(equipment, weapon) {
|
|||
apply_skillpoints(skillpoints, weapon, activeSetCounts);
|
||||
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) {
|
||||
best = permutation;
|
||||
final_skillpoints = skillpoints;
|
||||
|
|
Loading…
Reference in a new issue