Skip to content

Commit 5a6a7bf

Browse files
author
LocalIdentity
committed
Fix error with supports granted by items
Supports granted by many items do not have any gemData as they are just a grantedEffect
1 parent 3b617b8 commit 5a6a7bf

File tree

1 file changed

+61
-26
lines changed

1 file changed

+61
-26
lines changed

src/Modules/CalcActiveSkill.lua

Lines changed: 61 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,28 @@ function calcs.createActiveSkill(activeEffect, supportList, actor, socketGroup,
109109

110110
for index, supportEffect in ipairs(supportList) do
111111
-- Loop through grantedEffectList until we find a support gem if the gem has an active and support component e.g. Autoexertion
112-
for _, grantedEffect in ipairs(supportEffect.gemData.grantedEffectList) do
113-
if grantedEffect.support then
114-
-- Pass 1: Add skill types from compatible supports
115-
if calcLib.canGrantedEffectSupportActiveSkill(grantedEffect, activeSkill) then
116-
for _, skillType in pairs(grantedEffect.addSkillTypes) do
117-
activeSkill.skillTypes[skillType] = true
112+
if supportEffect.gemData then
113+
for _, grantedEffect in ipairs(supportEffect.gemData.grantedEffectList) do
114+
if grantedEffect.support then
115+
-- Pass 1: Add skill types from compatible supports
116+
if calcLib.canGrantedEffectSupportActiveSkill(grantedEffect, activeSkill) then
117+
for _, skillType in pairs(grantedEffect.addSkillTypes) do
118+
activeSkill.skillTypes[skillType] = true
119+
end
120+
else
121+
t_insert(rejectedSupportsIndices, index)
118122
end
119-
else
120-
t_insert(rejectedSupportsIndices, index)
121123
end
122124
end
125+
else
126+
-- Skill with no GemData e.g. Item granted supports
127+
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
128+
for _, skillType in pairs(supportEffect.grantedEffect.addSkillTypes) do
129+
activeSkill.skillTypes[skillType] = true
130+
end
131+
else
132+
t_insert(rejectedSupportsIndices, index)
133+
end
123134
end
124135
end
125136

@@ -130,34 +141,58 @@ function calcs.createActiveSkill(activeEffect, supportList, actor, socketGroup,
130141
notAddedNewSupport = true
131142
for index, supportEffectIndex in ipairs(rejectedSupportsIndices) do
132143
local supportEffect = supportList[supportEffectIndex]
133-
for _, grantedEffect in ipairs(supportEffect.gemData.grantedEffectList) do
134-
if grantedEffect.support then
135-
if calcLib.canGrantedEffectSupportActiveSkill(grantedEffect, activeSkill) then
136-
notAddedNewSupport = false
137-
rejectedSupportsIndices[index] = nil
138-
for _, skillType in pairs(grantedEffect.addSkillTypes) do
139-
activeSkill.skillTypes[skillType] = true
144+
if supportEffect.gemData then
145+
for _, grantedEffect in ipairs(supportEffect.gemData.grantedEffectList) do
146+
if grantedEffect.support then
147+
if calcLib.canGrantedEffectSupportActiveSkill(grantedEffect, activeSkill) then
148+
notAddedNewSupport = false
149+
rejectedSupportsIndices[index] = nil
150+
for _, skillType in pairs(grantedEffect.addSkillTypes) do
151+
activeSkill.skillTypes[skillType] = true
152+
end
140153
end
141154
end
142155
end
156+
else
157+
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
158+
notAddedNewSupport = false
159+
rejectedSupportsIndices[index] = nil
160+
for _, skillType in pairs(supportEffect.grantedEffect.addSkillTypes) do
161+
activeSkill.skillTypes[skillType] = true
162+
end
163+
end
143164
end
144165
end
145166
until (notAddedNewSupport)
146167

147168
for _, supportEffect in ipairs(supportList) do
148169
-- Pass 2: Add all compatible supports
149-
for _, grantedEffect in ipairs(supportEffect.gemData.grantedEffectList) do
150-
if grantedEffect.support then
151-
if calcLib.canGrantedEffectSupportActiveSkill(grantedEffect, activeSkill) then
152-
t_insert(activeSkill.effectList, supportEffect)
153-
if supportEffect.isSupporting and activeEffect.srcInstance then
154-
supportEffect.isSupporting[activeEffect.srcInstance] = true
155-
end
156-
if grantedEffect.addFlags and not summonSkill then
157-
-- Support skill adds flags to supported skills (eg. Remote Mine adds 'mine')
158-
for k in pairs(grantedEffect.addFlags) do
159-
skillFlags[k] = true
170+
if supportEffect.gemData then
171+
for _, grantedEffect in ipairs(supportEffect.gemData.grantedEffectList) do
172+
if grantedEffect.support then
173+
if calcLib.canGrantedEffectSupportActiveSkill(grantedEffect, activeSkill) then
174+
t_insert(activeSkill.effectList, supportEffect)
175+
if supportEffect.isSupporting and activeEffect.srcInstance then
176+
supportEffect.isSupporting[activeEffect.srcInstance] = true
160177
end
178+
if grantedEffect.addFlags and not summonSkill then
179+
-- Support skill adds flags to supported skills (eg. Remote Mine adds 'mine')
180+
for k in pairs(grantedEffect.addFlags) do
181+
skillFlags[k] = true
182+
end
183+
end
184+
end
185+
end
186+
end
187+
if calcLib.canGrantedEffectSupportActiveSkill(supportEffect.grantedEffect, activeSkill) then
188+
t_insert(activeSkill.effectList, supportEffect)
189+
if supportEffect.isSupporting and activeEffect.srcInstance then
190+
supportEffect.isSupporting[activeEffect.srcInstance] = true
191+
end
192+
if supportEffect.grantedEffect.addFlags and not summonSkill then
193+
-- Support skill adds flags to supported skills (eg. Remote Mine adds 'mine')
194+
for k in pairs(supportEffect.grantedEffect.addFlags) do
195+
skillFlags[k] = true
161196
end
162197
end
163198
end

0 commit comments

Comments
 (0)