Remove ambivalence, add error logging, add strength boosts

This commit is contained in:
b 2021-01-12 17:14:12 -06:00
parent 400ad9943c
commit a310eee0a6
8 changed files with 112 additions and 157 deletions

View file

@ -64,59 +64,59 @@ class Build{
this.powders[0] = this.powders[0].slice(0,helmet.slots);
this.helmet = expandItem(helmet, this.powders[0]);
}else{
throw new TypeError("No such helmet named ", equipment[0]);
throw new TypeError("No such helmet named "+ equipment[0]);
}
if(itemMap.get(equipment[1]).type === "chestplate") {
if(itemMap.get(equipment[1]) && itemMap.get(equipment[1]).type === "chestplate") {
const chestplate = itemMap.get(equipment[1]);
this.powders[1] = this.powders[1].slice(0,chestplate.slots);
this.chestplate = expandItem(chestplate, this.powders[1]);
}else{
throw new TypeError("No such chestplate named ", equipment[1]);
throw new TypeError("No such chestplate named "+ equipment[1]);
}
if(itemMap.get(equipment[2]).type === "leggings") {
if(itemMap.get(equipment[2]) && itemMap.get(equipment[2]).type === "leggings") {
const leggings = itemMap.get(equipment[2]);
this.powders[2] = this.powders[2].slice(0,leggings.slots);
this.leggings = expandItem(leggings, this.powders[2]);
}else{
throw new TypeError("No such leggings named ", equipment[2]);
throw new TypeError("No such leggings named "+ equipment[2]);
}
if(itemMap.get(equipment[3]).type === "boots") {
if(itemMap.get(equipment[3]) && itemMap.get(equipment[3]).type === "boots") {
const boots = itemMap.get(equipment[3]);
this.powders[3] = this.powders[3].slice(0,boots.slots);
this.boots = expandItem(boots, this.powders[3]);
}else{
throw new TypeError("No such boots named ", equipment[3]);
throw new TypeError("No such boots named "+ equipment[3]);
}
if(itemMap.get(equipment[4]).type === "ring") {
if(itemMap.get(equipment[4]) && itemMap.get(equipment[4]).type === "ring") {
const ring = itemMap.get(equipment[4]);
this.ring1 = expandItem(ring, []);
}else{
throw new TypeError("No such ring named ", equipment[4]);
throw new TypeError("No such ring named "+ equipment[4]);
}
if(itemMap.get(equipment[5]).type === "ring") {
if(itemMap.get(equipment[5]) && itemMap.get(equipment[5]).type === "ring") {
const ring = itemMap.get(equipment[5]);
this.ring2 = expandItem(ring, []);
}else{
throw new TypeError("No such ring named ", equipment[5]);
throw new TypeError("No such ring named "+ equipment[5]);
}
if(itemMap.get(equipment[6]).type === "bracelet") {
if(itemMap.get(equipment[6]) && itemMap.get(equipment[6]).type === "bracelet") {
const bracelet = itemMap.get(equipment[6]);
this.bracelet = expandItem(bracelet, []);
}else{
throw new TypeError("No such bracelet named ", equipment[6]);
throw new TypeError("No such bracelet named "+ equipment[6]);
}
if(itemMap.get(equipment[7]).type === "necklace") {
if(itemMap.get(equipment[7]) && itemMap.get(equipment[7]).type === "necklace") {
const necklace = itemMap.get(equipment[7]);
this.necklace = expandItem(necklace, []);
}else{
throw new TypeError("No such necklace named ", equipment[7]);
throw new TypeError("No such necklace named "+ equipment[7]);
}
if(itemMap.get(equipment[8]).category === "weapon") {
if(itemMap.get(equipment[8]) && itemMap.get(equipment[8]).category === "weapon") {
const weapon = itemMap.get(equipment[8]);
this.powders[4] = this.powders[4].slice(0,weapon.slots);
this.weapon = expandItem(weapon, this.powders[4]);
}else{
throw new TypeError("No such weapon named ", equipment[8]);
throw new TypeError("No such weapon named "+ equipment[8]);
}
if(level < 1){ //Should these be constants?
this.level = 1;

View file

@ -57924,82 +57924,6 @@
"gSpd": 0,
"id": 772
},
{
"name": "Ambivalence",
"tier": "Legendary",
"set": null,
"quest": null,
"poison": 0,
"thorns": 0,
"sprint": 0,
"category": "accessory",
"slots": 0,
"drop": "never",
"restrict": "Untradable",
"hp": 0,
"fDef": 70,
"wDef": 0,
"aDef": 70,
"tDef": 70,
"eDef": 0,
"lvl": 100,
"classReq": null,
"strReq": 0,
"dexReq": 40,
"intReq": 0,
"agiReq": 40,
"defReq": 40,
"hprPct": 0,
"mr": 0,
"sdPct": 250,
"mdPct": 0,
"ls": 0,
"ms": 0,
"xpb": 0,
"lb": 0,
"ref": 0,
"str": 0,
"dex": 0,
"int": -70,
"agi": 0,
"def": 0,
"expd": 0,
"spd": 0,
"atkTier": 0,
"hpBonus": 0,
"spRegen": 0,
"eSteal": 0,
"hprRaw": 0,
"sdRaw": 0,
"mdRaw": 0,
"fDamPct": 0,
"wDamPct": 50,
"aDamPct": 0,
"tDamPct": 0,
"eDamPct": 0,
"fDefPct": 0,
"wDefPct": 0,
"aDefPct": 0,
"tDefPct": 0,
"eDefPct": 0,
"type": "necklace",
"fixID": true,
"spPct1": 130,
"spRaw1": 0,
"spPct2": 85,
"spRaw2": 0,
"spPct3": 130,
"spRaw3": 0,
"spPct4": 100,
"spRaw4": 0,
"rainbowRaw": 0,
"sprintReg": 0,
"jh": 0,
"lq": 0,
"gXp": 0,
"gSpd": 0,
"id": 773
},
{
"name": "Algaa",
"tier": "Rare",

File diff suppressed because one or more lines are too long

View file

@ -50,7 +50,7 @@ function expandItem(item, powders){
expandedItem.set("maxRolls",maxRolls);
expandedItem.set("powders", powders);
if(expandedItem.has("eDef")){ //item is armor
if(expandedItem.get("category") == "armor"){ //item is armor
for(const id of powders){
//console.log(powderStats[id]);
let powder = powderStats[id];
@ -708,7 +708,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
//overall average DPS
let singleHitDamage = document.createElement("p");
singleHitDamage.classList.add("itemp");
console.log(stats);
singleHitDamage.textContent = "Single Hit Average: " + stats[12].toFixed(2);
overallparent_elem.append(singleHitDamage);
overallparent_elem.append(document.createElement("br"));

View file

@ -206,7 +206,7 @@
</td>
</tr>
</table>
<div class = "powder-specials">
<!--div class = "powder-specials">
<div class = "powder-special-stats" style = "grid-column:1;grid-row:1">
<div class = "center" id = "powder-special-stats">
<p class = "itemp">Powder Specials</p>
@ -384,7 +384,7 @@
</div>
</div>
</div>
</div>
</div-->
</div>
</div>
</div>

View file

@ -1,4 +1,4 @@
const DB_VERSION = 14;
const DB_VERSION = 15;
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js
let db;

36
test.js
View file

@ -11,9 +11,13 @@ console.log(url_tag);
* END testing section
*/
const BUILD_VERSION = "6.8.2";
const BUILD_VERSION = "6.8.3";
function setTitle() {
document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (db version "+DB_VERSION+")";
}
setTitle();
let player_build;
// Set up item lists for quick access later.
@ -383,6 +387,11 @@ function encodeBuild() {
}
function calculateBuild(save_skp, skp){
try {
for (const boost of ["vanish", "warscream", "yourtotem", "allytotem"]) {
let elem = document.getElementById(boost+"-boost");
elem.classList.remove("toggleOn");
}
save_skp = (typeof save_skp !== 'undefined') ? save_skp : false;
/* TODO: implement level changing
Make this entire function prettier
@ -401,7 +410,12 @@ function calculateBuild(save_skp, skp){
let powdering = [];
while (input) {
let first = input.slice(0, 2);
powdering.push(powderIDs.get(first));
let powder = powderIDs.get(first);
console.log(powder);
if (powder === undefined) {
throw new TypeError("Invalid powder " + powder + " in slot " + i);
}
powdering.push(powder);
input = input.slice(2);
}
powderings.push(powdering);
@ -441,7 +455,23 @@ function calculateBuild(save_skp, skp){
}
calculateBuildStats();
setTitle();
}
catch (error) {
let msg = error.stack;
let lines = msg.split("\n");
let header = document.getElementById("header");
header.textContent = "";
for (const line of lines) {
let p = document.createElement("p");
p.classList.add("itemp");
p.textContent = line;
header.appendChild(p);
}
let p2 = document.createElement("p");
p2.textContent = "If you believe this is an error, contact hppeng on forums or discord.";
header.appendChild(p2);
}
}
/* Updates all build statistics based on (for now) the skillpoint input fields and then calculates build stats.

View file

@ -4,6 +4,8 @@ NOTE!!!!!!!
DEMON TIDE 1.20 IS HARD CODED!
AMBIVALENCE IS REMOVED!
"""
import json