From 2815b1f7382128d8522f92771322559d4f4d8da7 Mon Sep 17 00:00:00 2001 From: Florian Quirin <info@bytemind.de> Date: Wed, 24 Jan 2024 13:26:34 +0100 Subject: [PATCH] d4 tool defense calc v0.2.0 update --- apps/d4/defense.html | 2 +- apps/d4/defense.js | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/d4/defense.html b/apps/d4/defense.html index 76eac7d..bd96e8a 100644 --- a/apps/d4/defense.html +++ b/apps/d4/defense.html @@ -33,7 +33,7 @@ <script> var d4cType = "defcalc"; //TODO: this is added to the storage key and can in theory be in conflict with calc name - var d4cVersion = "0.1.0"; + var d4cVersion = "0.2.0"; var d4season = "3"; </script> </head> diff --git a/apps/d4/defense.js b/apps/d4/defense.js index cc47eeb..c9b70a3 100644 --- a/apps/d4/defense.js +++ b/apps/d4/defense.js @@ -224,6 +224,13 @@ function buildCalculator(containerEle, options){ //life var baseLife = data.baseLife; addResult("Base life", baseLife, undefined, lifeItemColorAlt, "Life determined by your character level.", true); + var maximumLifeBase = data.maxlifeItems.reduce(function(totalHp, item){ + if (item.disabled) return totalHp; + else { + return (totalHp + item.life); + } + }, baseLife); + addResult("Base maximum life", maximumLifeBase, undefined, lifeItemColor, "Life after additional flat life boni."); var maximumLifeMulti = data.maxlifeModifiers.reduce(function(totalHp, item){ if (item.disabled) return totalHp; else { @@ -232,16 +239,10 @@ function buildCalculator(containerEle, options){ "Flat contribution of the modifier at this specific point in the calculation (depends on the order).", true); return (totalHp + addLife); } - }, baseLife); - addResult("Modified life", maximumLifeMulti, undefined, lifeItemColor, "Life after multiplicative modifiers."); - var maximumLife = data.maxlifeItems.reduce(function(totalHp, item){ - if (item.disabled) return totalHp; - else { - return (totalHp + item.life); - } - }, maximumLifeMulti); - addResult("Maximum life", maximumLife, undefined, lifeItemColor, "Maximum life with all modifiers (multiplicative and flat)."); + }, maximumLifeBase); + addResult("Total maximum life", maximumLifeMulti, undefined, lifeItemColor, "Total life after multiplicative modifiers."); addCustom("<hr>", "flat"); + var maximumLife = maximumLifeMulti; //total DR - TODO: split in groups? (all, close, distant, affected by dots, fortified etc.) var dmgLeftPct = data.damageReduction.reduce(function(dmgLeft, item){