Merge branch 'dev' of https://github.com/hppeng-wynn/hppeng-wynn.github.io into dev
This commit is contained in:
commit
bf907c46d8
13 changed files with 4090 additions and 3685 deletions
24
build.js
24
build.js
|
@ -47,8 +47,14 @@ const attackSpeeds = ["SUPER_SLOW", "VERY_SLOW", "SLOW", "NORMAL", "FAST", "VERY
|
||||||
*/
|
*/
|
||||||
class Build{
|
class Build{
|
||||||
|
|
||||||
/*Construct a build.
|
/*
|
||||||
*/
|
* Construct a build.
|
||||||
|
* @param level : Level of the player.
|
||||||
|
* @param equipment : List of equipment names that make up the build.
|
||||||
|
* In order: Helmet, Chestplate, Leggings, Boots, Ring1, Ring2, Brace, Neck, Weapon.
|
||||||
|
* @param powders : Powder application. List of lists of integers (powder IDs).
|
||||||
|
* In order: Helmet, Chestplate, Leggings, Boots, Weapon.
|
||||||
|
*/
|
||||||
constructor(level,equipment, powders){
|
constructor(level,equipment, powders){
|
||||||
// NOTE: powders is just an array of arrays of powder IDs. Not powder objects.
|
// NOTE: powders is just an array of arrays of powder IDs. Not powder objects.
|
||||||
this.powders = powders;
|
this.powders = powders;
|
||||||
|
@ -145,17 +151,19 @@ class Build{
|
||||||
/* Get total health for build.
|
/* Get total health for build.
|
||||||
*/
|
*/
|
||||||
getHealth(){
|
getHealth(){
|
||||||
let health = levelToHPBase(this.level);
|
let health = this.statMap.get("hp") + this.statMap.get("hpBonus");
|
||||||
for (const item in this.items) {
|
|
||||||
if (item.hp) health += item.hp;
|
|
||||||
if (item.hpBonus) health += item.hpBonus;
|
|
||||||
}
|
|
||||||
if(health<5){
|
if(health<5){
|
||||||
return 5;
|
return 5;
|
||||||
}else{
|
}else{
|
||||||
return health;
|
return health;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSpellCost(spellIdx, cost) {
|
||||||
|
cost = Math.ceil(cost * (1 - skillPointsToPercentage(this.total_skillpoints[2])));
|
||||||
|
cost += this.statMap.get("spRaw"+spellIdx);
|
||||||
|
return Math.max(1, Math.floor(cost * (1 + this.statMap.get("spPct"+spellIdx) / 100)))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Get melee stats for build.
|
/* Get melee stats for build.
|
||||||
|
@ -210,7 +218,7 @@ class Build{
|
||||||
statMap.set(id,(statMap.get(id) || 0)+value);
|
statMap.set(id,(statMap.get(id) || 0)+value);
|
||||||
}
|
}
|
||||||
for (const staticID of staticIDs) {
|
for (const staticID of staticIDs) {
|
||||||
if (item[staticID]) { statMap.set(statMap.get(staticID) + item[staticID]); }
|
if (item.get(staticID)) { statMap.set(staticID, statMap.get(staticID) + item.get(staticID)); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7090
clean.json
7090
clean.json
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -55,7 +55,7 @@ translate_mappings = {
|
||||||
"agilityPoints": "agi",
|
"agilityPoints": "agi",
|
||||||
"defensePoints": "def",
|
"defensePoints": "def",
|
||||||
#"thorns": "thorns",
|
#"thorns": "thorns",
|
||||||
#"exploding": "exploding",
|
"exploding": "expd",
|
||||||
"speed": "spd",
|
"speed": "spd",
|
||||||
"attackSpeedBonus": "atkTier",
|
"attackSpeedBonus": "atkTier",
|
||||||
#"poison": "poison",
|
#"poison": "poison",
|
||||||
|
|
|
@ -9,7 +9,6 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Applying powder.
|
// Applying powder.
|
||||||
let neutralRemaining = spellConversions[0];
|
|
||||||
let neutralBase = damages[0].slice();
|
let neutralBase = damages[0].slice();
|
||||||
let neutralRemainingRaw = damages[0];
|
let neutralRemainingRaw = damages[0];
|
||||||
for (let i = 0; i < 5; ++i) {
|
for (let i = 0; i < 5; ++i) {
|
||||||
|
@ -21,6 +20,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
||||||
neutralRemainingRaw[0] = Math.floor(neutralRemainingRaw[0] - min_diff);
|
neutralRemainingRaw[0] = Math.floor(neutralRemainingRaw[0] - min_diff);
|
||||||
neutralRemainingRaw[1] = Math.floor(neutralRemainingRaw[1] - max_diff);
|
neutralRemainingRaw[1] = Math.floor(neutralRemainingRaw[1] - max_diff);
|
||||||
}
|
}
|
||||||
|
//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]];
|
||||||
for (const powderID of weapon.get("powders")) {
|
for (const powderID of weapon.get("powders")) {
|
||||||
const powder = powderStats[powderID];
|
const powder = powderStats[powderID];
|
||||||
|
@ -38,9 +38,6 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
||||||
damages[element+1][0] += powder.min;
|
damages[element+1][0] += powder.min;
|
||||||
damages[element+1][1] += powder.max;
|
damages[element+1][1] += powder.max;
|
||||||
}
|
}
|
||||||
damages[0][0] *= neutralRemaining / 100;
|
|
||||||
damages[0][1] *= neutralRemaining / 100;
|
|
||||||
console.log(damages);
|
|
||||||
|
|
||||||
let damageMult = 1;
|
let damageMult = 1;
|
||||||
// If we are doing melee calculations:
|
// If we are doing melee calculations:
|
||||||
|
@ -50,6 +47,8 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
||||||
else {
|
else {
|
||||||
damageMult *= spellMultiplier * baseDamageMultiplier[attackSpeeds.indexOf(stats.get("atkSpd"))];
|
damageMult *= spellMultiplier * baseDamageMultiplier[attackSpeeds.indexOf(stats.get("atkSpd"))];
|
||||||
}
|
}
|
||||||
|
//console.log(damages);
|
||||||
|
//console.log(damageMult);
|
||||||
|
|
||||||
rawModifier *= spellMultiplier;
|
rawModifier *= spellMultiplier;
|
||||||
|
|
||||||
|
@ -79,5 +78,94 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
||||||
}
|
}
|
||||||
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][3] += rawModifier;
|
||||||
return [totalDamNorm, totalDamCrit, damages_results];
|
return [totalDamNorm, totalDamCrit, damages_results];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const spell_table = {
|
||||||
|
"wand": [
|
||||||
|
{ title: "Heal", cost: 6, parts: [
|
||||||
|
{ subtitle: "First Pulse", type: "heal", strength: 0.2 },
|
||||||
|
{ subtitle: "Second and Third Pulses", type: "heal", strength: 0.05 },
|
||||||
|
{ subtitle: "Total Heal", type: "heal", strength: 0.3 }
|
||||||
|
] },
|
||||||
|
{ title: "Teleport", cost: 4, parts: [
|
||||||
|
{ subtitle: "", type: "damage", multiplier: 100, conversion: [60, 0, 40, 0, 0, 0] },
|
||||||
|
] },
|
||||||
|
{ title: "Meteor", cost: 8, parts: [
|
||||||
|
{ subtitle: "Blast Damage", type: "damage", multiplier: 500, conversion: [40, 30, 0, 0, 30, 0] },
|
||||||
|
{ subtitle: "Burn Damage", type: "damage", multiplier: 125, conversion: [40, 30, 0, 0, 30, 0] },
|
||||||
|
] },
|
||||||
|
{ title: "Ice Snake", cost: 4, parts: [
|
||||||
|
{ subtitle: "", type: "damage", multiplier: 70, conversion: [50, 0, 0, 50, 0, 0] },
|
||||||
|
] },
|
||||||
|
],
|
||||||
|
"spear": [
|
||||||
|
{ title: "Bash", cost: 6, parts: [
|
||||||
|
{ subtitle: "First Damage", type: "damage", multiplier: 130, conversion: [60, 40, 0, 0, 0, 0]},
|
||||||
|
{ subtitle: "Explosion Damage", type: "damage", multiplier: 130, conversion: [100, 0, 0, 0, 0, 0]},
|
||||||
|
] },
|
||||||
|
{ title: "Charge", cost: 4, parts: [
|
||||||
|
{ subtitle: "", type: "damage", multiplier: 150, conversion: [60, 0, 0, 0, 40, 0] },
|
||||||
|
] },
|
||||||
|
{ title: "Uppercut", cost: 10, parts: [
|
||||||
|
{ subtitle: "First Damage", type: "damage", multiplier: 300, conversion: [70, 20, 10, 0, 0, 0] },
|
||||||
|
{ subtitle: "Fireworks Damage", type: "damage", multiplier: 50, conversion: [60, 0, 40, 0, 0, 0] },
|
||||||
|
{ subtitle: "Crash Damage", type: "damage", multiplier: 50, conversion: [80, 0, 20, 0, 0, 0] },
|
||||||
|
] },
|
||||||
|
{ title: "War Scream", cost: 6, parts: [
|
||||||
|
{ subtitle: "Area Damage", type: "damage", multiplier: 50, conversion: [0, 0, 0, 0, 75, 25] },
|
||||||
|
{ subtitle: "Air Shout (Per Hit)", type: "damage", multiplier: 30, conversion: [0, 0, 0, 0, 75, 25] },
|
||||||
|
] },
|
||||||
|
],
|
||||||
|
"bow": [
|
||||||
|
{ title: "Arrow Storm", cost: 6, parts: [
|
||||||
|
{ subtitle: "Total Damage", type: "damage", multiplier: 600, conversion: [60, 0, 25, 0, 15, 0]},
|
||||||
|
{ subtitle: "Per Arrow", type: "damage", multiplier: 10, conversion: [60, 0, 25, 0, 15, 0]},
|
||||||
|
] },
|
||||||
|
{ title: "Escape", cost: 3, parts: [
|
||||||
|
{ subtitle: "Landing Damage", type: "damage", multiplier: 100, conversion: [50, 0, 0, 0, 0, 50] },
|
||||||
|
] },
|
||||||
|
{ title: "Bomb Arrow", cost: 8, parts: [
|
||||||
|
{ subtitle: "", type: "damage", multiplier: 250, conversion: [60, 25, 0, 0, 15, 0] },
|
||||||
|
] },
|
||||||
|
{ title: "Arrow Shield", cost: 10, parts: [
|
||||||
|
{ subtitle: "Shield Damage", type: "damage", multiplier: 100, conversion: [70, 0, 0, 0, 0, 30] },
|
||||||
|
{ subtitle: "Arrow Rain Damage", type: "damage", multiplier: 200, conversion: [70, 0, 0, 0, 0, 30] },
|
||||||
|
] },
|
||||||
|
],
|
||||||
|
"dagger": [
|
||||||
|
{ title: "Spin Attack", cost: 6, parts: [
|
||||||
|
{ subtitle: "", type: "damage", multiplier: 150, conversion: [70, 0, 30, 0, 0, 0]},
|
||||||
|
] },
|
||||||
|
{ title: "Vanish", cost: 1, parts: [
|
||||||
|
{ subtitle: "No Damage", type: "none" }
|
||||||
|
] },
|
||||||
|
{ title: "Multihit", cost: 8, parts: [
|
||||||
|
{ subtitle: "1st to 10th Hit", type: "damage", multiplier: 27, conversion: [100, 0, 0, 0, 0, 0] },
|
||||||
|
{ subtitle: "Fatality", type: "damage", multiplier: 120, conversion: [20, 0, 30, 50, 0, 0] },
|
||||||
|
{ subtitle: "Total Damage", type: "total", factors: [10, 1] },
|
||||||
|
] },
|
||||||
|
{ title: "Smoke Bomb", cost: 8, parts: [
|
||||||
|
{ subtitle: "Tick Damage", type: "damage", multiplier: 60, conversion: [45, 25, 0, 0, 0, 30] },
|
||||||
|
{ subtitle: "Total Damage", type: "damage", multiplier: 600, conversion: [45, 25, 0, 0, 0, 30] },
|
||||||
|
] },
|
||||||
|
],
|
||||||
|
"relik": [
|
||||||
|
{ title: "Totem", cost: 4, parts: [
|
||||||
|
{ subtitle: "Smash Damage", type: "damage", multiplier: 100, conversion: [80, 0, 0, 0, 20, 0]},
|
||||||
|
{ subtitle: "Damage Tick", type: "damage", multiplier: 20, conversion: [80, 0, 0, 0, 0, 20]},
|
||||||
|
{ subtitle: "Heal Tick", type: "heal", strength: 0.04 },
|
||||||
|
] },
|
||||||
|
{ title: "Haul", cost: 1, parts: [
|
||||||
|
{ subtitle: "", type: "damage", multiplier: 100, conversion: [80, 0, 20, 0, 0, 0] },
|
||||||
|
] },
|
||||||
|
{ title: "Aura", cost: 8, parts: [
|
||||||
|
{ subtitle: "One Wave", type: "damage", multiplier: 200, conversion: [70, 0, 0, 30, 0, 0] },
|
||||||
|
] },
|
||||||
|
{ title: "Uproot", cost: 6, parts: [
|
||||||
|
{ subtitle: "", type: "damage", multiplier: 50, conversion: [70, 30, 0, 0, 0, 0] },
|
||||||
|
] },
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
339
display.js
339
display.js
|
@ -1,5 +1,7 @@
|
||||||
let nonRolledIDs = ["name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq","str", "dex", "int", "agi", "def", "fixID", "category", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_"];
|
let nonRolledIDs = ["name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq","str", "dex", "int", "agi", "def", "fixID", "category", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_"];
|
||||||
let rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "exploding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd"];
|
let rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd"];
|
||||||
|
|
||||||
|
let reversedIDs = [ "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4" ];
|
||||||
|
|
||||||
function expandItem(item, powders){
|
function expandItem(item, powders){
|
||||||
let minRolls = new Map();
|
let minRolls = new Map();
|
||||||
|
@ -15,24 +17,26 @@ function expandItem(item, powders){
|
||||||
}
|
}
|
||||||
}else{ //The item does not have fixed IDs.
|
}else{ //The item does not have fixed IDs.
|
||||||
for (const id of rolledIDs){
|
for (const id of rolledIDs){
|
||||||
if(item[id]){
|
if(item[id] > 0){ // positive rolled IDs
|
||||||
if(item[id] > 0){ // positive rolled IDs
|
minRolls.set(id,idRound(item[id]*0.3));
|
||||||
minRolls.set(id,idRound(item[id]*0.3));
|
maxRolls.set(id,idRound(item[id]*1.3));
|
||||||
|
}else if(item[id] < 0){ //negative rolled IDs
|
||||||
|
if (reversedIDs.includes(id)) {
|
||||||
maxRolls.set(id,idRound(item[id]*1.3));
|
maxRolls.set(id,idRound(item[id]*1.3));
|
||||||
}else if(item[id] < 0){ //negative rolled IDs
|
minRolls.set(id,idRound(item[id]*0.7));
|
||||||
|
}
|
||||||
|
else {
|
||||||
minRolls.set(id,idRound(item[id]*1.3));
|
minRolls.set(id,idRound(item[id]*1.3));
|
||||||
maxRolls.set(id,idRound(item[id]*0.7));
|
maxRolls.set(id,idRound(item[id]*0.7));
|
||||||
}else{//Id = 0
|
|
||||||
minRolls.set(id,0);
|
|
||||||
maxRolls.set(id,0);
|
|
||||||
}
|
}
|
||||||
|
}else{//Id = 0
|
||||||
|
minRolls.set(id,0);
|
||||||
|
maxRolls.set(id,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const id of nonRolledIDs){
|
for (const id of nonRolledIDs){
|
||||||
if(item[id]){
|
expandedItem.set(id,item[id]);
|
||||||
expandedItem.set(id,item[id]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
expandedItem.set("minRolls",minRolls);
|
expandedItem.set("minRolls",minRolls);
|
||||||
expandedItem.set("maxRolls",maxRolls);
|
expandedItem.set("maxRolls",maxRolls);
|
||||||
|
@ -50,6 +54,115 @@ function idRound(id){
|
||||||
return rounded;
|
return rounded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let idPrefixes = {"displayName": "", "lvl":"Combat Level Min: ", "classReq":"Class Req: ","strReq":"Strength Min: ","dexReq":"Dexterity Min: ","intReq":"Intelligence Min: ","defReq":"Defense Min: ","agiReq":"Agility Min: ", "nDam_":"Neutral Damage: ", "eDam_":"Earth Damage: ", "tDam_":"Thunder Damage: ", "wDam_":"Water Damage: ", "fDam_":"Fire Damage: ", "aDam_":"Air Damage: ", "atkSpd":"Attack Speed: ", "hp":"Health : ", "eDef":"Earth Defense: ", "tDef":"Thunder Defense: ", "wDef":"Water Defense: ", "fDef":"Fire Defense: ", "aDef":"Air Defense: ", "str":"Strength: ", "dex":"Dexterity: ", "int":"Intelligence: ", "def":"Defense: ","agi":"Agility: ", "hpBonus":"Health Bonus: ", "hprRaw":"Health Regen Raw: ", "hprPct":"Health Regen %: ", "sdRaw":"Raw Spell Damage: ", "sdPct":"Spell Damage %: ", "mdRaw":"Main Attack Neutral Damage: ", "mdPct":"Main Attack Damage %: ", "mr":"Mana Regen: ", "ms":"Mana Steal: ", "ref":"Reflection: ", "ls":"Life Steal: ", "poison":"Poison: ", "thorns":"Thorns: ", "expd":"Exploding: ", "spd":"Walk Speed Bonus: ", "atkTier":"Attack Speed Bonus: ", "eDamPct":"Earth Damage %: ", "tDamPct":"Thunder Damage %: ", "wDamPct":"Water Damage %: ", "fDamPct":"Fire Damage %: ", "aDamPct":"Air Damage %: ", "eDefPct":"Earth Defense %: ", "tDefPct":"Thunder Defense %: ", "wDefPct":"Water Defense %: ", "fDefPct":"Fire Defense %: ", "aDefPct":"Air Defense %: ", "spPct1":"1st Spell Cost %: ", "spRaw1":"1st Spell Cost Raw: ", "spPct2":"2nd Spell Cost %: ", "spRaw2":"2nd Spell Cost Raw: ", "spPct3":"3rd Spell Cost %: ", "spRaw3":"3rd Spell Cost Raw: ", "spPct4":"4th Spell Cost %: ", "spRaw4":"4th Spell Cost Raw: ", "rainbowRaw":"Rainbow Spell Damage Raw: ", "sprint":"Sprint Bonus: ", "sprintReg":"Sprint Regen Bonus: ", "jh":"Jump Height: ", "xpb":"Combat XP Bonus: ", "lb":"Loot Bonus: ", "lq":"Loot Quality: ", "spRegen":"Soul Point Regen: ", "eSteal":"Stealing: ", "gXp":"Gathering XP Bonus: ", "gSpd":"Gathering Speed Bonus: ", "slots":"Powder Slots: ", "set":"Set: ", "quest":"Quest Req: ", "restrict":""};
|
||||||
|
let idSuffixes = {"displayName": "", "lvl":"", "classReq":"","strReq":"","dexReq":"","intReq":"","defReq":"","agiReq":"", "nDam_":"", "eDam_":"", "tDam_":"", "wDam_":"", "fDam_":"", "aDam_":"", "atkSpd":"", "hp":"", "eDef":"", "tDef":"", "wDef":"", "fDef":"", "aDef":"", "str":"", "dex":"", "int":"", "def":"","agi":"", "hpBonus":"", "hprRaw":"", "hprPct":"%", "sdRaw":"", "sdPct":"%", "mdRaw":"", "mdPct":"%", "mr":"/4s", "ms":"/4s", "ref":"%", "ls":"/4s", "poison":"/3s", "thorns":"%", "expd":"%", "spd":"%", "atkTier":" tier", "eDamPct":"%", "tDamPct":"%", "wDamPct":"%", "fDamPct":"%", "aDamPct":"%", "eDefPct":"%", "tDefPct":"%", "wDefPct":"%", "fDefPct":"%", "aDefPct":"%", "spPct1":"%", "spRaw1":"", "spPct2":"%", "spRaw2":"", "spPct3":"%", "spRaw3":"", "spPct4":"%", "spRaw4":"", "rainbowRaw":"", "sprint":"%", "sprintReg":"%", "jh":"", "xpb":"%", "lb":"%", "lq":"%", "spRegen":"%", "eSteal":"%", "gXp":"%", "gSpd":"%", "slots":"", "set":" set.", "quest":"", "restrict":""};
|
||||||
|
|
||||||
|
function apply_elemental_format(p_elem, id, suffix) {
|
||||||
|
suffix = (typeof suffix !== 'undefined') ? suffix : "";
|
||||||
|
// THIS IS SO JANK BUT IM TOO LAZY TO FIX IT TODO
|
||||||
|
let parts = idPrefixes[id].split(/ (.*)/);
|
||||||
|
let element_prefix = parts[0];
|
||||||
|
let desc = parts[1];
|
||||||
|
let i_elem = document.createElement('b');
|
||||||
|
i_elem.classList.add(element_prefix);
|
||||||
|
i_elem.textContent = element_prefix;
|
||||||
|
p_elem.appendChild(i_elem);
|
||||||
|
|
||||||
|
let i_elem2 = document.createElement('b');
|
||||||
|
i_elem2.textContent = " " + desc + suffix;
|
||||||
|
p_elem.appendChild(i_elem2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayBuildStats(build, parent_id){
|
||||||
|
// Commands to "script" the creation of nice formatting.
|
||||||
|
// #commands create a new element.
|
||||||
|
// !elemental is some janky hack for elemental damage.
|
||||||
|
// normals just display a thing.
|
||||||
|
|
||||||
|
let display_commands = [
|
||||||
|
"#ldiv",
|
||||||
|
"!elemental",
|
||||||
|
"hp",
|
||||||
|
"fDef", "wDef", "aDef", "tDef", "eDef",
|
||||||
|
"!elemental",
|
||||||
|
"#table",
|
||||||
|
"str", "dex", "int", "def", "agi",
|
||||||
|
"hpBonus",
|
||||||
|
"hprRaw", "hprPct",
|
||||||
|
"sdRaw", "sdPct",
|
||||||
|
"mdRaw", "mdPct",
|
||||||
|
"mr", "ms",
|
||||||
|
"ref", "thorns",
|
||||||
|
"ls",
|
||||||
|
"poison",
|
||||||
|
"expd",
|
||||||
|
"spd",
|
||||||
|
"atkTier",
|
||||||
|
"!elemental",
|
||||||
|
"fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct",
|
||||||
|
"fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct",
|
||||||
|
"!elemental",
|
||||||
|
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
|
||||||
|
"rainbowRaw",
|
||||||
|
"sprint", "sprintReg",
|
||||||
|
"jh",
|
||||||
|
"xpb", "lb", "lq",
|
||||||
|
"spRegen",
|
||||||
|
"eSteal",
|
||||||
|
"gXp", "gSpd",
|
||||||
|
];
|
||||||
|
|
||||||
|
// Clear the parent div.
|
||||||
|
setHTML(parent_id, "");
|
||||||
|
let parent_div = document.getElementById(parent_id);
|
||||||
|
|
||||||
|
let stats = build.statMap;
|
||||||
|
|
||||||
|
let active_elem;
|
||||||
|
let elemental_format = false;
|
||||||
|
|
||||||
|
//TODO this is put here for readability, consolidate with definition in build.js
|
||||||
|
let staticIDs = ["hp", "eDef", "tDef", "wDef", "fDef", "aDef"];
|
||||||
|
|
||||||
|
for (const command of display_commands) {
|
||||||
|
if (command.charAt(0) === "#") {
|
||||||
|
if (command === "#cdiv") {
|
||||||
|
active_elem = document.createElement('div');
|
||||||
|
active_elem.classList.add('itemcenter');
|
||||||
|
}
|
||||||
|
else if (command === "#ldiv") {
|
||||||
|
active_elem = document.createElement('div');
|
||||||
|
active_elem.classList.add('itemleft');
|
||||||
|
}
|
||||||
|
else if (command === "#table") {
|
||||||
|
active_elem = document.createElement('table');
|
||||||
|
active_elem.classList.add('itemtable');
|
||||||
|
}
|
||||||
|
parent_div.appendChild(active_elem);
|
||||||
|
}
|
||||||
|
else if (command.charAt(0) === "!") {
|
||||||
|
// TODO: This is sooo incredibly janky.....
|
||||||
|
if (command === "!elemental") {
|
||||||
|
elemental_format = !elemental_format;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let id = command;
|
||||||
|
if (stats.get(id)) {
|
||||||
|
let style = null;
|
||||||
|
if (!staticIDs.includes(id)) {
|
||||||
|
style = "positive";
|
||||||
|
if (stats.get(id) < 0) {
|
||||||
|
style = "negative";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
displayFixedID(active_elem, id, stats.get(id), elemental_format, style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function displayExpandedItem(item, parent_id){
|
function displayExpandedItem(item, parent_id){
|
||||||
// Commands to "script" the creation of nice formatting.
|
// Commands to "script" the creation of nice formatting.
|
||||||
// #commands create a new element.
|
// #commands create a new element.
|
||||||
|
@ -94,7 +207,7 @@ function displayExpandedItem(item, parent_id){
|
||||||
"ref", "thorns",
|
"ref", "thorns",
|
||||||
"ls",
|
"ls",
|
||||||
"poison",
|
"poison",
|
||||||
"exploding",
|
"expd",
|
||||||
"spd",
|
"spd",
|
||||||
"atkTier",
|
"atkTier",
|
||||||
"!elemental",
|
"!elemental",
|
||||||
|
@ -115,25 +228,6 @@ function displayExpandedItem(item, parent_id){
|
||||||
"quest",
|
"quest",
|
||||||
"restrict"];
|
"restrict"];
|
||||||
|
|
||||||
let idPrefixes = {"displayName": "", "lvl":"Combat Level Min: ", "classReq":"Class Req: ","strReq":"Strength Min: ","dexReq":"Dexterity Min: ","intReq":"Intelligence Min: ","defReq":"Defense Min: ","agiReq":"Agility Min: ", "nDam_":"Neutral Damage: ", "eDam_":"Earth Damage: ", "tDam_":"Thunder Damage: ", "wDam_":"Water Damage: ", "fDam_":"Fire Damage: ", "aDam_":"Air Damage: ", "atkSpd":"Attack Speed: ", "hp":"Health : ", "eDef":"Earth Defense: ", "tDef":"Thunder Defense: ", "wDef":"Water Defense: ", "fDef":"Fire Defense: ", "aDef":"Air Defense: ", "str":"Strength: ", "dex":"Dexterity: ", "int":"Intelligence: ", "def":"Defense: ","agi":"Agility: ", "hpBonus":"Health Bonus: ", "hprRaw":"Health Regen Raw: ", "hprPct":"Health Regen %: ", "sdRaw":"Raw Spell Damage: ", "sdPct":"Spell Damage %: ", "mdRaw":"Main Attack Neutral Damage: ", "mdPct":"Main Attack Damage %: ", "mr":"Mana Regen: ", "ms":"Mana Steal: ", "ref":"Reflection: ", "ls":"Life Steal: ", "poison":"Poison: ", "thorns":"Thorns: ", "exploding":"Exploding: ", "spd":"Walk Speed Bonus: ", "atkTier":"Attack Speed Bonus: ", "eDamPct":"Earth Damage %: ", "tDamPct":"Thunder Damage %: ", "wDamPct":"Water Damage %: ", "fDamPct":"Fire Damage %: ", "aDamPct":"Air Damage %: ", "eDefPct":"Earth Defense %: ", "tDefPct":"Thunder Defense %: ", "wDefPct":"Water Defense %: ", "fDefPct":"Fire Defense %: ", "aDefPct":"Air Defense %: ", "spPct1":"1st Spell Cost %: ", "spRaw1":"1st Spell Cost Raw: ", "spPct2":"2nd Spell Cost %: ", "spRaw2":"2nd Spell Cost Raw: ", "spPct3":"3rd Spell Cost %: ", "spRaw3":"3rd Spell Cost Raw: ", "spPct4":"4th Spell Cost %: ", "spRaw4":"4th Spell Cost Raw: ", "rainbowRaw":"Rainbow Spell Damage Raw: ", "sprint":"Sprint Bonus: ", "sprintReg":"Sprint Regen Bonus: ", "jh":"Jump Height: ", "xpb":"Combat XP Bonus: ", "lb":"Loot Bonus: ", "lq":"Loot Quality: ", "spRegen":"Soul Point Regen: ", "eSteal":"Stealing: ", "gXp":"Gathering XP Bonus: ", "gSpd":"Gathering Speed Bonus: ", "slots":"Powder Slots: ", "set":"Set: ", "quest":"Quest Req: ", "restrict":""};
|
|
||||||
let idSuffixes = {"displayName": "", "lvl":"", "classReq":"","strReq":"","dexReq":"","intReq":"","defReq":"","agiReq":"", "nDam_":"", "eDam_":"", "tDam_":"", "wDam_":"", "fDam_":"", "aDam_":"", "atkSpd":"", "hp":"", "eDef":"", "tDef":"", "wDef":"", "fDef":"", "aDef":"", "str":"", "dex":"", "int":"", "def":"","agi":"", "hpBonus":"", "hprRaw":"", "hprPct":"%", "sdRaw":"", "sdPct":"%", "mdRaw":"", "mdPct":"%", "mr":"/4s", "ms":"/4s", "ref":"%", "ls":"/4s", "poison":"/3s", "thorns":"%", "exploding":"%", "spd":"%", "atkTier":" tier", "eDamPct":"%", "tDamPct":"%", "wDamPct":"%", "fDamPct":"%", "aDamPct":"%", "eDefPct":"%", "tDefPct":"%", "wDefPct":"%", "fDefPct":"%", "aDefPct":"%", "spPct1":"%", "spRaw1":"", "spPct2":"%", "spRaw2":"", "spPct3":"%", "spRaw3":"", "spPct4":"%", "spRaw4":"", "rainbowRaw":"", "sprint":"%", "sprintReg":"%", "jh":"", "xpb":"%", "lb":"%", "lq":"%", "spRegen":"%", "eSteal":"%", "gXp":"%", "gSpd":"%", "slots":"", "set":" set.", "quest":"", "restrict":""};
|
|
||||||
|
|
||||||
function apply_elemental_format(p_elem, id, suffix) {
|
|
||||||
suffix = (typeof suffix !== 'undefined') ? suffix : "";
|
|
||||||
// THIS IS SO JANK BUT IM TOO LAZY TO FIX IT TODO
|
|
||||||
let parts = idPrefixes[id].split(/ (.*)/);
|
|
||||||
let element_prefix = parts[0];
|
|
||||||
let desc = parts[1];
|
|
||||||
let i_elem = document.createElement('b');
|
|
||||||
i_elem.classList.add(element_prefix);
|
|
||||||
i_elem.textContent = element_prefix;
|
|
||||||
p_elem.appendChild(i_elem);
|
|
||||||
|
|
||||||
let i_elem2 = document.createElement('b');
|
|
||||||
i_elem2.textContent = " " + desc + suffix;
|
|
||||||
p_elem.appendChild(i_elem2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the parent div.
|
// Clear the parent div.
|
||||||
setHTML(parent_id, "");
|
setHTML(parent_id, "");
|
||||||
let parent_div = document.getElementById(parent_id);
|
let parent_div = document.getElementById(parent_id);
|
||||||
|
@ -166,51 +260,23 @@ function displayExpandedItem(item, parent_id){
|
||||||
else {
|
else {
|
||||||
let id = command;
|
let id = command;
|
||||||
if(nonRolledIDs.includes(id) && item.get(id)){//nonRolledID & non-0/non-null/non-und ID
|
if(nonRolledIDs.includes(id) && item.get(id)){//nonRolledID & non-0/non-null/non-und ID
|
||||||
let p_elem = document.createElement('p');
|
displayFixedID(active_elem, id, item.get(id), elemental_format);
|
||||||
p_elem.classList.add('itemp');
|
|
||||||
if (elemental_format) {
|
|
||||||
// HACK TO AVOID DISPLAYING ZERO DAMAGE! TODO
|
|
||||||
if (item.get(id) === "0-0") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
apply_elemental_format(p_elem, id, item.get(id));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (id === "slots") {
|
|
||||||
// HACK TO MAKE POWDERS DISPLAY NICE!! TODO
|
|
||||||
p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]) +
|
|
||||||
" [ " + item.get("powders").map(x => powderNames.get(x)) + " ]";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
active_elem.appendChild(p_elem);
|
|
||||||
}
|
}
|
||||||
else if(rolledIDs.includes(id)&& item.get("minRolls").get(id)){ // && item.get("maxRolls").get(id) ){//rolled ID & non-0/non-null/non-und ID
|
else if(rolledIDs.includes(id)&& item.get("minRolls").get(id)){ // && item.get("maxRolls").get(id) ){//rolled ID & non-0/non-null/non-und ID
|
||||||
let row = document.createElement('tr');
|
|
||||||
let style = "positive";
|
let style = "positive";
|
||||||
if (item.get("minRolls").get(id) < 0) {
|
if (item.get("minRolls").get(id) < 0) {
|
||||||
style = "negative";
|
style = "negative";
|
||||||
}
|
}
|
||||||
if (fix_id) {
|
if (fix_id) {
|
||||||
let desc_elem = document.createElement('td');
|
let p_elem = displayFixedID(active_elem, id, item.get("minRolls").get(id), elemental_format, style);
|
||||||
desc_elem.classList.add('left');
|
if (id === "slots") {
|
||||||
if (elemental_format) {
|
// HACK TO MAKE POWDERS DISPLAY NICE!! TODO
|
||||||
apply_elemental_format(desc_elem, id);
|
p_elem.textContent = idPrefixes[id].concat(value, idSuffixes[id]) +
|
||||||
|
" [ " + item.get("powders").map(x => powderNames.get(x)) + " ]";
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
desc_elem.textContent = idPrefixes[id];
|
|
||||||
}
|
|
||||||
row.appendChild(desc_elem);
|
|
||||||
|
|
||||||
let value_elem = document.createElement('td');
|
|
||||||
value_elem.classList.add('right');
|
|
||||||
value_elem.classList.add(style);
|
|
||||||
value_elem.textContent = item.get("minRolls").get(id) + idSuffixes[id];
|
|
||||||
row.appendChild(value_elem);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
let row = document.createElement('tr');
|
||||||
let min_elem = document.createElement('td');
|
let min_elem = document.createElement('td');
|
||||||
min_elem.classList.add('left');
|
min_elem.classList.add('left');
|
||||||
min_elem.classList.add(style);
|
min_elem.classList.add(style);
|
||||||
|
@ -233,8 +299,8 @@ function displayExpandedItem(item, parent_id){
|
||||||
max_elem.classList.add(style);
|
max_elem.classList.add(style);
|
||||||
max_elem.textContent = item.get("maxRolls").get(id) + idSuffixes[id];
|
max_elem.textContent = item.get("maxRolls").get(id) + idSuffixes[id];
|
||||||
row.appendChild(max_elem);
|
row.appendChild(max_elem);
|
||||||
|
active_elem.appendChild(row);
|
||||||
}
|
}
|
||||||
active_elem.appendChild(row);
|
|
||||||
}//Just don't do anything if else
|
}//Just don't do anything if else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,3 +310,142 @@ function displayExpandedItem(item, parent_id){
|
||||||
item_desc_elem.textContent = item.get("tier")+" "+item.get("type");
|
item_desc_elem.textContent = item.get("tier")+" "+item.get("type");
|
||||||
parent_div.append(item_desc_elem);
|
parent_div.append(item_desc_elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function displayFixedID(active, id, value, elemental_format, style) {
|
||||||
|
if (style) {
|
||||||
|
let row = document.createElement('tr');
|
||||||
|
let desc_elem = document.createElement('td');
|
||||||
|
desc_elem.classList.add('left');
|
||||||
|
if (elemental_format) {
|
||||||
|
apply_elemental_format(desc_elem, id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
desc_elem.textContent = idPrefixes[id];
|
||||||
|
}
|
||||||
|
row.appendChild(desc_elem);
|
||||||
|
|
||||||
|
let value_elem = document.createElement('td');
|
||||||
|
value_elem.classList.add('right');
|
||||||
|
value_elem.classList.add(style);
|
||||||
|
value_elem.textContent = value + idSuffixes[id];
|
||||||
|
row.appendChild(value_elem);
|
||||||
|
active.appendChild(row);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// HACK TO AVOID DISPLAYING ZERO DAMAGE! TODO
|
||||||
|
if (value === "0-0") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let p_elem = document.createElement('p');
|
||||||
|
p_elem.classList.add('itemp');
|
||||||
|
if (elemental_format) {
|
||||||
|
apply_elemental_format(p_elem, id, value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p_elem.textContent = idPrefixes[id].concat(value, idSuffixes[id]);
|
||||||
|
}
|
||||||
|
active.appendChild(p_elem);
|
||||||
|
return p_elem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function displaySpellDamage(parent_elem, build, spell, spellIdx) {
|
||||||
|
parent_elem.textContent = "";
|
||||||
|
|
||||||
|
const stats = build.statMap;
|
||||||
|
let title_elem = document.createElement("p");
|
||||||
|
title_elem.classList.add('center');
|
||||||
|
if (spellIdx != 0) {
|
||||||
|
title_elem.textContent = spell.title + " (" + build.getSpellCost(spellIdx, spell.cost) + ")";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
title_elem.textContent = spell.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent_elem.append(title_elem);
|
||||||
|
let critChance = skillPointsToPercentage(build.total_skillpoints[1]);
|
||||||
|
|
||||||
|
let save_damages = [];
|
||||||
|
|
||||||
|
for (const part of spell.parts) {
|
||||||
|
parent_elem.append(document.createElement("br"));
|
||||||
|
let part_div = document.createElement("p");
|
||||||
|
parent_elem.append(part_div);
|
||||||
|
|
||||||
|
let subtitle_elem = document.createElement("p");
|
||||||
|
subtitle_elem.textContent = part.subtitle;
|
||||||
|
part_div.append(subtitle_elem);
|
||||||
|
if (part.type === "damage") {
|
||||||
|
|
||||||
|
let _results = calculateSpellDamage(stats, part.conversion,
|
||||||
|
stats.get("sdRaw"), stats.get("sdPct"),
|
||||||
|
part.multiplier / 100, build.weapon, build.total_skillpoints);
|
||||||
|
let totalDamNormal = _results[0];
|
||||||
|
let totalDamCrit = _results[1];
|
||||||
|
let results = _results[2];
|
||||||
|
for (let i = 0; i < 6; ++i) {
|
||||||
|
for (let j in results[i]) {
|
||||||
|
results[i][j] = results[i][j].toFixed(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let nonCritAverage = (totalDamNormal[0]+totalDamNormal[1])/2;
|
||||||
|
let critAverage = (totalDamCrit[0]+totalDamCrit[1])/2;
|
||||||
|
let averageDamage = (1-critChance)*nonCritAverage+critChance*critAverage;
|
||||||
|
|
||||||
|
let averageLabel = document.createElement("p");
|
||||||
|
averageLabel.textContent = "Average: "+averageDamage.toFixed(2);
|
||||||
|
averageLabel.classList.add("damageSubtitle");
|
||||||
|
part_div.append(averageLabel);
|
||||||
|
|
||||||
|
let nonCritLabel = document.createElement("p");
|
||||||
|
nonCritLabel.textContent = "Non-Crit Average: "+nonCritAverage.toFixed(2);
|
||||||
|
nonCritLabel.classList.add("damageSubtitle");
|
||||||
|
part_div.append(nonCritLabel);
|
||||||
|
|
||||||
|
let damageClasses = ["Neutral","Earth","Thunder","Water","Fire","Air"];
|
||||||
|
for (let i = 0; i < 6; i++){
|
||||||
|
if (results[i][1] > 0){
|
||||||
|
let p = document.createElement("p");
|
||||||
|
p.classList.add("damagep");
|
||||||
|
p.classList.add(damageClasses[i]);
|
||||||
|
p.textContent = results[i][0]+"-"+results[i][1];
|
||||||
|
part_div.append(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//part_div.append(document.createElement("br"));
|
||||||
|
let critLabel = document.createElement("p");
|
||||||
|
critLabel.textContent = "Crit Average: "+critAverage.toFixed(2);
|
||||||
|
critLabel.classList.add("damageSubtitle");
|
||||||
|
part_div.append(critLabel);
|
||||||
|
|
||||||
|
for (let i = 0; i < 6; i++){
|
||||||
|
if (results[i][1] > 0){
|
||||||
|
let p = document.createElement("p");
|
||||||
|
p.classList.add("damagep");
|
||||||
|
p.classList.add(damageClasses[i]);
|
||||||
|
p.textContent = results[i][2]+"-"+results[i][3];
|
||||||
|
part_div.append(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
save_damages.push(averageDamage);
|
||||||
|
}
|
||||||
|
else if (part.type == "heal") {
|
||||||
|
let heal_amount = part.strength * build.getHealth() * Math.max(0, Math.min(1.5, 1 + 0.05 * stats.get("wDamPct")));
|
||||||
|
let healLabel = document.createElement("p");
|
||||||
|
healLabel.textContent = heal_amount;
|
||||||
|
healLabel.classList.add("damagep");
|
||||||
|
part_div.append(healLabel);
|
||||||
|
}
|
||||||
|
else if (part.type === "total") {
|
||||||
|
let total_damage = 0;
|
||||||
|
for (let i in part.factors) {
|
||||||
|
total_damage += save_damages[i] * part.factors[i];
|
||||||
|
}
|
||||||
|
let averageLabel = document.createElement("p");
|
||||||
|
averageLabel.textContent = "Average: "+total_damage.toFixed(2);
|
||||||
|
averageLabel.classList.add("damageSubtitle");
|
||||||
|
part_div.append(averageLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
50
index.html
50
index.html
|
@ -15,7 +15,8 @@
|
||||||
Wynn build calculator
|
Wynn build calculator
|
||||||
</div>
|
</div>
|
||||||
<div class="center" id="header2">
|
<div class="center" id="header2">
|
||||||
Made by: hppeng and ferricles
|
<p>Made by: hppeng and ferricles (JavaScript required to function, nothing works without js)</p>
|
||||||
|
<p>Hard refresh the page (Ctrl+Shift+R on windows/chrome) if it isn't updating correctly.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="center" id="credits">
|
<div class="center" id="credits">
|
||||||
<a href="credits.txt">Additional credits</a>
|
<a href="credits.txt">Additional credits</a>
|
||||||
|
@ -122,7 +123,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="center" style="grid-column:3;grid-row:3">
|
<div class="center" style="grid-column:3;grid-row:3">
|
||||||
<button class = "button" id = "calc-button" onclick = "calculateBuild()">
|
<button class = "button" id = "calc-button" onclick = "calculateBuild()">
|
||||||
Calculate
|
Update Items (Resets stats)
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="center" style="grid-column:4;grid-row:3">
|
<div class="center" style="grid-column:4;grid-row:3">
|
||||||
|
@ -141,7 +142,7 @@
|
||||||
<input type="number" id="str-skp" name="str-skp" value="0" class="skpInput"/>
|
<input type="number" id="str-skp" name="str-skp" value="0" class="skpInput"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="str-skp-assign">
|
<div id="str-skp-assign">
|
||||||
Before Boosts: 0
|
Manually Assigned: 0
|
||||||
</div>
|
</div>
|
||||||
<div id="str-skp-base">
|
<div id="str-skp-base">
|
||||||
Original Value: 0
|
Original Value: 0
|
||||||
|
@ -155,7 +156,7 @@
|
||||||
<input type="number" id="dex-skp" name="dex-skp" value="0" class="skpInput"/>
|
<input type="number" id="dex-skp" name="dex-skp" value="0" class="skpInput"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="dex-skp-assign">
|
<div id="dex-skp-assign">
|
||||||
Before Boosts: 0
|
Manually Assigned: 0
|
||||||
</div>
|
</div>
|
||||||
<div id="dex-skp-base">
|
<div id="dex-skp-base">
|
||||||
Original Value: 0
|
Original Value: 0
|
||||||
|
@ -169,7 +170,7 @@
|
||||||
<input type="number" id="int-skp" name="int-skp" value="0" class="skpInput"/>
|
<input type="number" id="int-skp" name="int-skp" value="0" class="skpInput"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="int-skp-assign">
|
<div id="int-skp-assign">
|
||||||
Before Boosts: 0
|
Manually Assigned: 0
|
||||||
</div>
|
</div>
|
||||||
<div id="int-skp-base">
|
<div id="int-skp-base">
|
||||||
Original Value: 0
|
Original Value: 0
|
||||||
|
@ -183,7 +184,7 @@
|
||||||
<input type="number" id="def-skp" name="def-skp" value="0" class="skpInput"/>
|
<input type="number" id="def-skp" name="def-skp" value="0" class="skpInput"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="def-skp-assign">
|
<div id="def-skp-assign">
|
||||||
Before Boosts: 0
|
Manually Assigned: 0
|
||||||
</div>
|
</div>
|
||||||
<div id="def-skp-base">
|
<div id="def-skp-base">
|
||||||
Original Value: 0
|
Original Value: 0
|
||||||
|
@ -197,7 +198,7 @@
|
||||||
<input type="number" id="agi-skp" name="agi-skp" value="0" class="skpInput"/>
|
<input type="number" id="agi-skp" name="agi-skp" value="0" class="skpInput"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="agi-skp-assign">
|
<div id="agi-skp-assign">
|
||||||
Before Boosts: 0
|
Manually Assigned: 0
|
||||||
</div>
|
</div>
|
||||||
<div id="agi-skp-base">
|
<div id="agi-skp-base">
|
||||||
Original Value: 0
|
Original Value: 0
|
||||||
|
@ -206,6 +207,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="center">
|
||||||
|
<button class = "button" id = "update-button" onclick = "updateStats()">
|
||||||
|
Update Stats
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div class = "build">
|
<div class = "build">
|
||||||
<div class = "center build-helmet" id = "build-helmet" style = "grid-column:1;grid-row:1">
|
<div class = "center build-helmet" id = "build-helmet" style = "grid-column:1;grid-row:1">
|
||||||
<div class = "center" id = "build-helmet-stats"></div>
|
<div class = "center" id = "build-helmet-stats"></div>
|
||||||
|
@ -238,25 +244,29 @@
|
||||||
</div>
|
</div>
|
||||||
<div class = "center" id = "build-melee-stats" style = "grid-column:3;grid-row:3">
|
<div class = "center" id = "build-melee-stats" style = "grid-column:3;grid-row:3">
|
||||||
</div>
|
</div>
|
||||||
<div class = "center" id = "build-defense-stats" style = "grid-column:4;grid-row:3">
|
<div class = "center build-overall" id = "build-overall" style = "grid-column:4;grid-row:3">
|
||||||
|
<p class="itemcenter">Overall Build Stats:<p>
|
||||||
|
<div class = "center" id = "build-overall-stats"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--div class = "center" id = "build-defense-stats" style = "grid-column:4;grid-row:3">
|
||||||
|
</div-->
|
||||||
</div>
|
</div>
|
||||||
<div class = "spells">
|
<div class = "spells">
|
||||||
<div class = "center spell-info" id = "spell1" style = "grid-column:1;grid-row:1">
|
<div class = "center spell-info" id = "spell0" style = "grid-column:1;grid-row:1">
|
||||||
<div class = "center" id = "spell1-name">Spell 1</div>
|
<!--div class = "center" id = "spell0-name">Spell 1</div-->
|
||||||
<div class = "center" id = "spell1-info"></div>
|
<div class = "center" id = "spell0-info">Spell 1</div>
|
||||||
</div>
|
</div>
|
||||||
<div class = "center spell-info" id = "spell2" style = "grid-column:2;grid-row:1">
|
<div class = "center spell-info" id = "spell1" style = "grid-column:2;grid-row:1">
|
||||||
<div class = "center" id = "spell2-name">Spell 2</div>
|
<!--div class = "center" id = "spell1-name">Spell 2</div-->
|
||||||
<div class = "center" id = "spell2-info"></div>
|
<div class = "center" id = "spell1-info">Spell 2</div>
|
||||||
</div>
|
</div>
|
||||||
<div class = "center spell-info" id = "spell3" style = "grid-column:3;grid-row:1">
|
<div class = "center spell-info" id = "spell2" style = "grid-column:3;grid-row:1">
|
||||||
<div class = "center" id = "spell3-name">Spell 3</div>
|
<!--div class = "center" id = "spell2-name">Spell 3</div-->
|
||||||
<div class = "center" id = "spell3-info"></div>
|
<div class = "center" id = "spell2-info">Spell 3</div>
|
||||||
</div>
|
</div>
|
||||||
<div class = "center spell-info" id = "spell4" style = "grid-column:4;grid-row:1">
|
<div class = "center spell-info" id = "spell3" style = "grid-column:4;grid-row:1">
|
||||||
<div class = "center" id = "spell4-name">Spell 4</div>
|
<!--div class = "center" id = "spell3-name">Spell 4</div-->
|
||||||
<div class = "center" id = "spell4-info"></div>
|
<div class = "center" id = "spell3-info">Spell 4</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
2
load.js
2
load.js
|
@ -1,4 +1,4 @@
|
||||||
const DB_VERSION = 4;
|
const DB_VERSION = 5;
|
||||||
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js
|
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js
|
||||||
|
|
||||||
let db;
|
let db;
|
||||||
|
|
|
@ -63,10 +63,11 @@ function calculate_skillpoints(equipment, weapon) {
|
||||||
let best_skillpoints = [0, 0, 0, 0, 0];
|
let best_skillpoints = [0, 0, 0, 0, 0];
|
||||||
let best_total = Infinity;
|
let best_total = Infinity;
|
||||||
|
|
||||||
|
let allFalse = [false, false, false, false, false];
|
||||||
if (consider.length > 0 || noboost.length > 0) {
|
if (consider.length > 0 || noboost.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 has_skillpoint = [false, false, false, false, false];
|
let has_skillpoint = allFalse.slice();
|
||||||
|
|
||||||
permutation = permutation.concat(noboost);
|
permutation = permutation.concat(noboost);
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ function calculate_skillpoints(equipment, weapon) {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
result = apply_to_fit(skillpoints, weapon);
|
result = apply_to_fit(skillpoints, weapon, allFalse);
|
||||||
needed_skillpoints = result[0];
|
needed_skillpoints = result[0];
|
||||||
total_diff = result[1];
|
total_diff = result[1];
|
||||||
for (let i = 0; i < 5; ++i) {
|
for (let i = 0; i < 5; ++i) {
|
||||||
|
|
17
styles.css
17
styles.css
|
@ -46,12 +46,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.spell-info {
|
.spell-info {
|
||||||
|
color: #aaa;
|
||||||
|
background: #110110;
|
||||||
border: 2px solid black;
|
border: 2px solid black;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order {
|
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order, .build-overall {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
background: #110110;
|
background: #110110;
|
||||||
border: 2px solid black;
|
border: 2px solid black;
|
||||||
|
@ -75,11 +77,19 @@
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemp {
|
.itemp, .damagep {
|
||||||
margin: 2px 2%;
|
margin: 2px 2%;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.damageSubtitle {
|
||||||
|
text-align: center;
|
||||||
|
margin: 12px 2% 4px;
|
||||||
|
/*margin-bottom: 16px;*/
|
||||||
|
/*margin-top: 16px;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.positive {
|
.positive {
|
||||||
color: #5f5;
|
color: #5f5;
|
||||||
/*text-shadow: 2px 2px 0 #153f15;*/
|
/*text-shadow: 2px 2px 0 #153f15;*/
|
||||||
|
@ -134,6 +144,9 @@
|
||||||
color: #fa0;
|
color: #fa0;
|
||||||
/*text-shadow: 2px 2px 0 #2a2a00;*/
|
/*text-shadow: 2px 2px 0 #2a2a00;*/
|
||||||
}
|
}
|
||||||
|
.Neutral:before {
|
||||||
|
content: "\2724" ' ';
|
||||||
|
}
|
||||||
|
|
||||||
.Health {
|
.Health {
|
||||||
color: #a00;
|
color: #a00;
|
||||||
|
|
132
test.js
132
test.js
|
@ -11,7 +11,7 @@ console.log(url_tag);
|
||||||
* END testing section
|
* END testing section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const BUILD_VERSION = "1.4";
|
const BUILD_VERSION = "2.9";
|
||||||
|
|
||||||
document.getElementById("header").textContent = "Wynn build calculator "+BUILD_VERSION+" (db version "+DB_VERSION+")";
|
document.getElementById("header").textContent = "Wynn build calculator "+BUILD_VERSION+" (db version "+DB_VERSION+")";
|
||||||
|
|
||||||
|
@ -21,8 +21,10 @@ let armorTypes = [ "helmet", "chestplate", "leggings", "boots" ];
|
||||||
let accessoryTypes = [ "ring", "bracelet", "necklace" ];
|
let accessoryTypes = [ "ring", "bracelet", "necklace" ];
|
||||||
let weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ];
|
let weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ];
|
||||||
// THIS IS SUPER DANGEROUS, WE SHOULD NOT BE KEEPING THIS IN SO MANY PLACES
|
// THIS IS SUPER DANGEROUS, WE SHOULD NOT BE KEEPING THIS IN SO MANY PLACES
|
||||||
let item_fields = [ "name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "str", "dex", "int", "agi", "def", "thorns", "exploding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "fixID", "category", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd", "id" ];
|
let item_fields = [ "name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "str", "dex", "int", "agi", "def", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "fixID", "category", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd", "id" ];
|
||||||
let skpReqs = ["strReq", "dexReq", "intReq", "defReq", "agiReq"];
|
|
||||||
|
let skp_order = ["str","dex","int","def","agi"];
|
||||||
|
let skpReqs = skp_order.map(x => x + "Req");
|
||||||
|
|
||||||
let equipment_fields = [
|
let equipment_fields = [
|
||||||
"helmet",
|
"helmet",
|
||||||
|
@ -218,7 +220,9 @@ function populateFromURL() {
|
||||||
let powdering = ["", "", "", "", ""];
|
let powdering = ["", "", "", "", ""];
|
||||||
let info = url_tag.split("_");
|
let info = url_tag.split("_");
|
||||||
let version = info[0];
|
let version = info[0];
|
||||||
if (version === "0" || version === "1") {
|
let save_skp = false;
|
||||||
|
let skillpoints = [0, 0, 0, 0, 0];
|
||||||
|
if (version === "0" || version === "1" || version === "2") {
|
||||||
let equipments = info[1];
|
let equipments = info[1];
|
||||||
for (let i = 0; i < 9; ++i ) {
|
for (let i = 0; i < 9; ++i ) {
|
||||||
equipment[i] = idMap.get(Base64.toInt(equipments.slice(i*3,i*3+3)));
|
equipment[i] = idMap.get(Base64.toInt(equipments.slice(i*3,i*3+3)));
|
||||||
|
@ -246,6 +250,34 @@ function populateFromURL() {
|
||||||
powdering[i] = powders;
|
powdering[i] = powders;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (version === "2") {
|
||||||
|
save_skp = true;
|
||||||
|
let skillpoint_info = info[1].slice(27, 37);
|
||||||
|
for (let i = 0; i < 5; ++i ) {
|
||||||
|
skillpoints[i] = Base64.toIntSigned(skillpoint_info.slice(i*2,i*2+2));
|
||||||
|
}
|
||||||
|
|
||||||
|
let powder_info = info[1].slice(37);
|
||||||
|
console.log(powder_info);
|
||||||
|
// TODO: Make this run in linear instead of quadratic time...
|
||||||
|
for (let i = 0; i < 5; ++i) {
|
||||||
|
let powders = "";
|
||||||
|
let n_blocks = Base64.toInt(powder_info.charAt(0));
|
||||||
|
console.log(n_blocks + " blocks");
|
||||||
|
powder_info = powder_info.slice(1);
|
||||||
|
for (let j = 0; j < n_blocks; ++j) {
|
||||||
|
let block = powder_info.slice(0,5);
|
||||||
|
console.log(block);
|
||||||
|
let six_powders = Base64.toInt(block);
|
||||||
|
for (let k = 0; k < 6 && six_powders != 0; ++k) {
|
||||||
|
powders += powderNames.get((six_powders & 0x1f) - 1);
|
||||||
|
six_powders >>>= 5;
|
||||||
|
}
|
||||||
|
powder_info = powder_info.slice(5);
|
||||||
|
}
|
||||||
|
powdering[i] = powders;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (let i in powderInputs) {
|
for (let i in powderInputs) {
|
||||||
setValue(powderInputs[i], powdering[i]);
|
setValue(powderInputs[i], powdering[i]);
|
||||||
|
@ -253,27 +285,13 @@ function populateFromURL() {
|
||||||
for (let i in equipment) {
|
for (let i in equipment) {
|
||||||
setValue(equipmentInputs[i], equipment[i]);
|
setValue(equipmentInputs[i], equipment[i]);
|
||||||
}
|
}
|
||||||
setValue("str-skp", "0");
|
calculateBuild(save_skp, skillpoints);
|
||||||
setValue("dex-skp", "0");
|
|
||||||
setValue("int-skp", "0");
|
|
||||||
setValue("def-skp", "0");
|
|
||||||
setValue("agi-skp", "0");
|
|
||||||
calculateBuild();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeBuild() {
|
function encodeBuild() {
|
||||||
if (player_build) {
|
if (player_build) {
|
||||||
// let build_string = "0_" + Base64.fromIntN(player_build.helmet.id, 3) +
|
let build_string = "2_" + Base64.fromIntN(player_build.helmet.get("id"), 3) +
|
||||||
// Base64.fromIntN(player_build.chestplate.id, 3) +
|
|
||||||
// Base64.fromIntN(player_build.leggings.id, 3) +
|
|
||||||
// Base64.fromIntN(player_build.boots.id, 3) +
|
|
||||||
// Base64.fromIntN(player_build.ring1.id, 3) +
|
|
||||||
// Base64.fromIntN(player_build.ring2.id, 3) +
|
|
||||||
// Base64.fromIntN(player_build.bracelet.id, 3) +
|
|
||||||
// Base64.fromIntN(player_build.necklace.id, 3) +
|
|
||||||
// Base64.fromIntN(player_build.weapon.id, 3);
|
|
||||||
let build_string = "1_" + Base64.fromIntN(player_build.helmet.get("id"), 3) +
|
|
||||||
Base64.fromIntN(player_build.chestplate.get("id"), 3) +
|
Base64.fromIntN(player_build.chestplate.get("id"), 3) +
|
||||||
Base64.fromIntN(player_build.leggings.get("id"), 3) +
|
Base64.fromIntN(player_build.leggings.get("id"), 3) +
|
||||||
Base64.fromIntN(player_build.boots.get("id"), 3) +
|
Base64.fromIntN(player_build.boots.get("id"), 3) +
|
||||||
|
@ -283,6 +301,10 @@ function encodeBuild() {
|
||||||
Base64.fromIntN(player_build.necklace.get("id"), 3) +
|
Base64.fromIntN(player_build.necklace.get("id"), 3) +
|
||||||
Base64.fromIntN(player_build.weapon.get("id"), 3);
|
Base64.fromIntN(player_build.weapon.get("id"), 3);
|
||||||
|
|
||||||
|
for (const skp of skp_order) {
|
||||||
|
build_string += Base64.fromIntN(getValue(skp + "-skp"), 2); // Maximum skillpoints: 2048
|
||||||
|
}
|
||||||
|
|
||||||
for (const _powderset of player_build.powders) {
|
for (const _powderset of player_build.powders) {
|
||||||
let n_bits = Math.ceil(_powderset.length / 6);
|
let n_bits = Math.ceil(_powderset.length / 6);
|
||||||
build_string += Base64.fromIntN(n_bits, 1); // Hard cap of 378 powders.
|
build_string += Base64.fromIntN(n_bits, 1); // Hard cap of 378 powders.
|
||||||
|
@ -304,7 +326,8 @@ function encodeBuild() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateBuild(){
|
function calculateBuild(save_skp, skp){
|
||||||
|
save_skp = (typeof save_skp !== 'undefined') ? save_skp : false;
|
||||||
/* TODO: implement level changing
|
/* TODO: implement level changing
|
||||||
Make this entire function prettier
|
Make this entire function prettier
|
||||||
*/
|
*/
|
||||||
|
@ -336,22 +359,59 @@ function calculateBuild(){
|
||||||
equip_order_text += item.get("displayName") + "<br>";
|
equip_order_text += item.get("displayName") + "<br>";
|
||||||
}
|
}
|
||||||
setHTML("build-order", equip_order_text);
|
setHTML("build-order", equip_order_text);
|
||||||
|
|
||||||
const assigned = player_build.base_skillpoints;
|
const assigned = player_build.base_skillpoints;
|
||||||
const skillpoints = player_build.total_skillpoints;
|
const skillpoints = player_build.total_skillpoints;
|
||||||
|
|
||||||
let skp_order = ["str","dex","int","def","agi"];
|
|
||||||
let skp_effects = ["% more damage dealt.","% chance to crit.","% spell cost reduction.","% less damage taken.","% chance to dodge."];
|
|
||||||
for (let i in skp_order){ //big bren
|
for (let i in skp_order){ //big bren
|
||||||
setText(skp_order[i] + "-skp-assign", "Before Boosts: " + assigned[i]);
|
|
||||||
setValue(skp_order[i] + "-skp", skillpoints[i]);
|
|
||||||
if(assigned[i] <= 100){
|
if(assigned[i] <= 100){
|
||||||
setText(skp_order[i] + "-skp-base", "Original Value: " + skillpoints[i]);
|
setText(skp_order[i] + "-skp-base", "Original Value: " + skillpoints[i]);
|
||||||
}else{
|
}else{
|
||||||
setHTML(skp_order[i] + "-skp-base", "Original Value: " + skillpoints[i] + "<br>WARNING: cannot assign " + assigned[i] + " skillpoints naturally.");
|
setHTML(skp_order[i] + "-skp-base", "Original Value: " + skillpoints[i] + "<br>WARNING: cannot assign " + assigned[i] + " skillpoints naturally.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (save_skp) {
|
||||||
|
// TODO: reduce duplicated code, @updateStats
|
||||||
|
let skillpoints = player_build.total_skillpoints;
|
||||||
|
let delta_total = 0;
|
||||||
|
for (let i in skp_order) {
|
||||||
|
let manual_assigned = skp[i];
|
||||||
|
let delta = manual_assigned - skillpoints[i];
|
||||||
|
skillpoints[i] = manual_assigned;
|
||||||
|
player_build.base_skillpoints[i] += delta;
|
||||||
|
delta_total += delta;
|
||||||
|
}
|
||||||
|
player_build.assigned_skillpoints += delta_total;
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateBuildStats();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateStats() {
|
||||||
|
let skillpoints = player_build.total_skillpoints;
|
||||||
|
let delta_total = 0;
|
||||||
|
for (let i in skp_order) {
|
||||||
|
let manual_assigned = getValue(skp_order[i] + "-skp");
|
||||||
|
let delta = manual_assigned - skillpoints[i];
|
||||||
|
skillpoints[i] = manual_assigned;
|
||||||
|
player_build.base_skillpoints[i] += delta;
|
||||||
|
delta_total += delta;
|
||||||
|
}
|
||||||
|
player_build.assigned_skillpoints += delta_total;
|
||||||
|
calculateBuildStats();
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateBuildStats() {
|
||||||
|
|
||||||
|
const assigned = player_build.base_skillpoints;
|
||||||
|
const skillpoints = player_build.total_skillpoints;
|
||||||
|
let skp_effects = ["% more damage dealt.","% chance to crit.","% spell cost reduction.","% less damage taken.","% chance to dodge."];
|
||||||
|
for (let i in skp_order){ //big bren
|
||||||
|
setText(skp_order[i] + "-skp-assign", "Manually Assigned: " + assigned[i]);
|
||||||
|
setValue(skp_order[i] + "-skp", skillpoints[i]);
|
||||||
setText(skp_order[i] + "-skp-pct", (skillPointsToPercentage(skillpoints[i])*100).toFixed(1).concat(skp_effects[i]));
|
setText(skp_order[i] + "-skp-pct", (skillPointsToPercentage(skillpoints[i])*100).toFixed(1).concat(skp_effects[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player_build.assigned_skillpoints > levelToSkillPoints(player_build.level)){
|
if(player_build.assigned_skillpoints > levelToSkillPoints(player_build.level)){
|
||||||
setHTML("summary-box", "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints.<br>" + "WARNING: Too many skillpoints need to be assigned!<br> For level " + player_build.level + ", there are only " + levelToSkillPoints(player_build.level) + " skill points available.");
|
setHTML("summary-box", "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints.<br>" + "WARNING: Too many skillpoints need to be assigned!<br> For level " + player_build.level + ", there are only " + levelToSkillPoints(player_build.level) + " skill points available.");
|
||||||
}else{
|
}else{
|
||||||
|
@ -361,10 +421,9 @@ function calculateBuild(){
|
||||||
for (let i in player_build.items) {
|
for (let i in player_build.items) {
|
||||||
displayExpandedItem(player_build.items[i], buildFields[i]);
|
displayExpandedItem(player_build.items[i], buildFields[i]);
|
||||||
}
|
}
|
||||||
calculateBuildStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculateBuildStats() {
|
displayBuildStats(player_build, "build-overall-stats");
|
||||||
|
|
||||||
let meleeStats = player_build.getMeleeStats();
|
let meleeStats = player_build.getMeleeStats();
|
||||||
//nDamAdj,eDamAdj,tDamAdj,wDamAdj,fDamAdj,aDamAdj,totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS
|
//nDamAdj,eDamAdj,tDamAdj,wDamAdj,fDamAdj,aDamAdj,totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS
|
||||||
for (let i = 0; i < 6; ++i) {
|
for (let i = 0; i < 6; ++i) {
|
||||||
|
@ -400,9 +459,16 @@ function calculateBuildStats() {
|
||||||
meleeSummary = meleeSummary.concat("<br>Total Damage: ",meleeStats[7][0]," -> ",meleeStats[7][1],"<br>");
|
meleeSummary = meleeSummary.concat("<br>Total Damage: ",meleeStats[7][0]," -> ",meleeStats[7][1],"<br>");
|
||||||
meleeSummary = meleeSummary.concat("Crit DPS: ",Math.round(meleeStats[9]),"<br><br>");
|
meleeSummary = meleeSummary.concat("Crit DPS: ",Math.round(meleeStats[9]),"<br><br>");
|
||||||
setHTML("build-melee-stats", "".concat(meleeSummary)); //basically complete function
|
setHTML("build-melee-stats", "".concat(meleeSummary)); //basically complete function
|
||||||
let defenseStats = "";
|
//let defenseStats = "";
|
||||||
|
|
||||||
|
//setHTML("build-defense-stats", "".concat(defenseStats));
|
||||||
|
|
||||||
|
let spells = spell_table[player_build.weapon.get("type")];
|
||||||
|
for (let i = 0; i < 4; ++i) {
|
||||||
|
let parent_elem = document.getElementById("spell"+i+"-info");
|
||||||
|
displaySpellDamage(parent_elem, player_build, spells[i], i+1);
|
||||||
|
}
|
||||||
|
|
||||||
setHTML("build-defense-stats", "".concat(defenseStats));
|
|
||||||
location.hash = encodeBuild();
|
location.hash = encodeBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +476,7 @@ function resetFields(){
|
||||||
for (let i in powderInputs) {
|
for (let i in powderInputs) {
|
||||||
setValue(powderInputs[i], "");
|
setValue(powderInputs[i], "");
|
||||||
}
|
}
|
||||||
for (let i in equipment) {
|
for (let i in equipmentInputs) {
|
||||||
setValue(equipmentInputs[i], "");
|
setValue(equipmentInputs[i], "");
|
||||||
}
|
}
|
||||||
setValue("str-skp", "0");
|
setValue("str-skp", "0");
|
||||||
|
|
3
test_regress.txt
Normal file
3
test_regress.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Version 0: http://localhost:8000/#0_0K30oY09X2SJ2SK2SL2SM2SN0QQ
|
||||||
|
Version 1: http://localhost:8000/#1_0690px0CE0QR0050050K40BR0Qk00001004fI
|
||||||
|
Version 2: http://localhost:8000/#2_2SG2SH2SI2SJ2SK0K22SM2SN05n000t210t0000000
|
13
utils.js
13
utils.js
|
@ -69,7 +69,7 @@ Base64 = (function () {
|
||||||
var result = '';
|
var result = '';
|
||||||
for (let i = 0; i < n; ++i) {
|
for (let i = 0; i < n; ++i) {
|
||||||
result = digits[int32 & 0x3f] + result;
|
result = digits[int32 & 0x3f] + result;
|
||||||
int32 >>>= 6;
|
int32 >>= 6;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
@ -81,6 +81,17 @@ Base64 = (function () {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
toIntSigned: function(digitsStr) {
|
||||||
|
var result = 0;
|
||||||
|
var digits = digitsStr.split('');
|
||||||
|
if (digits[0] && (digitsMap[digits[0]] & 0x20)) {
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
|
for (var i = 0; i < digits.length; i++) {
|
||||||
|
result = (result << 6) + digitsMap[digits[i]];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue