Fix copying negative playing cards

This commit is contained in:
Emik 2026-02-15 16:31:41 +01:00
parent 94f8c6b078
commit 7c52a06e6c
Signed by: emik
GPG key ID: 6B0CD72A5E503BDF

View file

@ -4,6 +4,7 @@ SMODS.Joker:take_ownership("joker", {cost = 1}, true)
local orig_can_highlight = CardArea.can_highlight
local orig_set_debuff = Card.set_debuff
local orig_highlight = Card.highlight
local orig_copy_card = copy_card
---@diagnostic disable-next-line: duplicate-set-field
function CardArea:can_highlight(...)
@ -11,6 +12,7 @@ function CardArea:can_highlight(...)
return orig_can_highlight(self, ...)
end
--- Allows more flexibility when using the Escapey joker to delete specific consumables.
self.config.highlighted_limit = 1 / 0
return true
end
@ -33,6 +35,19 @@ function Card:highlight(is_highlighted, ...)
end
end
---@diagnostic disable-next-line: lowercase-global
function copy_card(other, new_card, ...)
local ret = orig_copy_card(other, new_card, ...)
if new_card and new_card.edition and new_card.edition.key == "e_negative" then
--- Fixes an issue where using 'c_death' will make negative
--- cards do the inverse of what they're supposed to do.
new_card.ability.card_limit = math.max(new_card.ability.card_limit, 1)
end
return ret
end
q(function()
local orig_can_highlight_area = Bakery_API.can_highlight_area