Skip to content

Commit

Permalink
d4 tool defense calc v0.2.0 update
Browse files Browse the repository at this point in the history
  • Loading branch information
fquirin committed Jan 24, 2024
1 parent cf9c14c commit 2815b1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/d4/defense.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
19 changes: 10 additions & 9 deletions apps/d4/defense.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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){
Expand Down

0 comments on commit 2815b1f

Please sign in to comment.