From b11298f675daa37d595b4369b4f54e8a8e292a58 Mon Sep 17 00:00:00 2001 From: Emik Date: Tue, 17 Feb 2026 21:03:20 +0100 Subject: [PATCH] Cleanup --- localization/en-us.lua | 16 +++---- src/blind.lua | 103 +++++++++++++++++++++-------------------- src/charm.lua | 3 +- src/joker.lua | 10 ++-- src/spectral.lua | 20 ++++---- 5 files changed, 78 insertions(+), 74 deletions(-) diff --git a/localization/en-us.lua b/localization/en-us.lua index 9300944..46983fc 100644 --- a/localization/en-us.lua +++ b/localization/en-us.lua @@ -173,14 +173,14 @@ return { j_Roland_martingale = { name = "Martingale", text = { - "{C:green}#1# in #2#{} chance to give {X:mult,C:white}X#2#{} Mult", - "{s:0.9}Otherwise {C:green,s:0.9}#1# in #2#{s:0.9} chance to give {X:mult,C:white,s:0.9}X#3#{s:0.9} Mult", - "{s:0.81}Otherwise {C:green,s:0.81}#1# in #2#{s:0.81} chance to give {X:mult,C:white,s:0.81}X#4#{s:0.81} Mult", - "{s:0.6561}Otherwise {C:green,s:0.6561}#1# in #2#{s:0.6561} chance to give {X:mult,C:white,s:0.6561}X#5#{s:0.6561} Mult", - "{s:0.43046721}Otherwise {C:green,s:0.43046721}#1# in #2#{s:0.43046721} chance to give {X:mult,C:white,s:0.43046721}X#6#{s:0.43046721} Mult", - "{s:0.1853020188851841}Otherwise {C:green,s:0.1853020188851841}#1# in #2#{s:0.1853020188851841} chance to give {X:mult,C:white,s:0.1853020188851841}X#7#{s:0.1853020188851841} Mult", - "{s:0.0343368382029250877861747139}Otherwise {C:green,s:0.0343368382029250877861747139}#1# in #2#{s:0.0343368382029250877861747139} chance to give {X:mult,C:white,s:0.0343368382029250877861747139}X#8#{s:0.0343368382029250877861747139} Mult", - "{s:0}Otherwise {C:green,s:0}#1# in #2#{s:0} chance to give {X:mult,C:white,s:0}X#9#{s:0} Mult", + "{C:green}#1# in #2#{} chance to give {X:mult,C:white}X#1#{} Mult", + "{s:0.9}Otherwise {C:green,s:0.9}#1# in #2#{s:0.9} chance to give {X:mult,C:white,s:0.9}X#2#{s:0.9} Mult", + "{s:0.81}Otherwise {C:green,s:0.81}#1# in #2#{s:0.81} chance to give {X:mult,C:white,s:0.81}X#3#{s:0.81} Mult", + "{s:0.6561}Otherwise {C:green,s:0.6561}#1# in #2#{s:0.6561} chance to give {X:mult,C:white,s:0.6561}X#4#{s:0.6561} Mult", + "{s:0.43046721}Otherwise {C:green,s:0.43046721}#1# in #2#{s:0.43046721} chance to give {X:mult,C:white,s:0.43046721}X#5#{s:0.43046721} Mult", + "{s:0.1853020188851841}Otherwise {C:green,s:0.1853020188851841}#1# in #2#{s:0.1853020188851841} chance to give {X:mult,C:white,s:0.1853020188851841}X#6#{s:0.1853020188851841} Mult", + "{s:0.0343368382029250877861747139}Otherwise {C:green,s:0.0343368382029250877861747139}#1# in #2#{s:0.0343368382029250877861747139} chance to give {X:mult,C:white,s:0.0343368382029250877861747139}X#7#{s:0.0343368382029250877861747139} Mult", + "{s:0}Otherwise {C:green,s:0}#1# in #2#{s:0} chance to give {X:mult,C:white,s:0}X#8#{s:0} Mult", }, }, j_Roland_mrsbones = { diff --git a/src/blind.lua b/src/blind.lua index e1ecc0b..afe463a 100644 --- a/src/blind.lua +++ b/src/blind.lua @@ -4,11 +4,13 @@ local blind = (function() local y = 0 ---@param tbl SMODS.Blind + ---@return SMODS.Blind return function(tbl) tbl.pos = {x = 0, y = y} tbl.atlas = "blind" - SMODS.Blind(tbl) + local ret = SMODS.Blind(tbl) y = y + 1 + return ret end end)() @@ -153,7 +155,7 @@ blind { end) q(function() - pseudoshuffle(G.deck.cards, pseudoseed "Roland_falseshuffle") + pseudoshuffle(G.deck.cards, pseudoseed "RolandFalseShuffle") end) end, calculate = function(_, b, context) @@ -323,48 +325,6 @@ if cry_prob then end end -local orig_update = Game.update - ----@diagnostic disable-next-line: duplicate-set-field -function Game.update(...) - orig_update(...) - - local boss_colour = (G.P_BLINDS.bl_Roland_venerable_visage or {}).boss_colour - - if boss_colour then - boss_colour[1], boss_colour[2], boss_colour[3] = hsv_to_rgb(os.clock() / 6 % 1, 0.25, 0.75) - end - - local improbable, orig = G.GAME.modifiers.Roland_improbable, G.GAME.probabilities - - -- Normally unreachable since we set it to nil ourselves, - -- but other mods may want to use this modifier. - if improbable == false then - disable_improbable() - return - end - - if not improbable or getmetatable(orig) then - return - end - - local normal = orig.normal - - local mt = { - orig = orig, - __index = function(_, k) - return k == "normal" and 0 or orig[k] - end, - __newindex = function(_, k, v) - orig[k] = (k == "normal" and v == 0) and normal or v - end, - } - - local proxy = {} - setmetatable(proxy, mt) - G.GAME.probabilities = proxy -end - blind { key = "equinox", boss = {min = 6}, @@ -416,7 +376,7 @@ function UIElement:draw_self(...) end end -blind { +local venerable_visage = blind { key = "venerable_visage", boss = {showdown = true}, boss_colour = HEX "f6f6f2ff", @@ -433,12 +393,11 @@ blind { end) end - if b.Roland_oh_no or not context.end_of_round or not next(G.deck.cards) or not next(G.hand.cards) then + if b.Roland_vitriol or not context.end_of_round or not next(G.deck.cards) or not next(G.hand.cards) then return end - b.Roland_oh_no = true - b:wiggle() + b.Roland_vitriol = true self.vitriol(b) q { @@ -450,6 +409,10 @@ blind { } end, vitriol = function(b) + if type(b) == "table" and type(b.wiggle) == "function" then + b:wiggle() + end + local fail = G.localization.descriptions.Blind.bl_Roland_venerable_visage.fail local speed = 0.1 @@ -457,7 +420,7 @@ blind { play_sound("gong", 0.6) attention_text { - text = pseudorandom_element(fail, pseudoseed "Roland_venerable_visage"), + text = pseudorandom_element(fail, pseudoseed "RolandVenerableVisage"), offset = {x = 0, y = -3.6}, major = G.play, scale = 3, @@ -506,3 +469,45 @@ blind { delay(1) end, } + +local orig_update = Game.update + +---@diagnostic disable-next-line: duplicate-set-field +function Game.update(...) + orig_update(...) + + local boss_colour = (venerable_visage or {}).boss_colour + + if boss_colour then + boss_colour[1], boss_colour[2], boss_colour[3] = hsv_to_rgb(os.clock() / 6 % 1, 0.25, 0.75) + end + + local improbable, orig = G.GAME.modifiers.Roland_improbable, G.GAME.probabilities + + -- Normally unreachable since we set it to nil ourselves, + -- but other mods may want to use this modifier. + if improbable == false then + disable_improbable() + return + end + + if not improbable or getmetatable(orig) then + return + end + + local normal = orig.normal + + local mt = { + orig = orig, + __index = function(_, k) + return k == "normal" and 0 or orig[k] + end, + __newindex = function(_, k, v) + orig[k] = (k == "normal" and v == 0) and normal or v + end, + } + + local proxy = {} + setmetatable(proxy, mt) + G.GAME.probabilities = proxy +end diff --git a/src/charm.lua b/src/charm.lua index 67bee57..72fefd4 100644 --- a/src/charm.lua +++ b/src/charm.lua @@ -1,4 +1,5 @@ local _, q = unpack(... or require "src.functional") +local mod = SMODS.current_mod SMODS.Atlas { key = "charm", @@ -14,7 +15,7 @@ local charm = (function() return function(tbl) q(function() local current_mod = SMODS.current_mod - SMODS.current_mod = SMODS.Mods.Roland + SMODS.current_mod = mod -- SMODS._save_d_u(charm) tbl.alerted = true diff --git a/src/joker.lua b/src/joker.lua index f24b5ce..bf415db 100644 --- a/src/joker.lua +++ b/src/joker.lua @@ -1,9 +1,5 @@ local f, q, u = unpack(... or require "src.functional") -if false then - Cryptid = Cryptid -- Suppresses warnings about the global. -end - local joker = (function() local z = 0 @@ -605,13 +601,13 @@ joker { local odds = card.ability.extra.odds local vars = {normal} - for i = #vars, 9 do + for i = 0, 7 do table.insert(vars, math.pow(odds, i)) end return {vars = vars} end, - calculate = function(_, card, context) + calculate = function(self, card, context) if not context.joker_main then return end @@ -619,7 +615,7 @@ joker { local extra, numerator, xmult = card.ability.extra, 1, 1 for _ = 1, 64 do - if SMODS.pseudorandom_probability(card, "j_Roland_martingale", 1, extra.odds, "Martingale") then + if SMODS.pseudorandom_probability(card, self.key, 1, extra.odds, "RolandMartingale") then break end diff --git a/src/spectral.lua b/src/spectral.lua index aa610ed..4e706aa 100644 --- a/src/spectral.lua +++ b/src/spectral.lua @@ -1,25 +1,24 @@ local f, q, u = unpack(... or require "src.functional") -if false then - Cryptid = Cryptid -- Suppresses warnings about the global. -end - local spectral = (function() local x = 0 ---@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} - SMODS.Consumable(tbl) + local ret = SMODS.Consumable(tbl) x = x + 1 local _ = tbl.artist and q(function() tbl.artist = "Roland_" .. tbl.artist Bakery_API.credit(tbl) end) + + return ret end end)() @@ -116,13 +115,12 @@ spectral { end, } -spectral { +local void = spectral { key = "void", pronouns = "it_its", artist = "aster", - hidden = not Cryptid, - soul_rate = not Cryptid and 0.003 or nil, - soul_set = not Cryptid and "Spectral" or nil, + soul_rate = 0.003, + soul_set = "Spectral", config = {extra = {amount = 2}}, loc_vars = function(_, info_queue, card) table.insert(info_queue, G.P_CENTERS.e_negative) @@ -174,3 +172,7 @@ spectral { } end, } + +q(function() + void.hidden = not SMODS.Mods.Cryptid +end)