Skip to content

Commit f6401d8

Browse files
Class Crash Potential Fix
1 parent a6c9bf4 commit f6401d8

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

items/code.lua

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,6 +1790,10 @@ local class = {
17901790
end
17911791

17921792
if enh_suffix then
1793+
local TempCard = {}
1794+
for i = 1, #G.hand.highlighted do
1795+
TempCard[i] = G.hand.highlighted[i]
1796+
end
17931797
G.PREVIOUS_ENTERED_ENH = G.ENTERED_ENH
17941798
G.GAME.USING_CODE = false
17951799
if enh_suffix == "ccd" then
@@ -1802,22 +1806,22 @@ local class = {
18021806
return true
18031807
end,
18041808
}))
1805-
for i = 1, #G.hand.highlighted do
1809+
for i = 1, #TempCard do
18061810
local percent = 1.15 - (i - 0.999) / (#G.hand.highlighted - 0.998) * 0.3
18071811
G.E_MANAGER:add_event(Event({
18081812
trigger = "after",
18091813
delay = 0.15,
18101814
func = function()
1811-
G.hand.highlighted[i]:flip()
1815+
TempCard[i]:flip()
18121816
play_sound("card1", percent)
1813-
G.hand.highlighted[i]:juice_up(0.3, 0.3)
1817+
TempCard[i]:juice_up(0.3, 0.3)
18141818
return true
18151819
end,
18161820
}))
1821+
delay(0.2)
18171822
end
1818-
delay(0.2)
1819-
for i = 1, #G.hand.highlighted do
1820-
local CARD = G.hand.highlighted[i]
1823+
for i = 1, #TempCard do
1824+
local CARD = TempCard[i]
18211825
local percent = 0.85 + (i - 0.999) / (#G.hand.highlighted - 0.998) * 0.3
18221826
G.E_MANAGER:add_event(Event({
18231827
trigger = "after",
@@ -1834,14 +1838,14 @@ local class = {
18341838
elseif enh_suffix == "null" then
18351839
local destroyed_cards = {}
18361840
check_for_unlock({ type = "cheat_used" })
1837-
for i = #G.hand.highlighted, 1, -1 do
1838-
local card = G.hand.highlighted[i]
1841+
for i = #TempCard, 1, -1 do
1842+
local card = TempCard[i]
18391843
if not card.ability.eternal then
1840-
destroyed_cards[#destroyed_cards + 1] = G.hand.highlighted[i]
1844+
destroyed_cards[#destroyed_cards + 1] = TempCard[i]
18411845
if card.ability.name == "Glass Card" then
18421846
card:shatter()
18431847
else
1844-
card:start_dissolve(nil, i == #G.hand.highlighted)
1848+
card:start_dissolve(nil, i == #TempCard)
18451849
end
18461850
end
18471851
end
@@ -1864,39 +1868,39 @@ local class = {
18641868
return true
18651869
end,
18661870
}))
1867-
for i = 1, #G.hand.highlighted do
1868-
local percent = 1.15 - (i - 0.999) / (#G.hand.highlighted - 0.998) * 0.3
1871+
for i = 1, #TempCard do
1872+
local percent = 1.15 - (i - 0.999) / (#TempCard - 0.998) * 0.3
18691873
G.E_MANAGER:add_event(Event({
18701874
trigger = "after",
18711875
delay = 0.15,
18721876
func = function()
1873-
G.hand.highlighted[i]:flip()
1877+
TempCard[i]:flip()
18741878
play_sound("card1", percent)
1875-
G.hand.highlighted[i]:juice_up(0.3, 0.3)
1879+
TempCard[i]:juice_up(0.3, 0.3)
18761880
return true
18771881
end,
18781882
}))
18791883
end
18801884
delay(0.2)
1881-
for i = 1, #G.hand.highlighted do
1885+
for i = 1, #TempCard do
18821886
G.E_MANAGER:add_event(Event({
18831887
trigger = "after",
18841888
delay = 0.1,
18851889
func = function()
1886-
G.hand.highlighted[i]:set_ability(G.P_CENTERS[enh_suffix])
1890+
TempCard[i]:set_ability(G.P_CENTERS[enh_suffix])
18871891
return true
18881892
end,
18891893
}))
18901894
end
1891-
for i = 1, #G.hand.highlighted do
1892-
local percent = 0.85 + (i - 0.999) / (#G.hand.highlighted - 0.998) * 0.3
1895+
for i = 1, #TempCard do
1896+
local percent = 0.85 + (i - 0.999) / (#TempCard - 0.998) * 0.3
18931897
G.E_MANAGER:add_event(Event({
18941898
trigger = "after",
18951899
delay = 0.15,
18961900
func = function()
1897-
G.hand.highlighted[i]:flip()
1901+
TempCard[i]:flip()
18981902
play_sound("tarot2", percent, 0.6)
1899-
G.hand.highlighted[i]:juice_up(0.3, 0.3)
1903+
TempCard[i]:juice_up(0.3, 0.3)
19001904
return true
19011905
end,
19021906
}))

0 commit comments

Comments
 (0)