Skip to content

Commit 1c35894

Browse files
committed
make paved joker calc safer
1 parent d1600b9 commit 1c35894

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

lib/misc.lua

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,23 +1047,26 @@ function Cryptid.add_circus_rarity(rarity, dontreload)
10471047
end
10481048

10491049
function Cryptid.get_paved_joker()
1050-
local total = 0
1051-
for i, v in pairs(SMODS.find_card("j_cry_paved_joker")) do
1052-
total = total + v.ability.extra
1053-
end
1054-
local stones = 0
1055-
for i, v in pairs(G.hand.highlighted) do
1056-
if v.config.center.key == "m_stone" then
1057-
stones = stones + 1
1050+
if G.hand then
1051+
local total = 0
1052+
for i, v in pairs(SMODS.find_card("j_cry_paved_joker")) do
1053+
total = total + v.ability.extra
10581054
end
1059-
end
1060-
for i, v in pairs(G.play.cards) do
1061-
if v.config.center.key == "m_stone" then
1062-
stones = stones + 1
1055+
local stones = 0
1056+
for i, v in pairs(G.hand.highlighted) do
1057+
if v.config.center.key == "m_stone" then
1058+
stones = stones + 1
1059+
end
10631060
end
1061+
for i, v in pairs(G.play.cards) do
1062+
if v.config.center.key == "m_stone" then
1063+
stones = stones + 1
1064+
end
1065+
end
1066+
total = math.min(stones, total)
1067+
return total
10641068
end
1065-
total = math.min(stones, total)
1066-
return total
1069+
return 0
10671070
end
10681071

10691072
function Card:has_stickers()

0 commit comments

Comments
 (0)