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
3 changes: 2 additions & 1 deletion lovely/playing_card.toml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ line_prepend = '$indent'
payload = '''
local suit = SMODS.Suits[self.base.suit] or {}
self.base.suit_nominal = suit.suit_nominal or 0
self.base.suit_nominal_original = suit_base_nominal_original or suit.suit_nominal or 0'''
self.base.suit_nominal_original = suit_base_nominal_original or suit.suit_nominal or 0
self.base.shade = suit.shade'''

# Card:change_suit()
[[patches]]
Expand Down
1 change: 1 addition & 0 deletions lsp_def/classes/suit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
---@field hc_ui_atlas? string Atlas used for high-contrast mini suit symbol in deck view.
---@field lc_colour? table HEX color of the suit text for low-contrast.
---@field hc_colour? table HEX color of the suit text for high-contrast.
---@field shade? string A string that identifies a "shade" for the suit, e.g. "light" and "dark" suits.
---@field __call? fun(self: SMODS.Suit|table, o: SMODS.Suit|table): nil|table|SMODS.Suit
---@field extend? fun(self: SMODS.Suit|table, o: SMODS.Suit|table): table Primary method of creating a class.
---@field check_duplicate_register? fun(self: SMODS.Suit|table): boolean? Ensures objects already registered will not register.
Expand Down
9 changes: 8 additions & 1 deletion lsp_def/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -872,4 +872,11 @@ 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

---Checks if a card counts as at least one suit that matches the provided suit shade
---@param card Card|table Card to check
---@param shade string Suit shade to check for
---@param bypass_debuff boolean? Whether to ignore the card's debuff status
---@return boolean
function Card.is_suit_shade(card, shade, bypass_debuff) end
4 changes: 4 additions & 0 deletions src/game_object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,7 @@ SMODS.UndiscoveredCompat = {
ui_pos = { x = 1, y = 1 },
keep_base_colours = true,
sort_id = 3,
shade = "light",
}
SMODS.Suit {
key = 'Clubs',
Expand All @@ -2090,6 +2091,7 @@ SMODS.UndiscoveredCompat = {
ui_pos = { x = 2, y = 1 },
keep_base_colours = true,
sort_id = 4,
shade = "dark",
}
SMODS.Suit {
key = 'Hearts',
Expand All @@ -2098,6 +2100,7 @@ SMODS.UndiscoveredCompat = {
ui_pos = { x = 0, y = 1 },
keep_base_colours = true,
sort_id = 2,
shade = "light",
}
SMODS.Suit {
key = 'Spades',
Expand All @@ -2106,6 +2109,7 @@ SMODS.UndiscoveredCompat = {
ui_pos = { x = 3, y = 1 },
keep_base_colours = true,
sort_id = 1,
shade = "dark",
}
-------------------------------------------------------------------------------------------------
----- API CODE GameObject.Rank
Expand Down
15 changes: 14 additions & 1 deletion src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4160,4 +4160,17 @@ function SMODS.add_to_deck(card, args)
local area = args.area or G.jokers
area:emplace(card)
return card
end
end

function Card:is_suit_shade(shade, bypass_debuff)
if self.debuff and not bypass_debuff then return end
if SMODS.has_no_suit(self) then
return false
end
for i, v in pairs(SMODS.Suits) do
if self:is_suit(i, bypass_debuff) and shade == v.shade then
return true
end
end
return false
end