From 025059819acdebcbc12c6cda21e7fa53e342ed17 Mon Sep 17 00:00:00 2001 From: Nerotox Date: Tue, 26 Mar 2024 18:09:57 +0100 Subject: [PATCH] Adds support for the low life life flask recovery mod + small fix for the Ikiaho's promise unique --- src/Classes/ItemsTab.lua | 11 +++++++++-- src/Modules/CalcPerform.lua | 8 ++++++++ src/Modules/ModParser.lua | 4 +++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 4a6bb11fe2..6967728566 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -3390,8 +3390,15 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode) local lifeMore = modDB:More(nil, "FlaskLifeRecovery") local lifeRateInc = modDB:Sum("INC", nil, "FlaskLifeRecoveryRate") local instantPerc = flaskData.instantPerc + modDB:Sum("BASE", nil, "LifeFlaskInstantRecovery") - local inst = flaskData.lifeBase * instantPerc / 100 * (1 + lifeInc / 100) * lifeMore * (1 + effectInc / 100) - local base = flaskData.lifeBase * (1 - instantPerc / 100) * (1 + lifeInc / 100) * lifeMore * (1 + effectInc / 100) * (1 + durInc / 100) + + -- More life recovery while on low life is not affected by flask effect (verified ingame). + -- Since this will be multiplied by the flask effect value below we have to counteract this by removing the flask effect from the value beforehand. + -- This is also the reason why this value needs a separate multiplier and cannot just be calculated into FlaskLifeRecovery. + local lifeMoreOnLowLife = modDB:More(nil, "FlaskLifeRecoveryLowLife") + local lowLifeMulti = (lifeMoreOnLowLife > 1 and ((lifeMoreOnLowLife - 1) / (1 + effectInc / 100)) + 1 or 1) + + local inst = flaskData.lifeBase * instantPerc / 100 * (1 + lifeInc / 100) * lifeMore * (1 + effectInc / 100) * lowLifeMulti + local base = flaskData.lifeBase * (1 - instantPerc / 100) * (1 + lifeInc / 100) * lifeMore * (1 + effectInc / 100) * (1 + durInc / 100) * lowLifeMulti local grad = base * output.LifeRecoveryRateMod local esGrad = base * output.EnergyShieldRecoveryRateMod lifeDur = flaskData.duration * (1 + durInc / 100) / (1 + rateInc / 100) / (1 + lifeRateInc / 100) diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index 2962ed4507..823adc9e56 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -1352,6 +1352,14 @@ function calcs.perform(env, fullDPSSkipEHP) local flaskTotal = base * (1 - instPerc / 100) * (1 + flaskRecInc / 100) * flaskRecMore * (1 + flaskDurInc / 100) local flaskDur = dur * (1 + flaskDurInc / 100) / (1 + flaskTotalRateInc / 100) / (1 + flaskRateInc / 100) + -- More life recovery while on low life is not affected by flask effect (verified ingame). + -- Since this will be multiplied by the flask effect value below we have to counteract this by removing the flask effect from the value beforehand. + -- This is also the reason why this value needs a separate multiplier and cannot just be calculated into FlaskLifeRecovery. + local lowLifeFlaskRecMore = modDB:More(nil, "FlaskLifeRecoveryLowLife") + if lowLifeFlaskRecMore > 1 then + flaskTotal = flaskTotal * (lType == "life" and ((lowLifeFlaskRecMore - 1) / (1 + (effectInc) / 100)) + 1 or 1) + end + t_insert(out, modLib.createMod(type.."Recovery", "BASE", flaskTotal / flaskDur, name)) if (modDB:Flag(nil, type.."FlaskAppliesToEnergyShield")) then diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua index 281bb9144b..db8c2b6865 100644 --- a/src/Modules/ModParser.lua +++ b/src/Modules/ModParser.lua @@ -749,6 +749,7 @@ local modNameList = { ["amount recovered"] = "FlaskRecovery", ["life recovered"] = "FlaskRecovery", ["life recovery from flasks used"] = "FlaskLifeRecovery", + ["recovery"] = "FlaskLifeRecoveryLowLife", ["mana recovered"] = "FlaskRecovery", ["life recovery from flasks"] = "FlaskLifeRecovery", ["mana recovery from flasks"] = "FlaskManaRecovery", @@ -1454,6 +1455,7 @@ local modTagList = { { type = "StatThreshold", stat = "EvasionOnGloves", threshold = 1}, { type = "StatThreshold", stat = "EvasionOnBoots", threshold = 1} } }, -- Player status conditions + ["if used while on low life"] = { tag = { type = "Condition", var = "LowLife" } }, ["wh[ie][ln]e? on low life"] = { tag = { type = "Condition", var = "LowLife" } }, ["on reaching low life"] = { tag = { type = "Condition", var = "LowLife" } }, ["wh[ie][ln]e? not on low life"] = { tag = { type = "Condition", var = "LowLife", neg = true } }, @@ -2628,7 +2630,7 @@ local specialModList = { ["gain life from leech instantly from hits with this weapon"] = { mod("InstantLifeLeech", "BASE", 100, { type = "Condition", var = "{Hand}Attack" }, { type = "SkillType", skillType = SkillType.Attack }) }, ["(%d+)%% of leech from hits with this weapon is instant per enemy power"] = function(num) return { mod("InstantLifeLeech", "BASE", num, nil, ModFlag.Hit, { type = "Condition", var = "{Hand}Attack" }, { type = "SkillType", skillType = SkillType.Attack }, { type = "Multiplier", var = "EnemyPower"}) } end, ["instant recovery"] = { mod("FlaskInstantRecovery", "BASE", 100) }, - ["life flasks used while on low life apply recovery instantly"] = { mod("LifeFlaskInstantRecovery", "BASE", 100, { type = "Condition", var = "LowMana" }) }, + ["life flasks used while on low life apply recovery instantly"] = { mod("LifeFlaskInstantRecovery", "BASE", 100, { type = "Condition", var = "LowLife" }) }, ["mana flasks used while on low mana apply recovery instantly"] = { mod("ManaFlaskInstantRecovery", "BASE", 100, { type = "Condition", var = "LowMana" }) }, ["(%d+)%% of recovery applied instantly"] = function(num) return { mod("FlaskInstantRecovery", "BASE", num) } end, ["has no attribute requirements"] = { flag("NoAttributeRequirements") },