fixed NaN ehp/ehpr for daggers. in the middle of powder special display.

This commit is contained in:
ferricles 2021-01-10 22:49:52 -08:00
parent f7e335d35c
commit 208b4e2378
3 changed files with 65 additions and 2 deletions

View file

@ -1,7 +1,7 @@
const baseDamageMultiplier = [ 0.51, 0.83, 1.5, 2.05, 2.5, 3.1, 4.3 ]; const baseDamageMultiplier = [ 0.51, 0.83, 1.5, 2.05, 2.5, 3.1, 4.3 ];
const attackSpeeds = ["SUPER_SLOW", "VERY_SLOW", "SLOW", "NORMAL", "FAST", "VERY_FAST", "SUPER_FAST"]; const attackSpeeds = ["SUPER_SLOW", "VERY_SLOW", "SLOW", "NORMAL", "FAST", "VERY_FAST", "SUPER_FAST"];
const classDefenseMultipliers = new Map([ ["relik",0.60], ["bow",0.60], ["wand", 0.80], ["assassin", 1.0], ["spear",1.20] ]); const classDefenseMultipliers = new Map([ ["relik",0.60], ["bow",0.60], ["wand", 0.80], ["dagger", 1.0], ["spear",1.20] ]);
/*Turns the input amount of skill points into a float precision percentage. /*Turns the input amount of skill points into a float precision percentage.
* @param skp - the integer skillpoint count to be converted * @param skp - the integer skillpoint count to be converted

View file

@ -44,6 +44,17 @@ function expandItem(item, powders){
expandedItem.set("minRolls",minRolls); expandedItem.set("minRolls",minRolls);
expandedItem.set("maxRolls",maxRolls); expandedItem.set("maxRolls",maxRolls);
expandedItem.set("powders", powders); expandedItem.set("powders", powders);
if(expandedItem.has("eDef")){ //item is armor
for(const id of powders){
//console.log(powderStats[id]);
let powder = powderStats[id];
let name = powderNames.get(id);
expandedItem.set(name.charAt(0) + "Def", expandedItem.get(name.charAt(0)+"Def") + powder["defPlus"]);
expandedItem.set(skp_elements[(skp_elements.indexOf(name.charAt(0)) + 6 )% 5] + "Def", expandedItem.get(skp_elements[(skp_elements.indexOf(name.charAt(0)) + 6 )% 5]+"Def") - powder["defMinus"]);
}
}
return expandedItem; return expandedItem;
} }
@ -348,7 +359,6 @@ function displayExpandedItem(item, parent_id){
for(let i = 0; i < powderList.length; i++){ for(let i = 0; i < powderList.length; i++){
let powder = document.createElement("td"); let powder = document.createElement("td");
let powderStr = powderList[i]; let powderStr = powderList[i];
console.log(powderStr);
powder.textContent = numerals.get(powderStr.charAt(1), 10); powder.textContent = numerals.get(powderStr.charAt(1), 10);
powder.classList.add(powderMap.get(powderStr.charAt(0))); powder.classList.add(powderMap.get(powderStr.charAt(0)));
powder.classList.add("nopadding"); powder.classList.add("nopadding");
@ -432,6 +442,39 @@ function displayExpandedItem(item, parent_id){
}//Just don't do anything if else }//Just don't do anything if else
} }
} }
//Show powder specials ;-;
let powder_special = document.createElement("p");
powder_special.classList.add("left");
powder_special.classList.add("itemp");
let powders = item.get("powders");
let element = "";
let power = 0;
for (let i = 0; i < powders.length; i++) {
let firstPowderType = skp_elements[Math.floor(powders[i]/6)];
if (element !== "") break;
else if (powders[i]%6 > 2) { //t4+
for (let j = i+1; j < powders.length; j++) {
let currentPowderType = skp_elements[Math.floor(powders[j]/6)]
if (powders[j] % 6 > 2 && firstPowderType === currentPowderType) {
element = currentPowderType;
power = Math.round(((powders[i] % 6 + powders[j] % 6 + 2) / 2 - 4) * 2);
break;
}
}
}
}
if (element !== "") {//powder special is "[e,t,w,f,a]+[0,1,2,3,4]"
console.log(skp_elements.indexOf(element));
let powderSpecial = powderSpecialStats[ skp_elements.indexOf(element)];
let attackSpecialTitle = document.createElement("p");
attackSpecialTitle.classList.add("left");
attackSpecialTitle.textContent = powderSpecial["weaponSpecialName"];
powder_special.appendChild(attackSpecialTitle);
parent_div.append(powder_special);
}
//Show item tier
if (item.get("tier") & item.get("tier") !== " ") { if (item.get("tier") & item.get("tier") !== " ") {
let item_desc_elem = document.createElement('p'); let item_desc_elem = document.createElement('p');
item_desc_elem.classList.add('itemp'); item_desc_elem.classList.add('itemp');

20
test.js
View file

@ -91,6 +91,26 @@ let powderStats = [
_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,18,28,24,9), _p(16,18,35,34,13)
]; ];
//Ordering: [weapon special name, weapon special effects, armor special name, armor special effects]
class PowderSpecial{
constructor(wSpName, wSpEff, aSpName, aSpEff, cap){
this.weaponSpecialName = wSpName;
this.weaponSpecialEffects = wSpEff;
this.armorSpecialName = aSpName;
this.armorSpecialEffects = aSpEff;
this.cap = cap;
}
}
function _ps(a,b,c,d,e) { return new PowderSpecial(a,b,c,d,e); } //bruh moment
let powderSpecialStats = [
_ps("Quake",new Map([["Radius",[5,5.5,6,6.5,7]], ["Damage",[155,220,285,350,415]] ]),"Rage",new Map([ ["Damage", [0.3,0.4,0.5,0.7,1.0]],["Description", "% \2764 Missing"] ]),400), //e
_ps("Chain Lightning",new Map([ ["Chains", [5,6,7,8,9]], ["Damage", [80,120,160,200,240]] ]),"Kill Streak",new Map([ ["Damage", [3,4.5,6,7.5,9]],["Duration", [5,5,5,5,5]],["Description", "Mob Killed"] ]),200), //t
_ps("Curse",new Map([ ["Duration", [7,7.5,8,8.5,9]],["Damage", [90,120,150,180,210]] ]),"Concentration",new Map([ ["Damage", [1,2,3,4,5]],["Duration",[1,1,1,1,1]],["Description", "Mana Used"] ]),150), //w
_ps("Courage",new Map([ ["Duration", [6,6.5,7,7.5,8]],["Damage", [75,87.5,100,112.5,125]],["Damage Boost", [70,90,110,130,150]] ]),"Endurance",new Map([ ["Damage", [2,3,4,5,6]],["Duration", [8,8,8,8,8]],["Description", "Hit Taken"] ]),200), //f
_ps("Air Prison",new Map([ ["Duration", [3,3.5,4,4.5,5]],["Damage Boost", [400,450,500,550,600]],["Knockback", [8,12,16,20,24]] ]),"Dodge",new Map([ ["Damage",[2,3,4,5,6]],["Duration",[2,3,4,5,6]],["Description","Near Mobs"] ]),150) //a
];
let itemTypes = armorTypes.concat(accessoryTypes).concat(weaponTypes); let itemTypes = armorTypes.concat(accessoryTypes).concat(weaponTypes);
let itemLists = new Map(); let itemLists = new Map();
for (const it of itemTypes) { for (const it of itemTypes) {