Skip to content

Commit 8c0d6b4

Browse files
authored
Add correct logic for Gemling Integrated Efficency passive (#1159)
1 parent 6c6cad0 commit 8c0d6b4

File tree

4 files changed

+93
-3
lines changed

4 files changed

+93
-3
lines changed

spec/System/TestAttacks_spec.lua

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,48 @@ describe("TestAttacks", function()
5555
runCallback("OnFrame")
5656
assert.are.equals(22, build.calcsTab.mainEnv.player.mainSkill.skillModList:Sum("INC", { flags = ModFlag.Attack }, "Damage"))
5757
end)
58+
59+
60+
local integratedEfficenyLoadout = function(modLine)
61+
-- Activate via custom mod text to simplify testing
62+
build.configTab.input.customMods = modLine
63+
build.configTab:BuildModList()
64+
runCallback("OnFrame")
65+
66+
build.itemsTab:CreateDisplayItemFromRaw([[
67+
New Item
68+
Razor Quarterstaff
69+
Quality: 0
70+
]])
71+
build.itemsTab:AddDisplayItem()
72+
runCallback("OnFrame")
73+
-- Add 2 skills with 1 red, 1 blue, 1 green support each
74+
-- Test against Quarterstaff Strike (skill slot 1)
75+
build.skillsTab:PasteSocketGroup("Quarterstaff Strike 1/0 1\nSplinter 1/0 1\nConduction 1/0 1\nBiting Frost 1/0 1")
76+
runCallback("OnFrame")
77+
build.skillsTab:PasteSocketGroup("Falling Thunder 1/0 1\nIgnition 1/0 1\nDiscombobulate 1/0 1\nCoursing Current 1/0 1")
78+
runCallback("OnFrame")
79+
80+
build.configTab:BuildModList()
81+
runCallback("OnFrame")
82+
build.calcsTab:BuildOutput()
83+
runCallback("OnFrame")
84+
end
85+
it("correctly calculates increased damage with gemling integrated efficency", function()
86+
integratedEfficenyLoadout("skills gain 99% increased damage per socketed red support gem")
87+
local incDmg = build.calcsTab.mainEnv.player.activeSkillList[1].skillModList:Sum("INC", nil, "Damage")
88+
assert.are.equals(incDmg, 99)
89+
end)
90+
91+
it("correctly calculates crit chance with gemling integrated efficency", function()
92+
integratedEfficenyLoadout("skills gain 99% increased critical hit chance per socketed blue support gem")
93+
local incCritChance = build.calcsTab.mainEnv.player.activeSkillList[1].skillModList:Sum("INC", nil, "CritChance")
94+
assert.are.equals(incCritChance, 99)
95+
end)
96+
97+
it("correctly calculates increased skill speed with gemling integrated efficency", function()
98+
integratedEfficenyLoadout("skills gain 99% increased skill speed per socketed green support gem")
99+
local incSpeed = build.calcsTab.mainEnv.player.activeSkillList[1].skillModList:Sum("INC", nil, "Speed")
100+
assert.are.equals(incSpeed, 99)
101+
end)
58102
end)

