Skip to content

Commit a9324ba

Browse files
LocalIdentityLocalIdentity
andauthored
Fix crash on adding support gems and importing items to many builds (#9340)
* Revert PR #9143 * Stop check that granted effect is support --------- Co-authored-by: LocalIdentity <[email protected]>
1 parent a97e3e2 commit a9324ba

File tree

2 files changed

+27
-50
lines changed

2 files changed

+27
-50
lines changed

src/Modules/CalcActiveSkill.lua

Lines changed: 25 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -107,36 +107,15 @@ 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-
131110
for index, supportEffect in ipairs(supportList) 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
137-
activeSkill.skillTypes[skillType] = true
111+
-- Pass 1: Add skill types from compatible supports
112+
if supportEffect.grantedEffect.support then
113+
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
114+
for _, skillType in pairs(supportEffect.grantedEffect.addSkillTypes) do
115+
activeSkill.skillTypes[skillType] = true
116+
end
138117
end
139-
elseif hasSupport then
118+
else
140119
t_insert(rejectedSupportsIndices, index)
141120
end
142121
end
@@ -148,29 +127,31 @@ function calcs.createActiveSkill(activeEffect, supportList, actor, socketGroup,
148127
notAddedNewSupport = true
149128
for index, supportEffectIndex in ipairs(rejectedSupportsIndices) do
150129
local supportEffect = supportList[supportEffectIndex]
151-
local grantedSupportEffect = getGrantedSupportEffect(supportEffect)
152-
if grantedSupportEffect then
153-
notAddedNewSupport = false
154-
rejectedSupportsIndices[index] = nil
155-
for _, skillType in pairs(grantedSupportEffect.addSkillTypes) do
156-
activeSkill.skillTypes[skillType] = true
130+
if supportEffect.grantedEffect.support then
131+
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
132+
notAddedNewSupport = false
133+
rejectedSupportsIndices[index] = nil
134+
for _, skillType in pairs(supportEffect.grantedEffect.addSkillTypes) do
135+
activeSkill.skillTypes[skillType] = true
136+
end
157137
end
158138
end
159139
end
160140
until (notAddedNewSupport)
161141

162142
for _, supportEffect in ipairs(supportList) do
163143
-- Pass 2: Add all compatible supports
164-
local grantedSupportEffect = getGrantedSupportEffect(supportEffect)
165-
if grantedSupportEffect then
166-
t_insert(activeSkill.effectList, supportEffect)
167-
if supportEffect.isSupporting and activeEffect.srcInstance then
168-
supportEffect.isSupporting[activeEffect.srcInstance] = true
169-
end
170-
if grantedSupportEffect.addFlags and not summonSkill then
171-
-- Support skill adds flags to supported skills (eg. Remote Mine adds 'mine')
172-
for k in pairs(grantedSupportEffect.addFlags) do
173-
skillFlags[k] = true
144+
if supportEffect.grantedEffect.support then
145+
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
146+
t_insert(activeSkill.effectList, supportEffect)
147+
if supportEffect.isSupporting and activeEffect.srcInstance then
148+
supportEffect.isSupporting[activeEffect.srcInstance] = true
149+
end
150+
if supportEffect.grantedEffect.addFlags and not summonSkill then
151+
-- Support skill adds flags to supported skills (eg. Remote Mine adds 'mine')
152+
for k in pairs(supportEffect.grantedEffect.addFlags) do
153+
skillFlags[k] = true
154+
end
174155
end
175156
end
176157
end

src/Modules/CalcSetup.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,12 +1580,8 @@ function calcs.initEnv(build, mode, override, specEnv)
15801580
for _, otherSocketGroup in ipairs(build.skillsTab.socketGroupList) do
15811581
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.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
1583+
if gem.gemData and gem.gemData.grantedEffect and gem.gemData.grantedEffect.support then
1584+
t_insert(group.displayGemList, gem)
15891585
end
15901586
end
15911587
end

0 commit comments

Comments
 (0)