Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lovely/playing_card.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
8 changes: 7 additions & 1 deletion lsp_def/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
13 changes: 11 additions & 2 deletions src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ";"

Expand Down