Skip to content

Commit b53cdd2

Browse files
committed
update log ui
1 parent 830d10d commit b53cdd2

File tree

1 file changed

+130
-44
lines changed

1 file changed

+130
-44
lines changed

items/code.lua

Lines changed: 130 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3441,12 +3441,59 @@ local log = {
34413441
end,
34423442
use = function(self, card, area, copier)
34433443
G.GAME.USING_LOG = true
3444-
local chosen_effect = pseudorandom_element({
3445-
"ANTE",
3446-
"QUEUE",
3447-
G.GAME.blind.in_blind and "DRAW",
3448-
}, pseudoseed("crylog_effect"))
3449-
if chosen_effect == "ANTE" then
3444+
3445+
G.GAME.USING_CODE = true
3446+
G.CHOOSE_CARD = UIBox({
3447+
definition = create_UIBox_log_opts(),
3448+
config = {
3449+
align = "cm",
3450+
offset = { x = 0, y = 10 },
3451+
major = G.ROOM_ATTACH,
3452+
bond = "Weak",
3453+
instance_type = "POPUP",
3454+
},
3455+
})
3456+
G.CHOOSE_CARD.alignment.offset.y = 0
3457+
G.ROOM.jiggle = G.ROOM.jiggle + 1
3458+
G.CHOOSE_CARD:align_to_major()
3459+
end,
3460+
init = function()
3461+
local get_voucherref = SMODS.get_next_vouchers
3462+
function SMODS.get_next_vouchers(vouchers)
3463+
if G.GAME.LOG_VOUCHER then
3464+
local v = copy_table(G.GAME.LOG_VOUCHER)
3465+
if not G.GAME.USING_LOG then
3466+
G.GAME.LOG_VOUCHER = nil
3467+
end
3468+
return v
3469+
else
3470+
return get_voucherref(vouchers)
3471+
end
3472+
end
3473+
local get_bossref = get_new_boss
3474+
function get_new_boss(...)
3475+
if G.GAME.LOG_BOSS then
3476+
local v = "" .. G.GAME.LOG_BOSS
3477+
if not G.GAME.USING_LOG then
3478+
G.GAME.LOG_BOSS = nil
3479+
end
3480+
return v
3481+
end
3482+
return get_bossref(...)
3483+
end
3484+
function Cryptid.predict_joker(seed)
3485+
local _pool, _pool_key = get_current_pool("Joker", nil, nil, seed)
3486+
center = pseudorandom_element(_pool, pseudoseed(_pool_key))
3487+
local it = 1
3488+
while center == "UNAVAILABLE" do
3489+
it = it + 1
3490+
center = pseudorandom_element(_pool, pseudoseed(_pool_key .. ("_resample" .. it)))
3491+
end
3492+
3493+
return center
3494+
end
3495+
function G.FUNCS.log_antevoucher()
3496+
G.FUNCS.log_cancel()
34503497
local pseudorandom = copy_table(G.GAME.pseudorandom)
34513498
local bl = get_new_boss()
34523499
G.GAME.LOG_BOSS = bl
@@ -3473,7 +3520,10 @@ local log = {
34733520
G.CHOOSE_CARD.alignment.offset.y = 0
34743521
G.ROOM.jiggle = G.ROOM.jiggle + 1
34753522
G.CHOOSE_CARD:align_to_major()
3476-
elseif chosen_effect == "QUEUE" then
3523+
G.GAME.USING_LOG = nil
3524+
end
3525+
function G.FUNCS.log_nextjokers()
3526+
G.FUNCS.log_cancel()
34773527
local pseudorandom = copy_table(G.GAME.pseudorandom)
34783528
local j = {}
34793529
for i = 1, 5 do
@@ -3494,7 +3544,10 @@ local log = {
34943544
G.CHOOSE_CARD.alignment.offset.y = 0
34953545
G.ROOM.jiggle = G.ROOM.jiggle + 1
34963546
G.CHOOSE_CARD:align_to_major()
3497-
elseif chosen_effect == "DRAW" then
3547+
G.GAME.USING_LOG = nil
3548+
end
3549+
function G.FUNCS.log_nextcards()
3550+
G.FUNCS.log_cancel()
34983551
local j = {}
34993552
for i = 1, 10 do
35003553
local card = G.deck.cards[#G.deck.cards + 1 - i]
@@ -3514,43 +3567,76 @@ local log = {
35143567
G.CHOOSE_CARD.alignment.offset.y = 0
35153568
G.ROOM.jiggle = G.ROOM.jiggle + 1
35163569
G.CHOOSE_CARD:align_to_major()
3570+
G.GAME.USING_LOG = nil
35173571
end
3518-
G.GAME.USING_LOG = nil
3519-
end,
3520-
init = function()
3521-
local get_voucherref = SMODS.get_next_vouchers
3522-
function SMODS.get_next_vouchers(vouchers)
3523-
if G.GAME.LOG_VOUCHER then
3524-
local v = copy_table(G.GAME.LOG_VOUCHER)
3525-
if not G.GAME.USING_LOG then
3526-
G.GAME.LOG_VOUCHER = nil
3527-
end
3528-
return v
3529-
else
3530-
return get_voucherref(vouchers)
3531-
end
3532-
end
3533-
local get_bossref = get_new_boss
3534-
function get_new_boss(...)
3535-
if G.GAME.LOG_BOSS then
3536-
local v = "" .. G.GAME.LOG_BOSS
3537-
if not G.GAME.USING_LOG then
3538-
G.GAME.LOG_BOSS = nil
3539-
end
3540-
return v
3541-
end
3542-
return get_bossref(...)
3543-
end
3544-
function Cryptid.predict_joker(seed)
3545-
local _pool, _pool_key = get_current_pool("Joker", nil, nil, seed)
3546-
center = pseudorandom_element(_pool, pseudoseed(_pool_key))
3547-
local it = 1
3548-
while center == "UNAVAILABLE" do
3549-
it = it + 1
3550-
center = pseudorandom_element(_pool, pseudoseed(_pool_key .. ("_resample" .. it)))
3551-
end
3552-
3553-
return center
3572+
function create_UIBox_log_opts()
3573+
G.E_MANAGER:add_event(Event({
3574+
blockable = false,
3575+
func = function()
3576+
G.REFRESH_ALERTS = true
3577+
return true
3578+
end,
3579+
}))
3580+
local t = create_UIBox_generic_options({
3581+
no_back = true,
3582+
colour = HEX("04200c"),
3583+
outline_colour = G.C.SECONDARY_SET.Code,
3584+
contents = {
3585+
{
3586+
n = G.UIT.R,
3587+
config = { align = "cm" },
3588+
nodes = {
3589+
UIBox_button({
3590+
colour = G.C.SECONDARY_SET.Code,
3591+
button = "log_antevoucher",
3592+
label = { localize("cry_code_antevoucher") },
3593+
minw = 4.5,
3594+
focus_args = { snap_to = true },
3595+
}),
3596+
},
3597+
},
3598+
{
3599+
n = G.UIT.R,
3600+
config = { align = "cm" },
3601+
nodes = {
3602+
UIBox_button({
3603+
colour = G.C.SECONDARY_SET.Code,
3604+
button = "log_nextjokers",
3605+
label = { localize("cry_code_nextjokers") },
3606+
minw = 4.5,
3607+
focus_args = { snap_to = true },
3608+
}),
3609+
},
3610+
},
3611+
G.GAME.blind and G.GAME.blind.in_blind and {
3612+
n = G.UIT.R,
3613+
config = { align = "cm" },
3614+
nodes = {
3615+
UIBox_button({
3616+
colour = G.C.SECONDARY_SET.Code,
3617+
button = "log_nextcards",
3618+
label = { localize("cry_code_nextcards") },
3619+
minw = 4.5,
3620+
focus_args = { snap_to = true },
3621+
}),
3622+
},
3623+
} or nil,
3624+
{
3625+
n = G.UIT.R,
3626+
config = { align = "cm" },
3627+
nodes = {
3628+
UIBox_button({
3629+
colour = G.C.RED,
3630+
button = "log_cancel",
3631+
label = { localize("cry_code_exit") },
3632+
minw = 4.5,
3633+
focus_args = { snap_to = true },
3634+
}),
3635+
},
3636+
}
3637+
},
3638+
})
3639+
return t
35543640
end
35553641
function create_UIBox_log(options, mtype)
35563642
G.E_MANAGER:add_event(Event({

0 commit comments

Comments
 (0)