Skip to content

Commit ec34f58

Browse files
authored
Refactor grantedEffectList ordering logic (#2234)
Added failsafe for grantedEffectDisplayOrder in cases where there are more effects granted than arguments in grantedEffectDisplayOrder to resolve "MetaMirageArcherPlayer" being discarded and thus spirit not being reserved for mirage archer and potentially other skills.
1 parent 4059151 commit ec34f58

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/Modules/Data.lua

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,12 +1015,20 @@ local function setupGem(gem, gemId)
10151015
end
10161016
if gem.grantedEffectDisplayOrder then
10171017
local tempTable = {}
1018-
local moved = false
1019-
for i, temp in ipairs(gem.grantedEffectList) do
1020-
if gem.grantedEffectDisplayOrder[i] then
1021-
tempTable[i] = gem.grantedEffectList[gem.grantedEffectDisplayOrder[i] + 1]
1018+
local used = {}
1019+
for i, order in ipairs(gem.grantedEffectDisplayOrder) do
1020+
local index = order + 1
1021+
if gem.grantedEffectList[index] and not used[index] then
1022+
tempTable[i] = gem.grantedEffectList[index]
1023+
used[index] = true
10221024
else
1023-
tempTable[i] = temp
1025+
tempTable[i] = gem.grantedEffectList[i]
1026+
used[i] = true
1027+
end
1028+
end
1029+
for i, effect in ipairs(gem.grantedEffectList) do
1030+
if not used[i] then
1031+
table.insert(tempTable, effect)
10241032
end
10251033
end
10261034
gem.grantedEffectList = tempTable

0 commit comments

Comments
 (0)