Skip to content

Commit e72c78e

Browse files
committed
feat: enhance rearrange jokers field in game state
1 parent c9fe966 commit e72c78e

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

src/lua/utils.lua

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -378,27 +378,31 @@ function utils.get_game_state()
378378
}
379379
end
380380

381-
local jokers = {
382-
cards = {},
383-
}
381+
local jokers = nil
384382
if G.jokers then
385-
if G.jokers.config then
386-
jokers.config = {
387-
card_count = G.jokers.config.card_count,
388-
card_limit = G.jokers.config.card_limit,
389-
}
390-
end
383+
local cards = {}
391384
if G.jokers.cards then
392385
for i, card in pairs(G.jokers.cards) do
393-
jokers.cards[i] = {
386+
cards[i] = {
394387
label = card.label,
395388
cost = card.cost,
389+
sort_id = card.sort_id, -- Unique identifier for this card instance (used for rearranging)
396390
config = {
397-
center = card.config.center,
391+
center_key = card.config.center_key,
398392
},
393+
debuf = card.debuff,
394+
facing = card.facing,
395+
highlighted = card.highlighted,
399396
}
400397
end
401398
end
399+
jokers = {
400+
cards = cards,
401+
config = {
402+
card_count = G.jokers.config.card_count,
403+
card_limit = G.jokers.config.card_limit,
404+
},
405+
}
402406
end
403407

404408
local shop_jokers = nil
@@ -680,6 +684,10 @@ utils.COMPLETION_CONDITIONS = {
680684
return G.STATE == G.STATES.SELECTING_HAND and #G.E_MANAGER.queues.base < EVENT_QUEUE_THRESHOLD and G.STATE_COMPLETE
681685
end,
682686

687+
rearrange_jokers = function()
688+
return #G.E_MANAGER.queues.base < EVENT_QUEUE_THRESHOLD and G.STATE_COMPLETE
689+
end,
690+
683691
cash_out = function()
684692
return G.STATE == G.STATES.SHOP and #G.E_MANAGER.queues.base < EVENT_QUEUE_THRESHOLD and G.STATE_COMPLETE
685693
end,

0 commit comments

Comments
 (0)