diff --git a/lovely/playing_card.toml b/lovely/playing_card.toml index 018fd7849..81cbbed62 100644 --- a/lovely/playing_card.toml +++ b/lovely/playing_card.toml @@ -134,7 +134,7 @@ local suits = { } ''' position = 'at' -payload = 'local suits = SMODS.Suit.obj_buffer' +payload = 'local suits = SMODS.get_virtual_suits()' match_indent = true [[patches]] diff --git a/lsp_def/utils.lua b/lsp_def/utils.lua index 1d43499a1..49e79f818 100644 --- a/lsp_def/utils.lua +++ b/lsp_def/utils.lua @@ -888,4 +888,10 @@ function SMODS.copy_card(card, args) end ---@param card Card|table Card to add ---@param args {set: string?, area: CardArea|table?, playing_card: integer?}? ---@return Card|table -function SMODS.add_to_deck(card, args) end \ No newline at end of file +function SMODS.add_to_deck(card, args) end + +---Returns a copy of SMODS.Suit.obj_buffer +---Hook this function and edit the return if you want the game to see suits that don't exist, or not see suits that do exist +---Intended for calculation purposes; to get suits that can actually appear on cards you still want the obj_buffer +---@return string[] +function SMODS.get_virtual_suits() end \ No newline at end of file diff --git a/src/utils.lua b/src/utils.lua index 11976c115..b2d4b6f02 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -2650,8 +2650,9 @@ end function SMODS.seeing_double_check(hand, suit) local suit_tally = {} - for i = #SMODS.Suit.obj_buffer, 1, -1 do - suit_tally[SMODS.Suit.obj_buffer[i]] = 0 + local suitlist = SMODS.get_virtual_suits() + for i = #suitlist, 1, -1 do + suit_tally[suitlist[i]] = 0 end for i = 1, #hand do if not SMODS.has_any_suit(hand[i]) then @@ -2671,6 +2672,14 @@ function SMODS.seeing_double_check(hand, suit) if saw_double(suit_tally, suit) then return true else return false end end +function SMODS.get_virtual_suits() + local ret = {} + for i,v in ipairs(SMODS.Suit.obj_buffer) do + ret[i] = v + end + return ret +end + local function parse_tooltip_vars(str, separator) separator = separator or ";"