diff --git a/localization/en-us.lua b/localization/en-us.lua index 5592c02..5e92cca 100644 --- a/localization/en-us.lua +++ b/localization/en-us.lua @@ -7,6 +7,8 @@ return { "{C:attention}Small{} and {C:attention}Big Blinds{} are", "replaced with {C:attention}Boss Blinds", "that are {C:dark_edition}debuffed #1# times", + "", + "{C:Bakery_credit_fg_Roland_bakersdozenbagels,s:0.75}Art: BakersDozenBagels", }, }, b_Roland_swapper = { @@ -14,6 +16,8 @@ return { text = { "{C:tarot}Tarot {}and {C:spectral}Spectral", "cards swap places", + "", + "{C:Bakery_credit_fg_Roland_bakersdozenbagels,s:0.75}Art: BakersDozenBagels", }, }, }, @@ -393,6 +397,8 @@ return { "{C:attention}Small{} and {C:attention}Big Blinds{} are", "replaced with {C:attention}Boss Blinds", "that are {C:dark_edition}debuffed #1# times", + "", + "{C:Bakery_credit_fg_Roland_bakersdozenbagels,s:0.75}Art: BakersDozenBagels", }, }, sleeve_Roland_blossom_alt = { @@ -401,6 +407,8 @@ return { "{C:attention}Blinds{} are {C:dark_edition}debuffed", "{C:dark_edition}({X:dark_edition,C:white}(ante * #2#){C:dark_edition}) times", "{C:inactive}(Instead of #1#)", + "", + "{C:Bakery_credit_fg_Roland_bakersdozenbagels,s:0.75}Art: BakersDozenBagels", }, }, sleeve_Roland_swapper = { @@ -408,6 +416,8 @@ return { text = { "{C:tarot}Tarot {}and {C:spectral}Spectral", "cards swap places", + "", + "{C:Bakery_credit_fg_Roland_bakersdozenbagels,s:0.75}Art: BakersDozenBagels", }, }, sleeve_Roland_swapper_alt = { @@ -415,6 +425,8 @@ return { text = { "{C:attention}All {}consumable", "types swap places", + "", + "{C:Bakery_credit_fg_Roland_bakersdozenbagels,s:0.75}Art: BakersDozenBagels", }, }, }, diff --git a/manifest.json b/manifest.json index e99dcf8..40b9dad 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "id": "Roland", "name": "Roland", "prefix": "Roland", - "version": "2.9.3", + "version": "2.9.4", "badge_colour": "8BE9FD", "display_name": "Roland", "main_file": "src/main.lua", diff --git a/src/back.lua b/src/back.lua index 65c1794..d55a491 100644 --- a/src/back.lua +++ b/src/back.lua @@ -1,4 +1,4 @@ -local f, q = unpack(... or require "lib.shared") +local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] local function save(ret) q(save_run) @@ -8,7 +8,7 @@ end local back = (function() local x = 0 - ---@param tbl SMODS.Back|{artist?: string, is_alt: function, alt_apply?: fun(self: SMODS.Back|table, back: Back|table), alt_calculate?: fun(self: SMODS.Back|table, back: Back|table, context: CalcContext|table): table?, boolean?} + ---@param tbl SMODS.Back|{is_alt: (fun(self: self): boolean), alt_apply?: fun(self: SMODS.Back|table, back: Back|table), alt_calculate?: fun(self: SMODS.Back|table, back: Back|table, context: CalcContext|table): table?, boolean?} return function(tbl) local key = tbl.key local apply = tbl.apply @@ -22,34 +22,17 @@ local back = (function() return (calculate and G.GAME.selected_sleeve ~= "sleeve_Roland_" .. key) and calculate(self, ...) or nil end - tbl.artist = tbl.artist and "Roland_" .. tbl.artist or nil tbl.pos = {x = x, y = 0} + tbl.is_alt = f.fals tbl.atlas = "back" - - -- This API intends that you share the same functions for apply/calculate, - -- meaning that this may be called to check if a deck/sleeve combo is used even - -- when we are from the deck context. We add this to prevent accidental calls to nil. - function tbl:is_alt() - return false - end - - local sleeve = (_G["CardSleeves"] or {}).Sleeve - local b = SMODS.Back(tbl) x = x + 1 + local back = q(SMODS.Back(tbl)) + local sleeve = (_G["CardSleeves"] or {}).Sleeve - q(function() - Bakery_API.credit(b) - end) - - if not sleeve then - return b - end - - local s = sleeve { + local _ = sleeve and sleeve { key = key, pos = tbl.pos, atlas = "sleeve", - artist = tbl.artist, config = tbl.config and f(tbl.config):table() or nil, loc_vars = function(self, ...) local ret = tbl.loc_vars and tbl.loc_vars(self, ...) or {} @@ -67,11 +50,7 @@ local back = (function() end, } - q(function() - Bakery_API.credit(s) - end) - - return b + return back end end)() @@ -92,7 +71,6 @@ local _ = _G["CardSleeves"] and SMODS.Atlas { back { key = "blossom", pronouns = "any_all", - artist = "bakersdozenbagels", config = {extra = {alt_times = 4, times = 2}}, attributes = {"boss_blind"}, loc_vars = function(self, _, _) @@ -134,7 +112,6 @@ back { back { key = "swapper", pronouns = "he_him", - artist = "bakersdozenbagels", attributes = {"spectral", "tarot"}, apply = function(self) local modifiers = G.GAME.modifiers diff --git a/src/blind.lua b/src/blind.lua index 2abeb84..34d38fe 100644 --- a/src/blind.lua +++ b/src/blind.lua @@ -1,4 +1,4 @@ -local f, q = unpack(... or require "lib.shared") +local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] local blind = (function() local y = 0 @@ -6,17 +6,11 @@ local blind = (function() ---@param tbl SMODS.Blind|{idea?: string} ---@return SMODS.Blind return function(tbl) + tbl.idea = tbl.idea and "Roland_" .. tbl.idea or nil tbl.pos = {x = 0, y = y} tbl.atlas = "blind" - tbl.idea = tbl.idea and "Roland_" .. tbl.idea or nil - local blind = SMODS.Blind(tbl) y = y + 1 - - q(function() - Bakery_API.credit(blind) - end) - - return blind + return q(SMODS.Blind(tbl)) end end)() @@ -183,13 +177,7 @@ blind { pronouns = "he_they", disable = function() -- Ensures that this runs after 'set_blind' since it also gets added to queue. - q { - delay = 0.8, - trigger = "after", - func = function() - G.FUNCS.draw_from_discard_to_deck() - end, - } + q {delay = 0.8, trigger = "after", func = G.FUNCS.draw_from_discard_to_deck} end, set_blind = function() -- Allows the background to ease in first before drawing cards. diff --git a/src/challenge.lua b/src/challenge.lua index 3b7850e..f8d9709 100644 --- a/src/challenge.lua +++ b/src/challenge.lua @@ -1,4 +1,4 @@ -local f, q = unpack(... or require "lib.shared") +local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] local function bans() return {banned_cards = {}, banned_tags = {}, banned_other = {}} diff --git a/src/charm.lua b/src/charm.lua index 2fa4149..afa61bc 100644 --- a/src/charm.lua +++ b/src/charm.lua @@ -1,4 +1,4 @@ -local f, q = unpack(... or require "lib.shared") +local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] local mod = SMODS.current_mod SMODS.Atlas { @@ -20,7 +20,13 @@ local charm = (function() return function(tbl) q { front = true, + blocking = false, + no_delete = true, func = function() + if not Bakery_API or not Bakery_API.Charm then + return false + end + local current_mod = SMODS.current_mod SMODS.current_mod = mod diff --git a/src/edition.lua b/src/edition.lua index 2e70e8d..5eca18d 100644 --- a/src/edition.lua +++ b/src/edition.lua @@ -1,4 +1,4 @@ -local f, q = unpack(... or require "lib.shared") +local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] SMODS.Shader { key = "frozen", @@ -81,6 +81,107 @@ local function freeze(card) return ret end +local function hook_estate() + ---@param card Card|{ Roland_frozen: {estate: integer} } + local function estate_pos(card) + if card.area ~= G.jokers and card.area.config.type ~= "title" then + return 1 + end + + card.Roland_frozen.estate = card.Roland_frozen.estate or card.rank or 1 + return card.Roland_frozen.estate + end + + local estate = G.P_CENTERS.j_Bakery_Estate + local orig_calculate = estate.calculate + + function estate:calculate(card, context, ...) + if not (card or {}).Roland_frozen or not (card.edition or {}).Roland_frozen then + return orig_calculate(self, card, context, ...) + end + + if not context.joker_main then + return + end + + local joker_count = estate_pos(card) + local extra = card.ability.extra + return {chips = extra.chips * joker_count, mult = extra.mult * joker_count} + end + + local orig_loc_vars = estate.loc_vars + + function estate:loc_vars(info_queue, card, ...) + if not (card or {}).Roland_frozen or not (card.edition or {}).Roland_frozen then + return orig_loc_vars(self, info_queue, card, ...) + end + + local joker_count = estate_pos(card) + local extra = card.ability.extra or {} + return {vars = {extra.chips * joker_count, extra.mult * joker_count}} + end +end + +local function hook_proxy() + ---@param card Card|{ Roland_frozen: {proxy: string} } + local function get_proxied_joker(card) + if not G.jokers or not G.jokers.cards then + return + end + + card.Roland_frozen.proxy = card.Roland_frozen.proxy or + (Bakery_API.get_proxied_joker() or card).config.center.key + + ---@param v Card + local function eq(v) + return v.config.center.key == card.Roland_frozen.proxy + end + + return f(G.jokers.cards):any(eq) + end + + local proxy = G.P_CENTERS.j_Bakery_Proxy + local orig_calculate = proxy.calculate + + function proxy:calculate(card, context, ...) + if not card or not card.edition or not card.edition.Roland_frozen then + return orig_calculate(self, card, context, ...) + else + return SMODS.blueprint_effect(card, get_proxied_joker(card), context) + end + end + + local orig_loc_vars = proxy.loc_vars + + function proxy:loc_vars(info_queue, card, ...) + if not card or not card.edition or not card.edition.Roland_frozen then + return orig_loc_vars(self, info_queue, card, ...) + end + + local other = get_proxied_joker(card) + + local var = (other and other ~= card) and localize { + type = "name_text", + set = other.config.center.set, + key = other.config.center.key, + } or localize "k_none" + + return {vars = {var}} + end +end + +local function hook_scribe() + local scribe = G.P_CENTERS.c_Bakery_Scribe + local orig_can_use = scribe.can_use + + function scribe.can_use(...) + return orig_can_use(...) and + (SMODS.Mods.Roland.config.scribable_basket or f(G.jokers.highlighted):all(function(v) + return v.config.center.key ~= "j_Roland_basket" + end)) + end +end + SMODS.Edition { key = "frozen", shader = "frozen", @@ -203,115 +304,24 @@ function SMODS.get_probability_vars(trigger_obj, ...) return trigger_obj and (trigger_obj.Roland_frozen or {}).probability or numerator, denominator end -q(function() - local estate = G.P_CENTERS.j_Bakery_Estate +q { + blocking = false, + no_delete = true, + func = function() + local orig_flip_double_sided = (Bakery_API or {}).flip_double_sided - if not estate then - return true - end - - ---@param card Card|{ Roland_frozen: {estate: integer} } - local function estate_pos(card) - if card.area ~= G.jokers and card.area.config.type ~= "title" then - return 1 + if not orig_flip_double_sided then + return false end - card.Roland_frozen.estate = card.Roland_frozen.estate or card.rank or 1 - return card.Roland_frozen.estate - end - - local orig_calculate = estate.calculate - - function estate:calculate(card, context, ...) - if not (card or {}).Roland_frozen or not (card.edition or {}).Roland_frozen then - return orig_calculate(self, card, context, ...) + function Bakery_API.flip_double_sided(card, ...) + if not card.edition or not card.edition.Roland_frozen then + return orig_flip_double_sided(card, ...) + end end - if not context.joker_main then - return - end - - local joker_count = estate_pos(card) - local extra = card.ability.extra - return {chips = extra.chips * joker_count, mult = extra.mult * joker_count} - end - - local orig_loc_vars = estate.loc_vars - - function estate:loc_vars(info_queue, card, ...) - if not (card or {}).Roland_frozen or not (card.edition or {}).Roland_frozen then - return orig_loc_vars(self, info_queue, card, ...) - end - - local joker_count = estate_pos(card) - local extra = card.ability.extra or {} - return {vars = {extra.chips * joker_count, extra.mult * joker_count}} - end -end) - -q(function() - local proxy = G.P_CENTERS.j_Bakery_Proxy - - if not proxy then - return true - end - - ---@param card Card|{ Roland_frozen: {proxy: string} } - local function get_proxied_joker(card) - if not G.jokers or not G.jokers.cards then - return - end - - card.Roland_frozen.proxy = card.Roland_frozen.proxy or - (Bakery_API.get_proxied_joker() or card).config.center.key - - ---@param v Card - local function eq(v) - return v.config.center.key == card.Roland_frozen.proxy - end - - return f(G.jokers.cards):any(eq) - end - - local orig_calculate = proxy.calculate - - function proxy:calculate(card, context, ...) - if not card or not card.edition or not card.edition.Roland_frozen then - return orig_calculate(self, card, context, ...) - else - return SMODS.blueprint_effect(card, get_proxied_joker(card), context) - end - end - - local orig_loc_vars = proxy.loc_vars - - function proxy:loc_vars(info_queue, card, ...) - if not card or not card.edition or not card.edition.Roland_frozen then - return orig_loc_vars(self, info_queue, card, ...) - end - - local other = get_proxied_joker(card) - - local var = (other and other ~= card) and localize { - type = "name_text", - set = other.config.center.set, - key = other.config.center.key, - } or localize "k_none" - - return {vars = {var}} - end -end) - -q(function() - local orig_flip_double_sided = (Bakery_API or {}).flip_double_sided - - if not orig_flip_double_sided then - return true - end - - function Bakery_API.flip_double_sided(card, ...) - if not card.edition or not card.edition.Roland_frozen then - return orig_flip_double_sided(card, ...) - end - end -end) + local _ = G.P_CENTERS.j_Bakery_Estate and hook_estate() + local _ = G.P_CENTERS.c_Bakery_Scribe and hook_scribe() + local _ = G.P_CENTERS.j_Bakery_Proxy and hook_proxy() + end, +} diff --git a/src/joker.lua b/src/joker.lua index d004479..d617b7c 100644 --- a/src/joker.lua +++ b/src/joker.lua @@ -1,4 +1,4 @@ -local f, q = unpack(... or require "lib.shared") +local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] local atlas = SMODS.Atlas { key = "joker", @@ -34,13 +34,7 @@ local joker = (function() tbl.config.extra.back_pos = inc() end - local joker = SMODS.Joker(tbl) - - q(function() - Bakery_API.credit(joker) - end) - - return joker + return q(SMODS.Joker(tbl)) end end)() diff --git a/src/lib/shared.lua b/src/lib/shared.lua index be26c43..eafd0e7 100644 --- a/src/lib/shared.lua +++ b/src/lib/shared.lua @@ -1,3 +1,5 @@ +local f = assert(SMODS.load_file "src/lib/funky.lua")() or require "lib.funky" + local function protect(fun) return function() local res, ret = pcall(fun) @@ -11,19 +13,27 @@ local function protect(fun) end local function protect_ev(fun) - local no_delete = not not SMODS.current_mod + if type(fun) == "function" then + return Event {func = protect(fun)} + elseif type(fun) ~= "table" then + error("Expected a function or table, got a " .. type(fun), 3) + elseif type(fun.is) == "function" and fun:is(SMODS.GameObject) then + return Event { + blocking = false, + no_delete = true, + func = function() + if not Bakery_API or not Bakery_API.credit then + return false + end - if type(fun) == "table" then - fun.func = protect(fun.func) - fun.no_delete = no_delete - fun = getmetatable(fun) == Event and fun or Event(fun) - elseif type(fun) == "function" then - fun = Event {func = protect(fun), no_delete = no_delete} + Bakery_API.credit(fun) + return true + end, + } else - error("Expected a function or event, got a " .. type(fun), 3) + fun.func = protect(fun.func) + return getmetatable(fun) == Event and fun or Event(fun) end - - return fun end ---@alias Attributes "mult"|"chips"|"xmult"|"xchips"|"score"|"xscore"|"blindsize"|"xblindsize"|"balance"|"swap"|"retrigger"|"scaling"|"reset"|"suit"|"diamonds"|"hearts"|"spades"|"clubs"|"hand_type"|"rank"|"ace"|"two"|"three"|"four"|"five"|"six"|"seven"|"eight"|"nine"|"ten"|"jack"|"queen"|"king"|"face"|"economy"|"generation"|"destroy_card"|"hands"|"discard"|"hand_size"|"chance"|"joker_slot"|"mod_chance"|"copying"|"full_deck"|"passive"|"joker"|"tarot"|"planet"|"spectral"|"enhancements"|"seals"|"editions"|"tag"|"skip"|"modify_card"|"perma_bonus"|"prevents_death"|"boss_blind"|"reroll"|"on_sell"|"sell_value"|"food"|"space"|"bakery_double_sided" @@ -74,22 +84,22 @@ if false then end end -local f = assert(SMODS.load_file "src/lib/funky.lua")() or require "lib.funky" - --- Queues an event to be run. --- Note that events added this way implicitly `return true` unless you explicitly `return false`. --- For `front`; boolean `true` to add the event to the front of the queue, rather than the end. ---- @param fun fun():boolean?|{front?: boolean}|Event The event or a function to run turn into an event. +--- @generic T: fun():boolean?|Event +--- @param fun T|Event|{front?: boolean} The table or function to turn into an event. +--- @return T fun local function q(fun) local ev = protect_ev(fun) G.E_MANAGER:add_event(ev, nil, ev.front) + return fun end --- Determines if a center is allowed to be usable. ---@return boolean local function u() - return not ((G.play and #G.play.cards > 0 or G.CONTROLLER.locked or - (G.GAME.STOP_USE and G.GAME.STOP_USE > 0)) and + return not ((G.play and next(G.play.cards) or G.CONTROLLER.locked or G.GAME.STOP_USE and G.GAME.STOP_USE > 0) and G.STATE ~= G.STATES.HAND_PLAYED and G.STATE ~= G.STATES.DRAW_TO_HAND and G.STATE ~= G.STATES.PLAY_TAROT) diff --git a/src/main.lua b/src/main.lua index 1c93a09..1914288 100644 --- a/src/main.lua +++ b/src/main.lua @@ -1,55 +1,62 @@ local qol = assert(SMODS.load_file "src/lib/shared.lua")() or require "lib.shared" -local f, q = unpack(qol) +local f, q = qol[1], qol[2] -q(function() - local contributors = (Bakery_API or {}).contributors +q { + front = true, + no_delete = true, + blocking = false, + func = function() + local contributors = (Bakery_API or {}).contributors - if not contributors then - return true - end + if not contributors then + return false + end - -- Special shoutout to all contributors. <3 - local credits = { - aster = { - name = "asterSSH", - fg = HEX "f8f8f2ff", - bg = HEX "bd93f9ff", - }, - bakersdozenbagels = { - name = "BakersDozenBagels", - fg = HEX "362708ff", - bg = HEX "edd198ff", - }, - char = { - name = "char (@irregulester)", - fg = HEX "f8f8f2ff", - bg = HEX "ff79c6ff", - }, - ghostlyfield = { - name = "ghostlyfield", - fg = HEX "ffffffff", - bg = HEX "b290e6ff", - }, - hamester = { - name = "Hamester", - fg = HEX "ffffffff", - bg = HEX "ffa100ff", - }, - redstoad = { - name = "RedsToad", - fg = HEX "ffffffff", - bg = HEX "da4044ff", - }, - } + -- Special shoutout to all contributors. <3 + local credits = { + aster = { + name = "asterSSH", + fg = HEX "f8f8f2ff", + bg = HEX "bd93f9ff", + }, + bakersdozenbagels = { + name = "BakersDozenBagels", + fg = HEX "362708ff", + bg = HEX "edd198ff", + }, + char = { + name = "char (@irregulester)", + fg = HEX "f8f8f2ff", + bg = HEX "ff79c6ff", + }, + ghostlyfield = { + name = "ghostlyfield", + fg = HEX "ffffffff", + bg = HEX "b290e6ff", + }, + hamester = { + name = "Hamester", + fg = HEX "ffffffff", + bg = HEX "ffa100ff", + }, + redstoad = { + name = "RedsToad", + fg = HEX "ffffffff", + bg = HEX "da4044ff", + }, + } - f(credits):each(function(v, k) - contributors["Roland_" .. k] = v - end) + f(credits):each(function(v, k) + contributors["Roland_" .. k] = v + -- G.ARGS.LOC_COLOURS["Bakery_credit_fg_Roland_" .. k] = v.fg + -- G.ARGS.LOC_COLOURS["Bakery_credit_bg_Roland_" .. k] = v.bg + end) - if SMODS.Mods.DebugPlus and SMODS.Mods.Roland.config.import_funky then - _G.f, _G.q, _G.u = unpack(qol) - end -end) + if SMODS.Mods.DebugPlus and SMODS.Mods.Roland.config.import_funky then + _G.f, _G.q, _G.u = unpack(qol) + end + end, +} f {"challenge", "spectral", "edition", "tweaks", "blind", "charm", "joker", "tarot", "back", "seal", "tag"} :each(function(v) diff --git a/src/seal.lua b/src/seal.lua index 8968f51..28964db 100644 --- a/src/seal.lua +++ b/src/seal.lua @@ -1,4 +1,4 @@ -local f, q = unpack(... or require "lib.shared") +local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] SMODS.Atlas { px = 71, diff --git a/src/spectral.lua b/src/spectral.lua index 31e74d3..10701e1 100644 --- a/src/spectral.lua +++ b/src/spectral.lua @@ -1,4 +1,4 @@ -local f, q, u = unpack(... or require "lib.shared") +local f, q, u = (... or require "lib.shared")[1], (... or require "lib.shared")[2], (... or require "lib.shared")[3] local spectral = (function() local x = 0 @@ -6,19 +6,13 @@ local spectral = (function() ---@param tbl SMODS.Consumable|{artist?: string} ---@return SMODS.Consumable return function(tbl) - tbl.cost = 4 - tbl.set = "Spectral" - tbl.atlas = "spectral" - tbl.pos = {x = x, y = 0} tbl.artist = tbl.artist and "Roland_" .. tbl.artist or nil - local spectral = SMODS.Consumable(tbl) + tbl.pos = {x = x, y = 0} + tbl.atlas = "spectral" + tbl.set = "Spectral" + tbl.cost = 4 x = x + 1 - - q(function() - Bakery_API.credit(spectral) - end) - - return spectral + return q(SMODS.Consumable(tbl)) end end)() @@ -196,12 +190,6 @@ spectral { end play_sound("Roland_void", 1, 0.7) - - q { - delay = 0.28, - timer = "REAL", - trigger = "after", - func = void, - } + q {delay = 0.28, timer = "REAL", trigger = "after", func = void} end, } diff --git a/src/tag.lua b/src/tag.lua index ba45624..0122f52 100644 --- a/src/tag.lua +++ b/src/tag.lua @@ -1,4 +1,4 @@ -local f, q = unpack(... or require "lib.shared") +local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] SMODS.Atlas { px = 34, diff --git a/src/tarot.lua b/src/tarot.lua index e2d60cb..bbe684b 100644 --- a/src/tarot.lua +++ b/src/tarot.lua @@ -1,4 +1,4 @@ -local f, q, u = unpack(... or require "lib.shared") +local f, q, u = (... or require "lib.shared")[1], (... or require "lib.shared")[2], (... or require "lib.shared")[3] SMODS.Atlas { px = 71, @@ -7,7 +7,7 @@ SMODS.Atlas { path = "tarot.png", } -local coolheaded = SMODS.Consumable { +q(SMODS.Consumable { key = "coolheaded", pos = {x = 0, y = 0}, config = {extra = {amount = 1}}, @@ -28,7 +28,7 @@ local coolheaded = SMODS.Consumable { local highlighted = Bakery_API.get_highlighted() return #G.jokers.highlighted + #highlighted == card.ability.extra.amount and - f(G.jokers.highlighted):concat(Bakery_API.get_highlighted()):all(function(v) + f(G.jokers.highlighted):concat(highlighted):all(function(v) return not v.edition end) end, @@ -42,8 +42,4 @@ local coolheaded = SMODS.Consumable { } end) end, -} - -q(function() - Bakery_API.credit(coolheaded) -end) +}) diff --git a/src/tests/blind.tests.lua b/src/tests/blind.tests.lua index 07fc488..24f00dd 100644 --- a/src/tests/blind.tests.lua +++ b/src/tests/blind.tests.lua @@ -1,4 +1,4 @@ -local f = unpack(... or require "lib.shared") +local f = (... or require "lib.shared")[1] if not Balatest then return diff --git a/src/tweaks.lua b/src/tweaks.lua index 1f59d35..79836b1 100644 --- a/src/tweaks.lua +++ b/src/tweaks.lua @@ -1,5 +1,4 @@ -local f, q = unpack(... or require "lib.shared") - +local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] SMODS.Joker:take_ownership("joker", {cost = 1}, true) local orig_set_debuff = Card.set_debuff @@ -26,10 +25,11 @@ function Card:use_consumeable(area, copier, ...) return orig_use_consumeable(self, area, copier, ...) end + local card = copier or self + f(Bakery_API.get_highlighted()):each(function(v) q(function() play_sound "tarot1" - local card = (copier or self) card:juice_up(0.3, 0.5) end) @@ -42,13 +42,7 @@ function Card:use_consumeable(area, copier, ...) } end) - q { - delay = 0.7, - trigger = "after", - func = function() - Bakery_API.unhighlight_all() - end, - } + q {delay = 0.7, trigger = "after", func = Bakery_API.unhighlight_all} end local orig_use_card = G.FUNCS.use_card @@ -126,19 +120,37 @@ function get_blind_amount(ante, ...) (big.constants and big.constants.TEN or big:new {10}):pow(rem))) end -q(function() - local scribe = G.P_CENTERS.c_Bakery_Scribe +q { + blocking = false, + no_delete = true, + func = function() + local orig_flip_double_sided = (Bakery_API or {}).flip_double_sided - if not scribe then - return true - end + if not orig_flip_double_sided then + return false + end - local orig_can_use = scribe.can_use + function Bakery_API.flip_double_sided(card, ...) + if not card.edition or not card.edition.Roland_frozen then + return orig_flip_double_sided(card, ...) + end + end - function scribe.can_use(...) - return orig_can_use(...) and - (SMODS.Mods.Roland.config.scribable_basket or f(G.jokers.highlighted):all(function(v) - return v.config.center.key ~= "j_Roland_basket" - end)) - end -end) + q(function() + local scribe = G.P_CENTERS.c_Bakery_Scribe + + if not scribe then + return true + end + + local orig_can_use = scribe.can_use + + function scribe.can_use(...) + return orig_can_use(...) and + (SMODS.Mods.Roland.config.scribable_basket or f(G.jokers.highlighted):all(function(v) + return v.config.center.key ~= "j_Roland_basket" + end)) + end + end) + end, +}