From 8772d33fe1c20cfe6b6d5541941f317d6f63622a Mon Sep 17 00:00:00 2001 From: b Date: Sat, 9 Jan 2021 05:56:10 -0600 Subject: [PATCH] Add healing --- build.js | 6 +++--- display.js | 12 ++++++++++++ test.js | 3 +-- utils.js | 1 - 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/build.js b/build.js index 5fe47df..70e8b3d 100644 --- a/build.js +++ b/build.js @@ -152,9 +152,9 @@ class Build{ */ getHealth(){ let health = levelToHPBase(this.level); - for (const item in this.items) { - if (item.hp) health += item.hp; - if (item.hpBonus) health += item.hpBonus; + for (const item of this.items) { + if (item.get("hp")) health += item.get("hp"); + if (item.get("hpBonus")) health += item.get("hpBonus"); } if(health<5){ return 5; diff --git a/display.js b/display.js index 2628c0f..4f27e00 100644 --- a/display.js +++ b/display.js @@ -50,6 +50,7 @@ function idRound(id){ return rounded; } } + function displayExpandedItem(item, parent_id){ // Commands to "script" the creation of nice formatting. // #commands create a new element. @@ -245,6 +246,10 @@ function displayExpandedItem(item, parent_id){ parent_div.append(item_desc_elem); } +function displayFixedID(id, value) { + +} + function displaySpellDamage(parent_elem, build, spell, spellIdx) { parent_elem.textContent = ""; @@ -326,6 +331,13 @@ function displaySpellDamage(parent_elem, build, spell, spellIdx) { } 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) { diff --git a/test.js b/test.js index 564e8fd..db46a42 100644 --- a/test.js +++ b/test.js @@ -11,7 +11,7 @@ console.log(url_tag); * END testing section */ -const BUILD_VERSION = "2.5"; +const BUILD_VERSION = "2.6"; document.getElementById("header").textContent = "Wynn build calculator "+BUILD_VERSION+" (db version "+DB_VERSION+")"; @@ -301,7 +301,6 @@ function encodeBuild() { Base64.fromIntN(player_build.necklace.get("id"), 3) + Base64.fromIntN(player_build.weapon.get("id"), 3); - console.log("NOW"); for (const skp of skp_order) { build_string += Base64.fromIntN(getValue(skp + "-skp"), 2); // Maximum skillpoints: 2048 } diff --git a/utils.js b/utils.js index 5776372..c00a2a0 100644 --- a/utils.js +++ b/utils.js @@ -68,7 +68,6 @@ Base64 = (function () { fromIntN: function(int32, n) { var result = ''; for (let i = 0; i < n; ++i) { - console.log(int32); result = digits[int32 & 0x3f] + result; int32 >>= 6; }