Skip to content

Commit b6c6120

Browse files
More flexible suit.level_up
-Made some changes to it to allow it to work with more than just the suit planets if needed -Removed function arguments that weren't used
1 parent afefa68 commit b6c6120

File tree

2 files changed

+43
-22
lines changed

2 files changed

+43
-22
lines changed

items/planet.lua

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ local timantti = {
5959
}
6060
end,
6161
use = function(self, card, area, copier)
62-
Cryptid.suit_level_up(self, card, area, copier)
62+
Cryptid.suit_level_up(card, copier, 1, card.config.center.config.hand_types)
6363
end,
6464
bulk_use = function(self, card, area, copier, number)
65-
Cryptid.suit_level_up(self, card, area, copier, number)
65+
Cryptid.suit_level_up(card, copier, number, card.config.center.config.hand_types)
6666
end,
6767
calculate = function(self, card, context)
6868
if
@@ -143,10 +143,10 @@ local klubi = {
143143
}
144144
end,
145145
use = function(self, card, area, copier)
146-
Cryptid.suit_level_up(self, card, area, copier)
146+
Cryptid.suit_level_up(card, copier, 1, card.config.center.config.hand_types)
147147
end,
148148
bulk_use = function(self, card, area, copier, number)
149-
Cryptid.suit_level_up(self, card, area, copier, number)
149+
Cryptid.suit_level_up(card, copier, number, card.config.center.config.hand_types)
150150
end,
151151
calculate = function(self, card, context)
152152
if
@@ -227,10 +227,10 @@ local sydan = {
227227
}
228228
end,
229229
use = function(self, card, area, copier)
230-
Cryptid.suit_level_up(self, card, area, copier)
230+
Cryptid.suit_level_up(card, copier, 1, card.config.center.config.hand_types)
231231
end,
232232
bulk_use = function(self, card, area, copier, number)
233-
Cryptid.suit_level_up(self, card, area, copier, number)
233+
Cryptid.suit_level_up(card, copier, number, card.config.center.config.hand_types)
234234
end,
235235
calculate = function(self, card, context)
236236
if
@@ -311,10 +311,10 @@ local lapio = {
311311
}
312312
end,
313313
use = function(self, card, area, copier)
314-
Cryptid.suit_level_up(self, card, area, copier)
314+
Cryptid.suit_level_up(card, copier, 1, card.config.center.config.hand_types)
315315
end,
316316
bulk_use = function(self, card, area, copier, number)
317-
Cryptid.suit_level_up(self, card, area, copier, number)
317+
Cryptid.suit_level_up(card, copier, number, card.config.center.config.hand_types)
318318
end,
319319
calculate = function(self, card, context)
320320
if
@@ -396,10 +396,10 @@ local kaikki = {
396396
}
397397
end,
398398
use = function(self, card, area, copier)
399-
Cryptid.suit_level_up(self, card, area, copier)
399+
Cryptid.suit_level_up(card, copier, 1, card.config.center.config.hand_types)
400400
end,
401401
bulk_use = function(self, card, area, copier, number)
402-
Cryptid.suit_level_up(self, card, area, copier, number)
402+
Cryptid.suit_level_up(card, copier, number, card.config.center.config.hand_types)
403403
end,
404404
calculate = function(self, card, context)
405405
if
@@ -1192,12 +1192,25 @@ local universe = {
11921192
end,
11931193
generate_ui = 0,
11941194
}
1195-
function Cryptid.suit_level_up(center, card, area, copier, number)
1195+
function Cryptid.suit_level_up(card, copier, number, poker_hands, message)
11961196
local used_consumable = copier or card
11971197
if not number then
11981198
number = 1
11991199
end
1200-
for _, v in pairs(card.config.center.config.hand_types) do
1200+
if not poker_hands then
1201+
poker_hands = { "Two Pair", "Straight Flush" }
1202+
end
1203+
if message then
1204+
card_eval_status_text(
1205+
card,
1206+
"extra",
1207+
nil,
1208+
nil,
1209+
nil,
1210+
{ message = localize("k_level_up_ex"), colour = G.C.FILTER }
1211+
)
1212+
end
1213+
for _, v in pairs(poker_hands) do
12011214
update_hand_text({ sound = "button", volume = 0.7, pitch = 0.8, delay = 0.3 }, {
12021215
handname = localize(v, "poker_hands"),
12031216
chips = G.GAME.hands[v].chips,

items/test.lua

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ local test = {
3737
end,
3838
calculate = function(self, card, context)
3939
local gameset = Card.get_gameset(card)
40-
if context.cardarea == G.jokers and not context.before and not context.after then
40+
if context.joker_main then
4141
return {
4242
message = localize({ type = "variable", key = "a_chips", vars = { card.ability.extra.chips } }),
4343
chip_mod = card.ability.extra.chips,
@@ -111,17 +111,11 @@ local test3 = {
111111
discovered = true,
112112
atlas = "atlastwo",
113113
loc_txt = {
114-
name = "Loc var man B)",
114+
name = "function dump man B)",
115115
text = {
116-
"{C:attention}#1#",
117-
"{C:green}#2#",
118-
"{C:inactive}#3##4##5#",
116+
"{C:attention}What does the fox say?",
119117
},
120118
},
121-
loc_vars = function(self, info_queue, card)
122-
local a, b, c, d, e = 1, 2, 3, 4, 5
123-
return { vars = { a, b, c, d, e } }
124-
end,
125119
cry_credits = {
126120
idea = {
127121
"Jevonn",
@@ -133,6 +127,21 @@ local test3 = {
133127
"Jevonn",
134128
},
135129
},
130+
calculate = function(self, card, context)
131+
if context.end_of_round and not context.individual and not context.repetition then
132+
Cryptid.suit_level_up(context.blueprint_card or card, nil, 1, {
133+
"High Card",
134+
"Pair",
135+
"Two Pair",
136+
"Three of a Kind",
137+
"Straight",
138+
"Flush",
139+
"Full House",
140+
"Four of a Kind",
141+
"Straight Flush",
142+
}, true)
143+
end
144+
end,
136145
}
137146
local test4 = {
138147
object_type = "Joker",
@@ -161,7 +170,6 @@ local test4 = {
161170
end,
162171
update = function(self, card, front)
163172
if G.STAGE == G.STAGES.RUN then
164-
G.GAME.round_resets.discards = G.GAME.round_resets.discards + 1
165173
other_joker = G.jokers.cards[1]
166174
if other_joker then
167175
if G.GAME.current_round.discards_used % 3 == 0 then

0 commit comments

Comments
 (0)