Skip to content

Commit

Permalink
Add parsing for "Your speed is unaffected by Slows" (PathOfBuildingCo…
Browse files Browse the repository at this point in the history
…mmunity#700)

* add support for parsing "your speed is unaffected by slows" found on pathfinder and wanderlust

* fixed incorrect behavior of "your speed is unaffected by slows"

* added cap on temporal chains effect when using the "UnaffectedBySlows" tag

* improved readability of calcs.actionSpeedMod, made SumPositiveValues function available via ModStore.lua

---------

Co-authored-by: lJackermeier <[email protected]>
  • Loading branch information
RealWhimsy and lJackermeier authored Feb 7, 2025
1 parent 45f3bf7 commit 8252964
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/Classes/ModStore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ function ModStoreClass:Sum(modType, cfg, ...)
return self:SumInternal(self, modType, cfg, flags, keywordFlags, source, ...)
end


--- Returns the value of all positive modifiers to a mod added together, ignoring any negative modifiers.
--- Works by creating a table using Tabulate and then filtering for positive values.
---
--- @param modType string # the mod type for which we want to create the table, e.g. "INC" or "MORE"
--- @param cfg table | nil # passed configuration, may be nil
--- @param modName string # the name of the mod for which we want to create the table, e.g. "FlaskRecoveryRate", "ActionSpeed", ...
function ModStoreClass:SumPositiveValues(modType, cfg, modName, ...)
local total = 0
local modTable = self:Tabulate(modType, cfg, modName)
for i = 1, #modTable do
if modTable[i].value > 0 then
total = total + modTable[i].value
end
end
return total
end

function ModStoreClass:More(cfg, ...)
local flags, keywordFlags = 0, 0
local source
Expand Down
15 changes: 14 additions & 1 deletion src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -748,11 +748,24 @@ local function doActorCharges(env, actor)
modDB.multipliers["SpiritCharge"] = output.SpiritCharges
end


function calcs.actionSpeedMod(actor)
local modDB = actor.modDB
local minimumActionSpeed = modDB:Max(nil, "MinimumActionSpeed") or 0
local maximumActionSpeedReduction = modDB:Max(nil, "MaximumActionSpeedReduction")
local actionSpeedMod = 1 + (m_max(-data.misc.TemporalChainsEffectCap, modDB:Sum("INC", nil, "TemporalChainsActionSpeed")) + modDB:Sum("INC", nil, "ActionSpeed")) / 100
local actionSpeedSum
local tempChainsSum

-- if we are unaffected by slows, only count the positive modifiers to action speed
if modDB:Flag(nil, "UnaffectedBySlows") then
actionSpeedSum = modDB:SumPositiveValues("INC", nil, "ActionSpeed")
tempChainsSum = modDB:SumPositiveValues("INC", nil, "TemporalChainsActionSpeed")
else
actionSpeedSum = modDB:Sum("INC", nil, "ActionSpeed")
tempChainsSum = modDB:Sum("INC", nil, "TemporalChainsActionSpeed")
end

local actionSpeedMod = 1 + (m_max(-data.misc.TemporalChainsEffectCap, tempChainsSum) + actionSpeedSum) / 100
actionSpeedMod = m_max(minimumActionSpeed / 100, actionSpeedMod)
if maximumActionSpeedReduction then
actionSpeedMod = m_min((100 - maximumActionSpeedReduction) / 100, actionSpeedMod)
Expand Down
1 change: 1 addition & 0 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2782,6 +2782,7 @@ local specialModList = {
mod("PhysicalDamageGainAsChaos", "BASE", num, { type = "SkillType", skillType = SkillType.Triggered, neg = true }, { type = "SkillType", skillType = SkillType.Channel, neg = true }, { type = "Condition", var = "UsingAmethystFlask" })
} end,
["double the number of your poisons that targets can be affected by at the same time"] = function(num) return { flag("PoisonCanStack"), mod("PoisonStacks", "MORE", 100) } end,
["your speed is unaffected by slows"] = { flag("UnaffectedBySlows") },
-- Raider
["nearby enemies have (%d+)%% less accuracy rating while you have phasing"] = function(num) return { mod("EnemyModifier", "LIST", { mod = mod("Accuracy", "MORE", -num) }, { type = "Condition", var = "Phasing" }) } end,
["immun[ei]t?y? to elemental ailments while phasing"] = { flag("ElementalAilmentImmune", { type = "Condition", var = "Phasing" }), },
Expand Down

0 comments on commit 8252964

Please sign in to comment.