Skip to content
Merged
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
13 changes: 0 additions & 13 deletions content/objects/decks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,6 @@ SMODS.Back({
}, G.deck, nil, nil, { G.C.SECONDARY_SET.Enhanced })
_card:set_ability(G.P_CENTERS["m_glorp"], nil, true)
SMODS.change_base(_card, "Glorpsuit")
-- Check if Cerber joker exists and apply Negative to 2s
local has_cerber = false
if G and G.jokers and G.jokers.cards then
for _, joker in ipairs(G.jokers.cards) do
if joker.config and joker.config.center and joker.config.center.key == "j_cerber" then
has_cerber = true
break
end
end
end
if has_cerber and _rank == "2" then
_card:set_edition("e_negative", true)
end
G.E_MANAGER:add_event(Event({
func = function()
return true
Expand Down
14 changes: 3 additions & 11 deletions content/objects/jokers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@ SMODS.Joker({
name = "Cerber",
text = {
"All {C:attention}2s{} become",
"{C:dark_edition}Negative{} when obtained",
"{C:dark_edition}Negative{}",
},
},
credits = {
Expand All @@ -2305,20 +2305,12 @@ SMODS.Joker({
pos = { x = 4, y = 0 },
add_to_deck = function(self, card, from_debuff)
if G.playing_cards and not card.debuff then
for _, pcard in ipairs(G.playing_cards) do
if pcard:get_id() == 2 and not (pcard.edition and pcard.edition.key == "e_negative") then
pcard:set_edition("e_negative", true)
end
end
Neuratro.cerberify_cards(G.playing_cards)
end
end,
calculate = function(self, card, context)
if context.playing_card_added and not context.blueprint and not context.retrigger_joker then
for _, pcard in ipairs(context.cards) do
if pcard:get_id() == 2 and not (pcard.edition and pcard.edition.key == "e_negative") then
pcard:set_edition("e_negative", true)
end
end
Neuratro.cerberify_cards(context.cards)
end
end,
in_pool = function(self, args)
Expand Down
24 changes: 24 additions & 0 deletions modules/hooks/general.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,30 @@ function Card:set_sprites(center, ...)
return _set_sprites(self, center, ...)
end

local function cerber_card_id(card)
return card and card.base and card.base.id or nil
end

local card_set_base = Card.set_base
function Card:set_base(...)
local previous_id = cerber_card_id(self)
local x = { card_set_base(self, ...) }
if previous_id ~= 2 and cerber_card_id(self) == 2 then
Neuratro.trigger_cerber_on_card(self)
end
return unpack(x)
end

local smods_change_base = SMODS.change_base
function SMODS.change_base(card, ...)
local previous_id = cerber_card_id(card)
local x = { smods_change_base(card, ...) }
if card and previous_id ~= 2 and cerber_card_id(card) == 2 then
Neuratro.trigger_cerber_on_card(card)
end
return unpack(x)
end

local cardUpdateHook = Card.update
function Card:update(dt)
self.playbook_click_delay = math.max((self.playbook_click_delay or 0) - dt, 0)
Expand Down
49 changes: 49 additions & 0 deletions modules/utils/joker_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,55 @@ function Neuratro.has_joker(joker_key)
return Neuratro.find_joker(joker_key) ~= nil
end

function Neuratro.cerberify_card(card)
local card_id = card and card.base and card.base.id
if
not card
or not card_id
or not card.ability
or card.ability.set ~= "Default"
or card_id ~= 2
or (card.edition and card.edition.key == "e_negative")
then
return false
end

card:set_edition("e_negative", true)
return true
end

function Neuratro.cerberify_cards(cards)
if not cards then
return false
end

local triggered = false

for _, card in ipairs(cards) do
if Neuratro.cerberify_card(card) then
triggered = true
end
end

return triggered
end

function Neuratro.trigger_cerber_on_card(card)
if not card or not Neuratro.has_joker("j_cerber") then
return false
end

return Neuratro.cerberify_card(card)
end

function Neuratro.trigger_cerber_on_cards(cards)
if not cards or not Neuratro.has_joker("j_cerber") then
return false
end

return Neuratro.cerberify_cards(cards)
end

function Neuratro.trigger_filtersister_upgrade()
for _, joker in ipairs(Neuratro.find_jokers("j_filtersister")) do
joker.ability.extra.xmult = joker.ability.extra.xmult + joker.ability.extra.upg
Expand Down
Loading