Skip to content

Commit ee442e5

Browse files
LocalIdentityLocalIdentity
andauthored
Fix crash when sorting some gems by Full DPS (#9143)
* Fix crash when sorting some gems by Full DPS When we were checking to see if a gem could be affected by a possible support gem we were not considering if the gem had a additional granted effect which was the supporting part of the gem Instead of using the granted effect of the support, we were using the granted effect of the gem which caused a bunch of issues for the code that only expects to deal with supports Also applied this logic to cross linked supports too as I noticed it had a similar issue Also made cross link supports skip it's own socketgroup as it's trying to look for other socketgroups that can support it e.g. Ngamahu's Flame was checking it's own Molten Burst gem group which couldn't possible have supports * Fix error with supports granted by items Supports granted by many items do not have any gemData as they are just a grantedEffect * Fix test issues * Use function to remove duplicate code --------- Co-authored-by: LocalIdentity <[email protected]>
1 parent dc9bb24 commit ee442e5

File tree

2 files changed

+41
-12
lines changed

2 files changed

+41
-12
lines changed

src/Modules/CalcActiveSkill.lua

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,36 @@ function calcs.createActiveSkill(activeEffect, supportList, actor, socketGroup,
107107
activeSkill.effectList = { activeEffect }
108108
local rejectedSupportsIndices = {}
109109

110+
-- Return first compatible support grantedEffect plus a flag indicating the support has a support component
111+
local function getGrantedSupportEffect(supportEffect)
112+
local hasSupport = false
113+
if supportEffect.gemData then
114+
for _, grantedEffect in ipairs(supportEffect.gemData.grantedEffectList) do
115+
if grantedEffect and grantedEffect.support then
116+
hasSupport = true
117+
if calcLib.canGrantedEffectSupportActiveSkill(grantedEffect, activeSkill) then
118+
return grantedEffect, true
119+
end
120+
end
121+
end
122+
elseif supportEffect.grantedEffect then
123+
hasSupport = true
124+
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
125+
return supportEffect.grantedEffect, true
126+
end
127+
end
128+
return nil, hasSupport
129+
end
130+
110131
for index, supportEffect in ipairs(supportList) do
111-
-- Pass 1: Add skill types from compatible supports
112-
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
113-
for _, skillType in pairs(supportEffect.grantedEffect.addSkillTypes) do
132+
-- Loop through grantedEffectList until we find a support gem if the gem has an active and support component e.g. Autoexertion
133+
local grantedSupportEffect, hasSupport = getGrantedSupportEffect(supportEffect)
134+
if grantedSupportEffect then
135+
-- Pass 1: Add skill types from compatible supports
136+
for _, skillType in pairs(grantedSupportEffect.addSkillTypes) do
114137
activeSkill.skillTypes[skillType] = true
115138
end
116-
else
139+
elseif hasSupport then
117140
t_insert(rejectedSupportsIndices, index)
118141
end
119142
end
@@ -125,10 +148,11 @@ function calcs.createActiveSkill(activeEffect, supportList, actor, socketGroup,
125148
notAddedNewSupport = true
126149
for index, supportEffectIndex in ipairs(rejectedSupportsIndices) do
127150
local supportEffect = supportList[supportEffectIndex]
128-
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
151+
local grantedSupportEffect = getGrantedSupportEffect(supportEffect)
152+
if grantedSupportEffect then
129153
notAddedNewSupport = false
130154
rejectedSupportsIndices[index] = nil
131-
for _, skillType in pairs(supportEffect.grantedEffect.addSkillTypes) do
155+
for _, skillType in pairs(grantedSupportEffect.addSkillTypes) do
132156
activeSkill.skillTypes[skillType] = true
133157
end
134158
end
@@ -137,14 +161,15 @@ function calcs.createActiveSkill(activeEffect, supportList, actor, socketGroup,
137161

138162
for _, supportEffect in ipairs(supportList) do
139163
-- Pass 2: Add all compatible supports
140-
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
164+
local grantedSupportEffect = getGrantedSupportEffect(supportEffect)
165+
if grantedSupportEffect then
141166
t_insert(activeSkill.effectList, supportEffect)
142167
if supportEffect.isSupporting and activeEffect.srcInstance then
143168
supportEffect.isSupporting[activeEffect.srcInstance] = true
144169
end
145-
if supportEffect.grantedEffect.addFlags and not summonSkill then
170+
if grantedSupportEffect.addFlags and not summonSkill then
146171
-- Support skill adds flags to supported skills (eg. Remote Mine adds 'mine')
147-
for k in pairs(supportEffect.grantedEffect.addFlags) do
172+
for k in pairs(grantedSupportEffect.addFlags) do
148173
skillFlags[k] = true
149174
end
150175
end

src/Modules/CalcSetup.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,10 +1578,14 @@ function calcs.initEnv(build, mode, override, specEnv)
15781578
if supportLists[slotName] then
15791579
-- add socketed supports from other socketGroups
15801580
for _, otherSocketGroup in ipairs(build.skillsTab.socketGroupList) do
1581-
if otherSocketGroup.slot and otherSocketGroup.slot == group.slot then
1581+
if otherSocketGroup.slot and otherSocketGroup.slot == group.slot and not (otherSocketGroup.source and otherSocketGroup.source == group.source) then
15821582
for _, gem in ipairs(otherSocketGroup.gemList) do
1583-
if gem.gemData and gem.gemData.grantedEffect and gem.gemData.grantedEffect.support then
1584-
t_insert(group.displayGemList, gem)
1583+
if gem.gemData and gem.gemData.grantedEffectList then
1584+
for _, grantedEffect in ipairs(gem.gemData.grantedEffectList) do
1585+
if grantedEffect.support then
1586+
t_insert(group.displayGemList, gem)
1587+
end
1588+
end
15851589
end
15861590
end
15871591
end

0 commit comments

Comments
 (0)