Add healing

This commit is contained in:
b 2021-01-09 05:56:10 -06:00
parent 17d4b2b45d
commit 8772d33fe1
4 changed files with 16 additions and 6 deletions

View file

@ -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;

View file

@ -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) {

View file

@ -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
}

View file

@ -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;
}