Skip to content

Commit 8252964

Browse files
RealWhimsylJackermeier
andauthored
Add parsing for "Your speed is unaffected by Slows" (#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 <lukas.jackermeier@nexis-secure.com>
1 parent 45f3bf7 commit 8252964

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

src/Classes/ModStore.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,24 @@ function ModStoreClass:Sum(modType, cfg, ...)
138138
return self:SumInternal(self, modType, cfg, flags, keywordFlags, source, ...)
139139
end
140140

141+
142+
--- Returns the value of all positive modifiers to a mod added together, ignoring any negative modifiers.
143+
--- Works by creating a table using Tabulate and then filtering for positive values.
144+
---
145+
--- @param modType string # the mod type for which we want to create the table, e.g. "INC" or "MORE"
146+
--- @param cfg table | nil # passed configuration, may be nil
147+
--- @param modName string # the name of the mod for which we want to create the table, e.g. "FlaskRecoveryRate", "ActionSpeed", ...
148+
function ModStoreClass:SumPositiveValues(modType, cfg, modName, ...)
149+
local total = 0
150+
local modTable = self:Tabulate(modType, cfg, modName)
151+
for i = 1, #modTable do
152+
if modTable[i].value > 0 then
153+
total = total + modTable[i].value
154+
end
155+
end
156+
return total
157+
end
158+
141159
function ModStoreClass:More(cfg, ...)
142160
local flags, keywordFlags = 0, 0
143161
local source

src/Modules/CalcPerform.lua

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,11 +748,24 @@ local function doActorCharges(env, actor)
748748
modDB.multipliers["SpiritCharge"] = output.SpiritCharges
749749
end
750750

751+
751752
function calcs.actionSpeedMod(actor)
752753
local modDB = actor.modDB
753754
local minimumActionSpeed = modDB:Max(nil, "MinimumActionSpeed") or 0
754755
local maximumActionSpeedReduction = modDB:Max(nil, "MaximumActionSpeedReduction")
755-
local actionSpeedMod = 1 + (m_max(-data.misc.TemporalChainsEffectCap, modDB:Sum("INC", nil, "TemporalChainsActionSpeed")) + modDB:Sum("INC", nil, "ActionSpeed")) / 100
756+
local actionSpeedSum
757+
local tempChainsSum
758+
759+
-- if we are unaffected by slows, only count the positive modifiers to action speed
760+
if modDB:Flag(nil, "UnaffectedBySlows") then
761+
actionSpeedSum = modDB:SumPositiveValues("INC", nil, "ActionSpeed")
762+
tempChainsSum = modDB:SumPositiveValues("INC", nil, "TemporalChainsActionSpeed")
763+
else
764+
actionSpeedSum = modDB:Sum("INC", nil, "ActionSpeed")
765+
tempChainsSum = modDB:Sum("INC", nil, "TemporalChainsActionSpeed")
766+
end
767+
768+
local actionSpeedMod = 1 + (m_max(-data.misc.TemporalChainsEffectCap, tempChainsSum) + actionSpeedSum) / 100
756769
actionSpeedMod = m_max(minimumActionSpeed / 100, actionSpeedMod)
757770
if maximumActionSpeedReduction then
758771
actionSpeedMod = m_min((100 - maximumActionSpeedReduction) / 100, actionSpeedMod)

src/Modules/ModParser.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2782,6 +2782,7 @@ local specialModList = {
27822782
mod("PhysicalDamageGainAsChaos", "BASE", num, { type = "SkillType", skillType = SkillType.Triggered, neg = true }, { type = "SkillType", skillType = SkillType.Channel, neg = true }, { type = "Condition", var = "UsingAmethystFlask" })
27832783
} end,
27842784
["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,
2785+
["your speed is unaffected by slows"] = { flag("UnaffectedBySlows") },
27852786
-- Raider
27862787
["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,
27872788
["immun[ei]t?y? to elemental ailments while phasing"] = { flag("ElementalAilmentImmune", { type = "Condition", var = "Phasing" }), },

0 commit comments

Comments
 (0)