Skip to content

Commit 987e965

Browse files
committed
feat: add shop_idle() cond for actions that do not depart the shop
1 parent a2555a4 commit 987e965

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/lua/api.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ API.functions["shop"] = function(args)
686686
API.pending_requests["shop"] = {
687687
condition = function()
688688
-- Purchase action is non-atomic, so we need to check dollars
689-
return utils.COMPLETION_CONDITIONS.cash_out()
689+
return utils.COMPLETION_CONDITIONS.shop_idle()
690690
and #G.shop_jokers.cards == shop_size_before - 1
691691
and G.GAME.dollars == expected_dollars
692692
end,

src/lua/utils.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,12 @@ utils.COMPLETION_CONDITIONS = {
680680
return G.STATE == G.STATES.SHOP and #G.E_MANAGER.queues.base < EVENT_QUEUE_THRESHOLD and G.STATE_COMPLETE
681681
end,
682682

683+
-- Actions that keep the player in the shop (e.g. buy_card, reroll, buy_and_use_card).
684+
-- Semantically identical to cash_out but named for clarity.
685+
shop_idle = function()
686+
return G.STATE == G.STATES.SHOP and #G.E_MANAGER.queues.base < EVENT_QUEUE_THRESHOLD and G.STATE_COMPLETE
687+
end,
688+
683689
shop = function()
684690
return G.STATE == G.STATES.BLIND_SELECT and #G.E_MANAGER.queues.base < EVENT_QUEUE_THRESHOLD and G.STATE_COMPLETE
685691
end,

0 commit comments

Comments
 (0)