@@ -251,7 +251,7 @@ function hook_reroll_shop()
251251end
252252
253253-- -----------------------------------------------------------------------------
254- -- hand_rearrange Hook (also handles joker rearrange)
254+ -- hand_rearrange Hook (also handles joker and consumenables rearrange)
255255-- -----------------------------------------------------------------------------
256256
257257--- Hooks into CardArea:align_cards for hand and joker reordering detection
@@ -260,16 +260,18 @@ function hook_hand_rearrange()
260260 local previous_orders = {
261261 hand = {},
262262 joker = {},
263+ consumeables = {},
263264 }
264265 -- local previous_hand_order = {}
265266 -- local previous_joker_order = {}
266267 CardArea .align_cards = function (self , ...)
267- -- Monitor both hand and joker cards
268+ -- Monitor hand, joker, and consumable card areas
268269 if
269270 --- @diagnostic disable-next-line : undefined-field
270271 self .config
271272 --- @diagnostic disable-next-line : undefined-field
272273 and (self .config .type == " hand" or self .config .type == " joker" )
274+ -- consumeables are type "joker"
273275 --- @diagnostic disable-next-line : undefined-field
274276 and self .cards
275277 --- @diagnostic disable-next-line : undefined-field
@@ -325,17 +327,37 @@ function hook_hand_rearrange()
325327 arguments = { cards = cards },
326328 }
327329 elseif self .config .type == " joker" then --- @diagnostic disable-line : undefined-field
328- sendInfoMessage (" Logging joker rearrangement" , " LOG" )
329- function_call = {
330- name = " rearrange_jokers" ,
331- arguments = { jokers = cards },
332- }
333- else
334- function_call = {
335- name = " unknown_rearrange" ,
336- arguments = {},
337- }
338- sendErrorMessage (" Unknown card type for rearrange" , " LOG" )
330+ -- Need to distinguish between actual jokers and consumables
331+ -- Check if any cards in this area are consumables
332+ local are_jokers = false
333+ local are_consumables = false
334+
335+ --- @diagnostic disable-next-line : undefined-field
336+ for _ , card in ipairs (self .cards ) do
337+ if card .ability and card .ability .set == " Joker" then
338+ are_jokers = true
339+ elseif card .ability and card .ability .consumeable then
340+ are_consumables = true
341+ end
342+ end
343+
344+ if are_consumables and not are_jokers then
345+ function_call = {
346+ name = " rearrange_consumeables" ,
347+ arguments = { consumeables = cards },
348+ }
349+ elseif are_jokers and not are_consumables then
350+ function_call = {
351+ name = " rearrange_jokers" ,
352+ arguments = { jokers = cards },
353+ }
354+ else
355+ function_call = {
356+ name = " unknown_rearrange" ,
357+ arguments = {},
358+ }
359+ sendErrorMessage (" Unknown card type for rearrange: " .. tostring (self .config .type ), " LOG" ) --- @diagnostic disable-line : undefined-field
360+ end
339361 end
340362
341363 -- NOTE: We cannot schedule a log write at this point because we do not have
0 commit comments