Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for the "%d more recovery if used while on low life" Life flask mod #7477

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 } },
Expand Down Expand Up @@ -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") },
Expand Down