Skip to content

Commit 2f7283d

Browse files
czarandyLocalIdentity
andauthored
Add support for Runegraft of the Agile (#9963)
* Add Runegraft of the Agile to Elusive average * Fix calculation when having a source of slower decay Also didn't allow you to manually set the max value of elusive --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent c08ec60 commit 2f7283d

4 files changed

Lines changed: 60 additions & 6 deletions

File tree

spec/System/TestItemMods_spec.lua

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,47 @@ describe("TetsItemMods", function()
135135
assert.are_not.equals(nonElusiveCritMult, build.calcsTab.mainOutput.CritMultiplier)
136136
end)
137137

138+
it("Runegraft of the Agile affects average Elusive effect", function()
139+
build.skillsTab:PasteSocketGroup("Smite 20/0 1\n")
140+
build.configTab.input.customMods = "Gain Elusive on Critical Strike"
141+
build.configTab.input.buffElusive = true
142+
build.configTab:BuildModList()
143+
runCallback("OnFrame")
144+
145+
assert.are.equals(50, build.calcsTab.mainOutput.ElusiveEffectMod)
146+
147+
build.configTab.input.customMods = [[Gain Elusive on Critical Strike
148+
Elusive's Effect on you is increased instead for the first 2 seconds]]
149+
build.configTab:BuildModList()
150+
runCallback("OnFrame")
151+
152+
assert.are.near(730 / 9, build.calcsTab.mainOutput.ElusiveEffectMod, 10 ^ -9)
153+
154+
build.configTab.input.customMods = [[Gain Elusive on Critical Strike
155+
Elusive's Effect on you is increased instead for the first 2 seconds
156+
Elusive on you reduces in effect 50% slower
157+
Elusive is removed from you at 20% Effect]]
158+
build.configTab:BuildModList()
159+
runCallback("OnFrame")
160+
161+
assert.are.near(244 / 3, build.calcsTab.mainOutput.ElusiveEffectMod, 10 ^ -9)
162+
163+
build.configTab.input.customMods = [[Gain Elusive on Critical Strike
164+
Elusive's Effect on you is increased instead for the first 2 seconds
165+
100% increased Elusive Effect
166+
Elusive is removed from you at 100% Effect]]
167+
build.configTab:BuildModList()
168+
runCallback("OnFrame")
169+
170+
assert.are.near(1630 / 9, build.calcsTab.mainOutput.ElusiveEffectMod, 10 ^ -9)
171+
172+
build.configTab.input.overrideBuffElusive = 220
173+
build.configTab:BuildModList()
174+
runCallback("OnFrame")
175+
176+
assert.are.equals(220, build.calcsTab.mainOutput.ElusiveEffectMod)
177+
end)
178+
138179
it("Varunastra works with close combat support", function()
139180
build.itemsTab:CreateDisplayItemFromRaw([[Varunastra
140181
Vaal Blade

src/Data/ModCache.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8377,10 +8377,8 @@ c["Elusive also grants +40% to Critical Strike Multiplier for Skills Supported b
83778377
c["Elusive has 50% chance to be removed from you at 100% effect"]={nil,"Elusive has 50% chance to be removed from you at 100% effect "}
83788378
c["Elusive has 50% chance to be removed from you at 100% effect 50% increased Effect of your Marks while Elusive"]={nil,"Elusive has 50% chance to be removed from you at 100% effect 50% increased Effect of your Marks while Elusive "}
83798379
c["Elusive is removed from you at 20% effect"]={{[1]={flags=0,keywordFlags=0,name="ElusiveEffectMinThreshold",type="OVERRIDE",value=20}},nil}
8380-
c["Elusive on you reduces in effect 50% slower"]={nil,"Elusive on you reduces in effect 50% slower "}
8381-
c["Elusive on you reduces in effect 50% slower Elusive is removed from you at 20% effect"]={nil,"Elusive on you reduces in effect 50% slower Elusive is removed from you at 20% effect "}
8382-
c["Elusive's Effect on you is increased instead for the first 2 seconds"]={nil,"Elusive's Effect on you is increased instead for the first 2 seconds "}
8383-
c["Elusive's Effect on you is increased instead for the first 2 seconds Limited to 1 Runegraft of the Agile"]={nil,"Elusive's Effect on you is increased instead for the first 2 seconds Limited to 1 Runegraft of the Agile "}
8380+
c["Elusive on you reduces in effect 50% slower"]={{[1]={flags=0,keywordFlags=0,name="ElusiveEffectLossSlower",type="INC",value=50}},nil}
8381+
c["Elusive's Effect on you is increased instead for the first 2 seconds"]={{[1]={flags=0,keywordFlags=0,name="ElusiveEffectIncreaseDuration",type="BASE",value=2}},nil}
83848382
c["Endurance, Frenzy and Power Charges as you"]={nil,"Endurance, Frenzy and Power Charges as you "}
83858383
c["Enemies Become Chilled as they Unfreeze, causing 30% reduced Action Speed"]={nil,"Enemies Become Chilled as they Unfreeze, causing 30% reduced Action Speed "}
83868384
c["Enemies Become Chilled as they Unfreeze, causing 30% reduced Action Speed 30% chance to Freeze Enemies which are Chilled"]={nil,"Enemies Become Chilled as they Unfreeze, causing 30% reduced Action Speed 30% chance to Freeze Enemies which are Chilled "}

src/Modules/CalcPerform.lua

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,12 +784,25 @@ local function doActorMisc(env, actor)
784784
end
785785
inc = inc + maxSkillInc
786786
local elusiveEffectMod = (1 + inc / 100) * modDB:More(nil, "ElusiveEffect", "BuffEffectOnSelf") * 100
787-
output.ElusiveEffectMod = (elusiveEffectMod + (modDB:Override(nil, "ElusiveEffectMinThreshold") or 0)) / 2
787+
local elusiveEffectMinThreshold = modDB:Override(nil, "ElusiveEffectMinThreshold") or 0
788+
local elusiveEffectIncreaseDuration = modDB:Sum("BASE", nil, "ElusiveEffectIncreaseDuration")
789+
local peakElusiveEffect = elusiveEffectMod
790+
if elusiveEffectIncreaseDuration > 0 then
791+
local elusiveEffectChangeRate = 20 / (1 + modDB:Sum("INC", nil, "ElusiveEffectLossSlower") / 100)
792+
peakElusiveEffect = elusiveEffectMod + elusiveEffectChangeRate * elusiveEffectIncreaseDuration
793+
local elusiveEffectDecreaseDuration = (peakElusiveEffect - elusiveEffectMinThreshold) / elusiveEffectChangeRate
794+
local totalElusiveEffectDuration = elusiveEffectIncreaseDuration + elusiveEffectDecreaseDuration
795+
local averageIncreaseEffect = (elusiveEffectMod + peakElusiveEffect) / 2
796+
local averageDecreaseEffect = (peakElusiveEffect + elusiveEffectMinThreshold) / 2
797+
output.ElusiveEffectMod = (averageIncreaseEffect * elusiveEffectIncreaseDuration + averageDecreaseEffect * elusiveEffectDecreaseDuration) / totalElusiveEffectDuration
798+
else
799+
output.ElusiveEffectMod = (elusiveEffectMod + elusiveEffectMinThreshold) / 2
800+
end
788801
-- if we want the max skill to not be noted as its own breakdown table entry, comment out below
789802
modDB:NewMod("ElusiveEffect", "INC", maxSkillInc, "Max Skill Effect")
790803
-- Override elusive effect if set.
791804
if modDB:Override(nil, "ElusiveEffect") then
792-
output.ElusiveEffectMod = m_min(modDB:Override(nil, "ElusiveEffect"), elusiveEffectMod)
805+
output.ElusiveEffectMod = m_min(modDB:Override(nil, "ElusiveEffect"), peakElusiveEffect)
793806
end
794807
local effect = output.ElusiveEffectMod / 100
795808
condList["Elusive"] = true

src/Modules/ModParser.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5508,6 +5508,8 @@ local specialModList = {
55085508
["gain a random shrine buff every (%d+) seconds"] = { flag("Condition:CanHaveRegularShrines") },
55095509
["gain a random shrine buff for (%d+) seconds when you kill a rare or unique enemy"] = { flag("Condition:CanHaveRegularShrines") },
55105510
["(%d+)%% chance to gain elusive when you block while dual wielding"] = { flag("Condition:CanBeElusive", { type = "Condition", var = "DualWielding" }) },
5511+
["elusive on you reduces in effect (%d+)%% slower"] = function(num) return { mod("ElusiveEffectLossSlower", "INC", num) } end,
5512+
["elusive's effect on you is increased instead for the first (%d+) seconds"] = function(num) return { mod("ElusiveEffectIncreaseDuration", "BASE", num) } end,
55115513
["elusive is removed from you at (%d+)%% effect"] = function(num) return { mod("ElusiveEffectMinThreshold", "OVERRIDE", num) } end,
55125514
["nearby enemies have (%a+) resistance equal to yours"] = function(_, res) return { flag("Enemy"..(res:gsub("^%l", string.upper)).."ResistEqualToYours") } end,
55135515
["for each nearby corpse, regenerate ([%d%.]+)%% life per second, up to ([%d%.]+)%%"] = function(num, _, limit) return { mod("LifeRegenPercent", "BASE", num, { type = "Multiplier", var = "NearbyCorpse", limit = tonumber(limit), limitTotal = true }) } end,

0 commit comments

Comments
 (0)