Skip to content

Commit fbcf9d2

Browse files
improved function (Cryptid.table_merge)
2 tables > infinite tables :D Shouldn't cause backwards compat issues... (untested tho lmao)
1 parent f06ee7d commit fbcf9d2

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

items/test.lua

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,24 @@ local test3 = {
129129
},
130130
},
131131
calculate = function(self, card, context)
132-
if context.end_of_round and not context.individual and not context.repetition then
133-
Cryptid.suit_level_up(context.blueprint_card or card, nil, 1, {
134-
"High Card",
135-
"Pair",
136-
"Two Pair",
137-
"Three of a Kind",
138-
"Straight",
139-
"Flush",
140-
"Full House",
141-
"Four of a Kind",
142-
"Straight Flush",
143-
}, true)
132+
if context.using_consumeable then
133+
if context.consumeable.ability.set == "Tarot" then
134+
Cryptid.suit_level_up(
135+
context.blueprint_card or card,
136+
nil,
137+
1,
138+
Cryptid.table_merge({ "Three of a Kind" }, { "Three of a Kind" }, { "Full House" }, { "Pair" }),
139+
true
140+
)
141+
else
142+
Cryptid.suit_level_up(
143+
context.blueprint_card or card,
144+
nil,
145+
1,
146+
Cryptid.table_merge({ "Three of a Kind" }, { "Full House" }, { "Pair" }, { "Three of a Kind" }),
147+
true
148+
)
149+
end
144150
elseif context.pre_discard and not context.hook then
145151
local text, loc_disp_text, poker_hands, scoring_hand, disp_text =
146152
G.FUNCS.get_poker_hand_info(G.hand.highlighted)

lib/misc.lua

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -999,13 +999,12 @@ function Cryptid.get_highlighted_cards(areas, ignore, min, max, blacklist, seed)
999999
return {}
10001000
end
10011001

1002-
function Cryptid.table_merge(t1, t2)
1002+
function Cryptid.table_merge(...)
10031003
local tbl = {}
1004-
for i, v in pairs(t1) do
1005-
tbl[#tbl + 1] = v
1006-
end
1007-
for i, v in pairs(t2) do
1008-
tbl[#tbl + 1] = v
1004+
for _, t in ipairs({ ... }) do
1005+
for _, v in pairs(t) do
1006+
tbl[#tbl + 1] = v
1007+
end
10091008
end
10101009
return tbl
10111010
end

0 commit comments

Comments
 (0)