src/Data/ModCache.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4571,9 +4571,9 @@ c["Skills Supported by Unleash have 10% increased Seal gain frequency"]={{[1]={f
45714571
c["Skills Supported by Unleash have 25% increased Seal gain frequency"]={{[1]={flags=0,keywordFlags=0,name="SealGainFrequency",type="INC",value=25}},nil}
45724572
c["Skills fire an additional Projectile"]={{[1]={flags=0,keywordFlags=0,name="ProjectileCount",type="BASE",value=1}},nil}
45734573
c["Skills gain 1% of Damage as Chaos Damage per 3 Life Cost"]={{[1]={[1]={div=3,stat="LifeCost",type="PerStat"},flags=0,keywordFlags=0,name="DamageAsChaos",type="BASE",value=1}},nil}
4574-
c["Skills gain 20% increased Critical Hit Chance per socketed blue Support Gem"]={{[1]={[1]={type="Multiplier",var="BlueSupportGems"},flags=0,keywordFlags=0,name="CritChance",type="INC",value=20}},nil}
4575-
c["Skills gain 20% increased Damage per socketed red Support Gem"]={{[1]={[1]={type="Multiplier",var="RedSupportGems"},flags=0,keywordFlags=0,name="Damage",type="INC",value=20}},nil}
4576-
c["Skills gain 6% increased Skill Speed per socketed green Support Gem"]={{[1]={[1]={type="Multiplier",var="GreenSupportGems"},flags=0,keywordFlags=0,name="Speed",type="INC",value=6},[2]={[1]={type="Multiplier",var="GreenSupportGems"},flags=0,keywordFlags=0,name="WarcrySpeed",type="INC",value=6}},nil}
4574+
c["Skills gain 20% increased Critical Hit Chance per socketed blue Support Gem"]={{[1]={flags=0,keywordFlags=0,name="SkillCritChanceIncreasedPerBlueSupport",type="FLAG",value=20}},nil}
4575+
c["Skills gain 20% increased Damage per socketed red Support Gem"]={{[1]={flags=0,keywordFlags=0,name="SkillDamageIncreasedPerRedSupport",type="FLAG",value=20}},nil}
4576+
c["Skills gain 6% increased Skill Speed per socketed green Support Gem"]={{[1]={flags=0,keywordFlags=0,name="SkillSpeedIncreasedPerGreenSupport",type="FLAG",value=6}},nil}
45774577
c["Skills gain a Base Life Cost equal to 10% of Base Mana Cost"]={{[1]={flags=0,keywordFlags=0,name="BaseManaCostAsLifeCost",type="BASE",value=10}},nil}
45784578
c["Skills gain a Base Life Cost equal to 50% of Base Mana Cost"]={{[1]={flags=0,keywordFlags=0,name="BaseManaCostAsLifeCost",type="BASE",value=50}},nil}
45794579
c["Skills gain a Base Life Cost equal to Base Mana Cost"]={{[1]={flags=0,keywordFlags=0,name="BaseManaCostAsLifeCost",type="BASE",value=100}},nil}

src/Modules/CalcOffence.lua

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,43 @@ function calcs.offence(env, actor, activeSkill)
637637
end
638638
end
639639
end
640+
-- Apply Gemling's "Integrated Efficency" Passive
641+
if skillModList:Flag(nil, "SkillDamageIncreasedPerRedSupport") or
642+
skillModList:Flag(nil, "SkillSpeedIncreasedPerGreenSupport") or
643+
skillModList:Flag(nil, "SkillCritChanceIncreasedPerBlueSupport") then
644+
645+
local redSupportCount = 0
646+
local greenSupportCount = 0
647+
local blueSupportCount = 0
648+
for _, support in ipairs(activeSkill.supportList) do
649+
if support.gemData.grantedEffect.color == 1 then
650+
redSupportCount = redSupportCount + 1
651+
elseif support.gemData.grantedEffect.color == 2 then
652+
greenSupportCount = greenSupportCount + 1
653+
elseif support.gemData.grantedEffect.color == 3 then
654+
blueSupportCount = blueSupportCount + 1
655+
end
656+
end
657+
658+
local lookupModData = function(flag)
659+
local result = actor.modDB:Tabulate("FLAG", nil, flag)
660+
return { source = result[1].mod.source, value = result[1].mod.value }
661+
end
662+
-- Conditionally check each to avoid future issues if a mod is reused in isolation
663+
local modData = { source = nil, value = nil }
664+
if skillModList:Flag(nil, "SkillDamageIncreasedPerRedSupport") then
665+
modData = lookupModData("SkillDamageIncreasedPerRedSupport")
666+
skillModList:NewMod("Damage", "INC", redSupportCount * modData.value, modData.source)
667+
end
668+
if skillModList:Flag(nil, "SkillSpeedIncreasedPerGreenSupport") then
669+
modData = lookupModData("SkillSpeedIncreasedPerGreenSupport")
670+
skillModList:NewMod("Speed", "INC", greenSupportCount * modData.value, modData.source)
671+
end
672+
if skillModList:Flag(nil, "SkillCritChanceIncreasedPerBlueSupport") then
673+
modData = lookupModData("SkillCritChanceIncreasedPerBlueSupport")
674+
skillModList:NewMod("CritChance", "INC", blueSupportCount * modData.value, modData.source)
675+
end
676+
end
640677
if skillModList:Flag(nil, "MinionDamageAppliesToPlayer") or skillModList:Flag(skillCfg, "MinionDamageAppliesToPlayer") then
641678
-- Minion Damage conversion from Spiritual Aid and The Scourge
642679
local multiplier = (skillModList:Max(skillCfg, "ImprovedMinionDamageAppliesToPlayer") or 100) / 100

src/Modules/ModParser.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,6 +2998,15 @@ local specialModList = {
29982998
["attribute requirements of gems can be satisi?fied by your highest attribute"] = { flag("GemAttributeRequirementsSatisfiedByHighestAttribute") },
29992999
["you can use two copies of the same support gem in different skills"] = { mod("MaxSupportGemCopies", "OVERRIDE", 2) },
30003000
["you can use each type of support gem an additional time in different skills"] = { mod("MaxSupportGemCopies", "OVERRIDE", 2) },
3001+
["skills gain (%d+)%% increased critical hit chance per socketed blue support gem"] = function(num) return {
3002+
mod("SkillCritChanceIncreasedPerBlueSupport", "FLAG", num)
3003+
} end,
3004+
["skills gain (%d+)%% increased damage per socketed red support gem"] = function(num) return {
3005+
mod("SkillDamageIncreasedPerRedSupport", "FLAG", num)
3006+
} end,
3007+
["skills gain (%d+)%% increased skill speed per socketed green support gem"] = function(num) return {
3008+
mod("SkillSpeedIncreasedPerGreenSupport", "FLAG", num)
3009+
} end,
30013010
-- Monk - Stormweaver
30023011
["targets can be affected by two of your shocks at the same time"] = { flag("ShockCanStack"), mod("ShockStacksMax", "OVERRIDE", 2) },
30033012
["targets can be affected by two of your chills at the same time"] = { flag("ChillCanStack"), mod("ChillStacksMax", "OVERRIDE", 2) },

0 commit comments

Comments
 (0)