Skip to content

Commit c180d0e

Browse files
committed
Fix Summon Reaper's Consume buff applying twice
A minion's buff is merged once scaled by buff effect and once unscaled, keeping the higher value of each modifier. LIST modifiers cannot be compared, so both copies were kept and the Reaper got its Consume buff twice.
1 parent bfee69d commit c180d0e

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎spec/System/TestSkills_spec.lua‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,18 @@ describe("TestSkills", function()
197197
assert.are.equals(10, env.player.mainSkill.skillModList:Sum("BASE", env.player.mainSkill.skillCfg, "ColdPenetration"))
198198
end)
199199

200+
it("applies Summon Reaper's Consume buff to the Reaper only once", function()
201+
build.skillsTab:PasteSocketGroup("Summon Reaper 20/0 1\n")
202+
build.configTab.input.summonReaperConsumeRecently = true
203+
build.configTab:BuildModList()
204+
runCallback("OnFrame")
205+
206+
local minion = build.calcsTab.mainEnv.minion
207+
assert.are.equals(40, minion.modDB:Sum("INC", nil, "Speed"))
208+
assert.are.equals(40, minion.modDB:Sum("INC", nil, "MovementSpeed"))
209+
assert.are.equals(30, minion.modDB:Sum("INC", nil, "AreaOfEffect"))
210+
end)
211+
200212
it("Test Mirage Archer using triggered skill", function()
201213
build.itemsTab:CreateDisplayItemFromRaw([[+3 Bow
202214
Thicket Bow

‎src/Modules/CalcPerform.lua‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ local function getCachedOutputValue(env, activeSkill, ...)
4242
return unpack(tempValues)
4343
end
4444

45-
-- Merge an instance of a buff, taking the highest value of each modifier
46-
local function mergeBuff(src, destTable, destKey)
45+
-- Merge an instance of a buff, taking the highest value of each modifier.
46+
-- An unscaled fallback skips LIST modifiers already added by its scaled copy.
47+
local function mergeBuff(src, destTable, destKey, skipListMods)
4748
if not destTable[destKey] then
4849
destTable[destKey] = new("ModList"):ModList()
4950
end
@@ -61,7 +62,7 @@ local function mergeBuff(src, destTable, destKey)
6162
end
6263
end
6364
end
64-
if not match then
65+
if not match and (not skipListMods or mod.type ~= "LIST") then
6566
t_insert(dest, mod)
6667
end
6768
end
@@ -2903,7 +2904,7 @@ function calcs.perform(env, skipEHP)
29032904
local more = modStore:More(skillCfg, "BuffEffect", "BuffEffectOnPlayer") * modDB:More(nil, "BuffEffectOnSelf")
29042905
srcList:ScaleAddList(buff.modList, (1 + inc / 100) * more)
29052906
mergeBuff(srcList, buffs, buff.name)
2906-
mergeBuff(buff.modList, buffs, buff.name)
2907+
mergeBuff(buff.modList, buffs, buff.name, true)
29072908
if activeMinionSkill.skillData.thisIsNotABuff then
29082909
buffs[buff.name].notBuff = true
29092910
end
@@ -2927,7 +2928,7 @@ function calcs.perform(env, skipEHP)
29272928
local more = modStore:More(skillCfg, "BuffEffect", (env.minion == castingMinion) and "BuffEffectOnSelf" or nil)
29282929
srcList:ScaleAddList(buff.modList, (1 + inc / 100) * more)
29292930
mergeBuff(srcList, minionBuffs, buff.name)
2930-
mergeBuff(buff.modList, minionBuffs, buff.name)
2931+
mergeBuff(buff.modList, minionBuffs, buff.name, true)
29312932
if activeMinionSkill.skillData.thisIsNotABuff then
29322933
buffs[buff.name].notBuff = true
29332934
end

0 commit comments

Comments
 (0)