Improve Martingale RNG for Balatro Multiplayer

This commit is contained in:
Emik 2026-02-25 16:52:33 +01:00
parent c451fa6d57
commit 29f29c566d
Signed by: emik
GPG key ID: 6B0CD72A5E503BDF
2 changed files with 10 additions and 3 deletions

View file

@ -328,7 +328,11 @@ if cry_prob then
end end
function SMODS.current_mod:calculate(context) 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 _ = type(G.calc) == "function" and G.calc(f(context):keys():string())
local improbable, orig = G.GAME.modifiers.Roland_improbable, G.GAME.probabilities local improbable, orig = G.GAME.modifiers.Roland_improbable, G.GAME.probabilities

View file

@ -619,11 +619,14 @@ joker {
local extra, numerator, xmult = card.ability.extra, 1, 1 local extra, numerator, xmult = card.ability.extra, 1, 1
for _ = 1, 64 do 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 break
end end
numerator = numerator * (extra.odds - G.GAME.probabilities.normal) numerator = numerator * (extra.odds - g.probabilities.normal)
local message = number_format(numerator) .. "/" .. number_format(xmult) local message = number_format(numerator) .. "/" .. number_format(xmult)
SMODS.calculate_effect({card = card, repetitions = 1, message = message}, card) SMODS.calculate_effect({card = card, repetitions = 1, message = message}, card)
xmult = xmult * extra.odds xmult = xmult * extra.odds