From 2f82f888e2b3a0f9f52a6c4f99aacaddb4e619fd Mon Sep 17 00:00:00 2001 From: ferricles Date: Mon, 11 Jan 2021 00:10:33 -0800 Subject: [PATCH] light aesthetic changes, negative poison fix --- display.js | 48 ++++++++++++++++++++++++++++-------------------- styles.css | 2 +- test.js | 1 + 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/display.js b/display.js index 03fc06b..5dcf29f 100644 --- a/display.js +++ b/display.js @@ -474,7 +474,7 @@ function displayExpandedItem(item, parent_id){ 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 specialSuffixes = new Map([ ["Duration", " seconds"], ["Radius", " blocks"], ["Chains", ""], ["Damage", "%"], ["Damage Boost", "%"], ["Knockback", " blocks"] ]); + let specialSuffixes = new Map([ ["Duration", " sec"], ["Radius", " blocks"], ["Chains", ""], ["Damage", "%"], ["Damage Boost", "%"], ["Knockback", " blocks"] ]); let specialTitle = document.createElement("p"); let specialEffects = document.createElement("p"); specialTitle.classList.add("left"); @@ -483,35 +483,43 @@ function displayExpandedItem(item, parent_id){ specialEffects.classList.add("left"); specialEffects.classList.add("itemp"); specialEffects.classList.add("nocolor"); - + let effects; if (item.get("category") === "weapon") {//weapon + effects = powderSpecial["weaponSpecialEffects"]; specialTitle.textContent = powderSpecial["weaponSpecialName"]; - let effects = powderSpecial["weaponSpecialEffects"]; - for (const [key,value] of effects) { + /*for (const [key,value] of effects) { let effect = document.createElement("p"); effect.classList.add("itemp"); effect.textContent += key + ": " + value[power] + specialSuffixes.get(key); + if(key === "Damage"){ + effect.textContent += elementIcons[skp_elements.indexOf(element)]; + } specialEffects.appendChild(effect); } specialTitle.append(specialEffects); - powder_special.appendChild(specialTitle); + powder_special.appendChild(specialTitle);*/ }else if (item.get("category") === "armor") {//armor - let effects = powderSpecial["armorSpecialEffects"]; + effects = powderSpecial["armorSpecialEffects"]; specialTitle.textContent += powderSpecial["armorSpecialName"] + ": "; - - for (const [key,value] of effects) { - if (key !== "Description") { - let effect = document.createElement("p"); - effect.classList.add("itemp"); - effect.textContent += key + ": " + value[power] + specialSuffixes.get(key); - specialEffects.appendChild(effect); - }else{ - specialTitle.textContent += "[ " + effects.get("Description") + " ]"; - } - } - specialTitle.append(specialEffects); - powder_special.appendChild(specialTitle); } + for (const [key,value] of effects) { + if (key !== "Description") { + let effect = document.createElement("p"); + effect.classList.add("itemp"); + effect.textContent += key + ": " + value[power] + specialSuffixes.get(key); + if(key === "Damage"){ + effect.textContent += elementIcons[skp_elements.indexOf(element)]; + } + if (element === "w") { + effect.textContent += " / Mana Used"; + } + specialEffects.appendChild(effect); + }else{ + specialTitle.textContent += "[ " + effects.get("Description") + " ]"; + } + } + specialTitle.append(specialEffects); + powder_special.appendChild(specialTitle); parent_div.append(powder_special); @@ -601,7 +609,7 @@ function displayPoisonDamage(overallparent_elem, build) { let overallpoisonDamage = document.createElement("p"); overallpoisonDamage.classList.add("itemp"); let poison_tick = Math.floor(build.statMap.get("poison") * (1+skillPointsToPercentage(build.total_skillpoints[0]))/3); - overallpoisonDamage.textContent = "Poison Tick: " + poison_tick; + overallpoisonDamage.textContent = "Poison Tick: " + Math.max(poison_tick,0); overallparent_elem.append(overallpoisonDamage); overallparent_elem.append(document.createElement("br")); } diff --git a/styles.css b/styles.css index f53dfca..1dc0d09 100644 --- a/styles.css +++ b/styles.css @@ -251,5 +251,5 @@ input { color:#5f5; } .restrict { - color: #ff006a; + color: #ff8180; } diff --git a/test.js b/test.js index 1fe6e31..192496f 100644 --- a/test.js +++ b/test.js @@ -25,6 +25,7 @@ let item_fields = [ "name", "displayName", "tier", "set", "slots", "type", "mate let skp_order = ["str","dex","int","def","agi"]; let skp_elements = ["e","t","w","f","a"]; +let elementIcons = ["\u2724","\u2726", "\u2749", "\u2739", "\u274b" ]; let skpReqs = skp_order.map(x => x + "Req"); let equipment_fields = [