@@ -606,12 +606,12 @@ API.functions["rearrange_jokers"] = function(args)
606606 }
607607end
608608
609- --- Rearranges the consumeables based on the given card indices
610- --- Call G.FUNCS.rearrange_consumeables(new_consumeables )
611- --- @param args RearrangeConsumeablesArgs The card indices to rearrange the consumeables with
612- API .functions [" rearrange_consumeables " ] = function (args )
609+ --- Rearranges the consumables based on the given card indices
610+ --- Call G.FUNCS.rearrange_consumables(new_consumables )
611+ --- @param args RearrangeConsumablesArgs The card indices to rearrange the consumables with
612+ API .functions [" rearrange_consumables " ] = function (args )
613613 -- Validate required parameters
614- local success , error_message , error_code , context = validate_request (args , { " consumeables " })
614+ local success , error_message , error_code , context = validate_request (args , { " consumables " })
615615
616616 if not success then
617617 --- @cast error_message string
@@ -620,34 +620,34 @@ API.functions["rearrange_consumeables"] = function(args)
620620 return
621621 end
622622
623- -- Validate that consumeables exist
623+ -- Validate that consumables exist
624624 if not G .consumeables or not G .consumeables .cards or # G .consumeables .cards == 0 then
625625 API .send_error_response (
626- " No consumeables available to rearrange" ,
626+ " No consumables available to rearrange" ,
627627 ERROR_CODES .MISSING_GAME_OBJECT ,
628- { consumeables_available = false }
628+ { consumables_available = false }
629629 )
630630 return
631631 end
632632
633- -- Validate number of consumeables is equal to the number of consumeables in the consumeables area
634- if # args .consumeables ~= # G .consumeables .cards then
633+ -- Validate number of consumables is equal to the number of consumables in the consumables area
634+ if # args .consumables ~= # G .consumeables .cards then
635635 API .send_error_response (
636- " Invalid number of consumeables to rearrange" ,
636+ " Invalid number of consumables to rearrange" ,
637637 ERROR_CODES .PARAMETER_OUT_OF_RANGE ,
638- { consumeables_count = # args .consumeables , valid_range = tostring (# G .consumeables .cards ) }
638+ { consumables_count = # args .consumables , valid_range = tostring (# G .consumeables .cards ) }
639639 )
640640 return
641641 end
642642
643643 -- Convert incoming indices from 0-based to 1-based
644- for i , joker_index in ipairs (args .consumeables ) do
645- args .consumeables [i ] = joker_index + 1
644+ for i , consumable_index in ipairs (args .consumables ) do
645+ args .consumables [i ] = consumable_index + 1
646646 end
647647
648- -- Create a new consumeables array to swap card indices
648+ -- Create a new consumables array to swap card indices
649649 local new_consumables = {}
650- for _ , old_index in ipairs (args .consumeables ) do
650+ for _ , old_index in ipairs (args .consumables ) do
651651 local card = G .consumeables .cards [old_index ]
652652 if not card then
653653 API .send_error_response (
@@ -662,7 +662,7 @@ API.functions["rearrange_consumeables"] = function(args)
662662
663663 G .consumeables .cards = new_consumables
664664
665- -- Update each consumeable 's order field so future sort('order') calls work correctly
665+ -- Update each consumable 's order field so future sort('order') calls work correctly
666666 for i , card in ipairs (G .consumeables .cards ) do
667667 if card .ability then
668668 card .ability .order = i
@@ -673,8 +673,8 @@ API.functions["rearrange_consumeables"] = function(args)
673673 end
674674
675675 --- @type PendingRequest
676- API .pending_requests [" rearrange_consumeables " ] = {
677- condition = utils .COMPLETION_CONDITIONS [" rearrange_consumeables " ][" " ],
676+ API .pending_requests [" rearrange_consumables " ] = {
677+ condition = utils .COMPLETION_CONDITIONS [" rearrange_consumables " ][" " ],
678678 action = function ()
679679 local game_state = utils .get_game_state ()
680680 API .send_response (game_state )
0 commit comments