From 29f29c566dd1aa1d6dcce86898199f9c963f66d4 Mon Sep 17 00:00:00 2001 From: Emik Date: Wed, 25 Feb 2026 16:52:33 +0100 Subject: [PATCH] Improve Martingale RNG for Balatro Multiplayer --- src/blind.lua | 6 +++++- src/joker.lua | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/blind.lua b/src/blind.lua index d5c01e2..1e9cc5d 100644 --- a/src/blind.lua +++ b/src/blind.lua @@ -328,7 +328,11 @@ if cry_prob then end function SMODS.current_mod:calculate(context) - ---@diagnostic disable-next-line: undefined-global + if context.setting_blind and G.GAME.blind.name == "bl_mp_nemesis" then + local modifiers = G.GAME.modifiers + modifiers.Roland_martingale_seed = (modifiers.Roland_martingale_seed or 0) + 1 + end + local _ = type(G.calc) == "function" and G.calc(f(context):keys():string()) local improbable, orig = G.GAME.modifiers.Roland_improbable, G.GAME.probabilities diff --git a/src/joker.lua b/src/joker.lua index 2425fac..da09b3e 100644 --- a/src/joker.lua +++ b/src/joker.lua @@ -619,11 +619,14 @@ joker { local extra, numerator, xmult = card.ability.extra, 1, 1 for _ = 1, 64 do - if SMODS.pseudorandom_probability(card, self.key, 1, extra.odds, "RolandMartingale") then + local g = G.GAME + local key = "RolandMartingale" .. (g.modifiers.Roland_martingale_seed or "") + + if SMODS.pseudorandom_probability(card, self.key, 1, extra.odds, key) then break end - numerator = numerator * (extra.odds - G.GAME.probabilities.normal) + numerator = numerator * (extra.odds - g.probabilities.normal) local message = number_format(numerator) .. "/" .. number_format(xmult) SMODS.calculate_effect({card = card, repetitions = 1, message = message}, card) xmult = xmult * extra.odds