From 6103009a540fe4a0070f58e62b5e93f2acc3667f Mon Sep 17 00:00:00 2001 From: Nanuzer0 Date: Fri, 11 Sep 2026 20:53:39 +0300 Subject: [PATCH] fix rigged sticker not applying to items in shop/boosters --- items/code.lua | 39 ++++++++++++++++++++++++------------ lib/calculate.lua | 50 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 14 deletions(-) diff --git a/items/code.lua b/items/code.lua index 55057560d..78f000ba7 100644 --- a/items/code.lua +++ b/items/code.lua @@ -1893,7 +1893,6 @@ local spaghetti = { } -- ://Seed -- Gives any card Rigged --- (TODO: make it work when used in shop) local seed = { cry_credits = { idea = { @@ -1920,7 +1919,15 @@ local seed = { atlas = "atlasnotjokers", order = 411, can_use = function(self, card) - local cards = Cryptid.get_highlighted_cards({ G.jokers, G.hand, G.consumeables, G.pack_cards }, card, 1, 1) + local cards = Cryptid.get_highlighted_cards({ + G.jokers, + G.hand, + G.consumeables, + G.pack_cards, + G.shop_jokers, + G.shop_booster, + G.shop_vouchers, + }, card, 1, 1) --the card itself and one other card return #cards == 1 end, @@ -1928,21 +1935,29 @@ local seed = { info_queue[#info_queue + 1] = { key = "cry_rigged", set = "Other", vars = {} } end, use = function(self, card, area, copier) - local cards = Cryptid.get_highlighted_cards({ G.jokers, G.hand, G.consumeables, G.pack_cards }, card, 1, 1) + local cards = Cryptid.get_highlighted_cards({ + G.jokers, + G.hand, + G.consumeables, + G.pack_cards, + G.shop_jokers, + G.shop_booster, + G.shop_vouchers, + }, card, 1, 1) if cards[1] then cards[1].ability.cry_rigged = true if cards[1].config.center.key == "j_cry_googol_play" then check_for_unlock({ type = "googol_play_rigged" }) end - end - if cards[1].area == G.hand then - G.E_MANAGER:add_event(Event({ - trigger = "after", - func = function() - G.hand:unhighlight_all() - return true - end, - })) + if cards[1].area and cards[1].area.unhighlight_all then + G.E_MANAGER:add_event(Event({ + trigger = "after", + func = function() + cards[1].area:unhighlight_all() + return true + end, + })) + end end end, demicoloncompat = true, diff --git a/lib/calculate.lua b/lib/calculate.lua index 22aa80622..1a589d7c6 100644 --- a/lib/calculate.lua +++ b/lib/calculate.lua @@ -47,8 +47,22 @@ function Card:cry_copy_ability() end local cj = Card.calculate_joker +local function is_in_evaluated_area(card) + if not card.area then + return false + end + for _, group in ipairs({ "jokers", "playing_cards" }) do + for _, area in ipairs(SMODS.get_card_areas(group)) do + if card.area == area then + return true + end + end + end + return false +end + local smcc = SMODS.calculate_context -function SMODS.calculate_context(context, return_table) +function SMODS.calculate_context(context, return_table, no_resolve) for k, v in pairs(SMODS.Events) do if G.GAME.events and G.GAME.events[k] then context.pre_jokers = true @@ -94,7 +108,39 @@ function SMODS.calculate_context(context, return_table) SMODS.trigger_effects(effects, _card) end end - local ret = smcc(context, return_table) + local ret = smcc(context, return_table, no_resolve) + local trigger = context.trigger_obj + if + (context.mod_probability or context.fix_probability) + and type(trigger) == "table" + and trigger.is + and trigger:is(Card) + and not is_in_evaluated_area(trigger) + then + if no_resolve then + SMODS.no_resolve = true + end + local eval, post = eval_card(trigger, context) + local effects = { eval } + for _, v in ipairs(post) do + effects[#effects + 1] = v + end + if return_table then + for _, v in ipairs(effects) do + return_table[#return_table + 1] = v + end + else + local f = SMODS.trigger_effects(effects, trigger) + ret = ret or {} + for k, v in pairs(f) do + ret[k] = v + end + SMODS.update_context_flags(context, f) + end + if no_resolve then + SMODS.no_resolve = nil + end + end for k, v in pairs(SMODS.Events) do if G.GAME.events and G.GAME.events[k] then context.post_jokers = true