From 8186539773e6a19a07ba9bf2d25167376f7bfc30 Mon Sep 17 00:00:00 2001 From: Nanuzer0 Date: Wed, 2 Sep 2026 01:01:23 +0300 Subject: [PATCH] fix: resolve variable scope and undefined reference bugs --- items/code.lua | 2 +- items/epic.lua | 22 ++++++++++------------ items/misc_joker.lua | 21 +++++++++------------ items/spooky.lua | 17 +++++------------ lib/misc.lua | 2 +- 5 files changed, 26 insertions(+), 38 deletions(-) diff --git a/items/code.lua b/items/code.lua index 2c4091d38..ae0972abf 100644 --- a/items/code.lua +++ b/items/code.lua @@ -842,7 +842,7 @@ local crash = { G.GAME.USING_CODE = true G.ENTERED_ACE = "" G.CHOOSE_ACE = UIBox({ - definition = create_UIBox_crash(card), + definition = create_UIBox_crash(), config = { align = "bmi", offset = { x = 0, y = G.ROOM.T.y + 29 }, diff --git a/items/epic.lua b/items/epic.lua index 05b465383..a7502d644 100644 --- a/items/epic.lua +++ b/items/epic.lua @@ -2542,18 +2542,16 @@ local starfruit = { colour = G.C.RARITY.cry_epic, } else - if not msg or type(msg) == "string" then - return { - message = msg or localize({ - type = "variable", - key = "a_powmult_minus", - vars = { - number_format(card.ability.emult_mod), - }, - }), - colour = G.C.RARITY.cry_epic, - } - end + return { + message = localize({ + type = "variable", + key = "a_powmult_minus", + vars = { + number_format(card.ability.emult_mod), + }, + }), + colour = G.C.RARITY.cry_epic, + } end end end, diff --git a/items/misc_joker.lua b/items/misc_joker.lua index 3cc4d3339..448463b58 100644 --- a/items/misc_joker.lua +++ b/items/misc_joker.lua @@ -1150,17 +1150,14 @@ local chili_pepper = { no_message = true, }) if to_big(card.ability.extra.rounds_remaining) > to_big(0) then - if not msg or type(msg) == "string" then - return { - message = msg or localize({ - type = "variable", - key = "a_xmult", - vars = { number_format(card.ability.extra.Xmult) }, - }), - colour = G.C.FILTER, - } - end - return nil, true + return { + message = localize({ + type = "variable", + key = "a_xmult", + vars = { number_format(card.ability.extra.Xmult) }, + }), + colour = G.C.FILTER, + } else G.E_MANAGER:add_event(Event({ func = function() @@ -9975,7 +9972,7 @@ local highfive = { whapoosh = true G.E_MANAGER:add_event(Event({ func = function() - assert(SMODS.change_base(v, _, "5")) + assert(SMODS.change_base(v, nil, "5")) v:juice_up() return true end, diff --git a/items/spooky.lua b/items/spooky.lua index e01c6f73b..6a5ffa5ee 100644 --- a/items/spooky.lua +++ b/items/spooky.lua @@ -1172,22 +1172,15 @@ local ghost = { end, loc_vars = function(self, info_queue, card) info_queue[#info_queue + 1] = { set = "Other", key = "cry_possessed" } - local num, denom = SMODS.get_probability_vars( - card, - 1, - (card and card.ability.extra.odds or self.config.extra.odds) * card.ability.extra.destroy_rate - ) - local num2, denom2 = SMODS.get_probability_vars( - card, - 1, - (card and card.ability.extra.odds or self.config.extra.odds) * card.ability.extra.possess_rate - ) + local extra = card and card.ability and card.ability.extra or self.config.extra + local num1, denom1 = SMODS.get_probability_vars(card, 1, extra.possess_rate, "Ghost Possess") + local num2, denom2 = SMODS.get_probability_vars(card, 1, extra.destroy_rate, "Ghost Destroy") return { vars = { - num2, num1, - denom2, + num2, denom1, + denom2, }, } end, diff --git a/lib/misc.lua b/lib/misc.lua index 7509a857c..3790dbed6 100644 --- a/lib/misc.lua +++ b/lib/misc.lua @@ -774,7 +774,7 @@ function Controller:key_press_update(key, dt) G.DEBUG_POINTER = true G.ENTERED_CARD = "" G.CHOOSE_CARD = UIBox({ - definition = create_UIBox_pointer(card), + definition = create_UIBox_pointer(), config = { align = "cm", offset = { x = 0, y = 10 },