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
39 changes: 27 additions & 12 deletions items/code.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,6 @@ local spaghetti = {
}
-- ://Seed
-- Gives any card Rigged
-- (TODO: make it work when used in shop)
local seed = {
cry_credits = {
idea = {
Expand All @@ -1920,29 +1919,45 @@ 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,
loc_vars = function(self, info_queue, card)
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,
Expand Down
50 changes: 48 additions & 2 deletions lib/calculate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down