Make RNG consistent in multiplayer

This commit is contained in:
Emik 2026-10-06 01:30:40 +02:00
parent 8faee842a5
commit ce8362460e
Signed by: emik
GPG key ID: 6B0CD72A5E503BDF
3 changed files with 56 additions and 22 deletions

View file

@ -16,5 +16,5 @@
"Bakery (>=3.0.0~*)" "Bakery (>=3.0.0~*)"
], ],
"conflicts": [], "conflicts": [],
"version": "1.12.8" "version": "1.12.9"
} }

View file

@ -735,7 +735,7 @@ back {
end, end,
apply = function(_) apply = function(_)
G.GAME.banned_keys.j_Bakery_Lua = true G.GAME.banned_keys.j_Bakery_Lua = true
G.GAME.modifiers.omega_replacement = 1 / 301 G.GAME.modifiers.omega_replacement = (not _G["MP"] or not _G["MP"]["LOBBY"]) and 1 / 301 or nil
end, end,
alt_calculate = function(_, ...) alt_calculate = function(_, ...)
for _, v in pairs(G.P_CENTERS) do for _, v in pairs(G.P_CENTERS) do
@ -751,10 +751,44 @@ back {
G.hand.config.card_limit = math.max(G.hand.config.card_limit or 12, 12) G.hand.config.card_limit = math.max(G.hand.config.card_limit or 12, 12)
end, end,
calculate = function(_, _, context) calculate = function(_, _, context)
if not _G["MP"] or not _G["MP"]["LOBBY"] then
if Jane.is_end_of_ante(context) then if Jane.is_end_of_ante(context) then
G.GAME.modifiers.omega_replacement = G.GAME.modifiers.omega_replacement ^ 0.9 G.GAME.modifiers.omega_replacement = G.GAME.modifiers.omega_replacement ^ 0.95
Jane.q(Jane.display_omega_odds) Jane.q(Jane.display_omega_odds)
end end
return
end
if not context.end_of_round or
context.individual or
context.repetition or
context.blueprint then
return
end
local blind = ({
["Small Blind"] = 8,
["Big Blind"] = 5,
})[G.GAME.blind.name] or 2
local ante = G.GAME.round_resets.ante
local chance = 1 - math.pow(300 / 301, ante * 9 - blind)
local key = "omega_mp_" .. number_format(ante) .. "_" .. number_format(blind)
Jane.q(function()
G.GAME.modifiers.omega_replacement = chance
Jane.display_omega_odds()
G.GAME.modifiers.omega_replacement = 0
end)
if pseudorandom(key) >= chance then
return
end
Jane.q(function()
Jane.omega(key)
end)
end, end,
} }

View file

@ -996,6 +996,22 @@ SMODS.Consumable {
end, end,
} }
function Jane.omega(key)
local banned, soul, black_hole =
G.GAME.banned_keys, "c_jane_soul_omega", "c_jane_black_hole_omega"
local orig_soul, orig_black_hole = banned[soul], banned[black_hole]
banned[soul], banned[black_hole] = true, true
local omega_card = SMODS.add_card({
set = "jane_omegaconsumable",
key = pseudorandom_element(G.P_CENTER_POOLS.jane_omegaconsumable, pseudoseed(key or "omega")).key,
})
banned[soul], banned[black_hole] = orig_soul, orig_black_hole
return omega_card
end
SMODS.Consumable { SMODS.Consumable {
key = "emperor_omega", key = "emperor_omega",
set = "jane_omegaconsumable", set = "jane_omegaconsumable",
@ -1018,23 +1034,7 @@ SMODS.Consumable {
use = function() use = function()
for _ = 1, 2 do for _ = 1, 2 do
if #G.consumeables.cards < G.consumeables.config.card_limit then if #G.consumeables.cards < G.consumeables.config.card_limit then
local banned, soul, black_hole = Jane.q(Jane.omega)
G.GAME.banned_keys, "c_jane_soul_omega", "c_jane_black_hole_omega"
local orig_soul, orig_black_hole = banned[soul], banned[black_hole]
banned[soul], banned[black_hole] = true, true
SMODS.add_card(
{
set = "jane_omegaconsumable",
key = pseudorandom_element(
G.P_CENTER_POOLS.jane_omegaconsumable,
pseudoseed("emperor_omega")
).key,
}
)
banned[soul], banned[black_hole] = orig_soul, orig_black_hole
end end
end end
end, end,