Skip to content

Commit 76204fe

Browse files
committed
add log
1 parent 16f6a28 commit 76204fe

File tree

4 files changed

+181
-16
lines changed

4 files changed

+181
-16
lines changed

items/code.lua

Lines changed: 168 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,6 @@ local machinecode = {
17961796
config = {
17971797
object = DynaText({
17981798
string = arr,
1799-
colours = { G.C.BLACK },
18001799
pop_in_rate = 9999999,
18011800
silent = true,
18021801
random_element = true,
@@ -3412,7 +3411,7 @@ local variable = {
34123411
-- next 5 cards/packs in shop,
34133412
-- draw order for current blind (if in blind),
34143413
-- Multi-use 2
3415-
local crylog = {
3414+
local log = {
34163415
cry_credits = {
34173416
idea = {
34183417
"HexaCryonic",
@@ -3421,7 +3420,7 @@ local crylog = {
34213420
"HexaCryonic",
34223421
},
34233422
code = {
3424-
"Nova",
3423+
"lord.ruby",
34253424
},
34263425
},
34273426
dependencies = {
@@ -3432,21 +3431,180 @@ local crylog = {
34323431
object_type = "Consumable",
34333432
set = "Code",
34343433
name = "cry-Log",
3435-
key = "crylog",
3434+
key = "log",
34363435
pos = { x = 12, y = 4 },
34373436
cost = 4,
34383437
atlas = "atlasnotjokers",
34393438
order = 424,
34403439
can_use = function(self, card)
3441-
return false
3440+
return true
34423441
end,
3443-
-- use = function(self, card, area, copier)
3444-
3445-
-- end,
3442+
use = function(self, card, area, copier)
3443+
G.GAME.USING_LOG = true
3444+
local chosen_effect = pseudorandom_element({
3445+
"ANTE", "QUEUE", G.GAME.blind.in_blind and "DRAW"
3446+
}, pseudoseed("crylog_effect"))
3447+
if chosen_effect == "ANTE" then
3448+
local pseudorandom = copy_table(G.GAME.pseudorandom)
3449+
local bl = get_new_boss()
3450+
G.GAME.LOG_BOSS = bl
3451+
local voucher = SMODS.get_next_vouchers()
3452+
G.GAME.LOG_VOUCHER = voucher
3453+
G.GAME.pseudorandom = copy_table(pseudorandom)
3454+
if bl then
3455+
G.GAME.bosses_used[bl] = (G.GAME.bosses_used[bl] or 1) - 1
3456+
end
3457+
G.GAME.USING_CODE = true
3458+
G.CHOOSE_CARD = UIBox({
3459+
definition = create_UIBox_log({
3460+
bl and G.localization.descriptions.Blind[bl].name or "None",
3461+
voucher and G.localization.descriptions.Voucher[voucher[1]].name or "None"
3462+
}, localize("cry_code_antevoucher")),
3463+
config = {
3464+
align = "cm",
3465+
offset = { x = 0, y = 10 },
3466+
major = G.ROOM_ATTACH,
3467+
bond = "Weak",
3468+
instance_type = "POPUP",
3469+
},
3470+
})
3471+
G.CHOOSE_CARD.alignment.offset.y = 0
3472+
G.ROOM.jiggle = G.ROOM.jiggle + 1
3473+
G.CHOOSE_CARD:align_to_major()
3474+
elseif chosen_effect == "QUEUE" then
3475+
local pseudorandom = copy_table(G.GAME.pseudorandom)
3476+
local j = {
3477+
}
3478+
for i = 1, 5 do
3479+
j[#j+1] = G.localization.descriptions["Joker"][Cryptid.predict_joker("sho")].name
3480+
end
3481+
G.GAME.pseudorandom = copy_table(pseudorandom)
3482+
G.GAME.USING_CODE = true
3483+
G.CHOOSE_CARD = UIBox({
3484+
definition = create_UIBox_log(j, localize("cry_code_nextjokers")),
3485+
config = {
3486+
align = "cm",
3487+
offset = { x = 0, y = 10 },
3488+
major = G.ROOM_ATTACH,
3489+
bond = "Weak",
3490+
instance_type = "POPUP",
3491+
},
3492+
})
3493+
G.CHOOSE_CARD.alignment.offset.y = 0
3494+
G.ROOM.jiggle = G.ROOM.jiggle + 1
3495+
G.CHOOSE_CARD:align_to_major()
3496+
elseif chosen_effect == "DRAW" then
3497+
local j = {
3498+
}
3499+
for i = 1, 10 do
3500+
local card = G.deck.cards[#G.deck.cards+1-i]
3501+
j[#j+1] = localize(card.base.value, "ranks").." of "..localize(card.base.suit, "suits_plural")
3502+
end
3503+
G.GAME.USING_CODE = true
3504+
G.CHOOSE_CARD = UIBox({
3505+
definition = create_UIBox_log(j, localize("cry_code_nextcards")),
3506+
config = {
3507+
align = "cm",
3508+
offset = { x = 0, y = 10 },
3509+
major = G.ROOM_ATTACH,
3510+
bond = "Weak",
3511+
instance_type = "POPUP",
3512+
},
3513+
})
3514+
G.CHOOSE_CARD.alignment.offset.y = 0
3515+
G.ROOM.jiggle = G.ROOM.jiggle + 1
3516+
G.CHOOSE_CARD:align_to_major()
3517+
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
3554+
end
3555+
function create_UIBox_log(options, mtype)
3556+
G.E_MANAGER:add_event(Event({
3557+
blockable = false,
3558+
func = function()
3559+
G.REFRESH_ALERTS = true
3560+
return true
3561+
end,
3562+
}))
3563+
local contents = {}
3564+
contents[#contents+1] = {
3565+
n = G.UIT.R,
3566+
config = { align = "cm" },
3567+
nodes = {{n=G.UIT.T, config={text = mtype, lang = G.LANGUAGES['en-us'], scale = 0.45, colour = G.C.WHITE, shadow = true}}}
3568+
}
3569+
for i, v in pairs(options) do
3570+
contents[#contents+1] = {
3571+
n = G.UIT.R,
3572+
config = { align = "cm" },
3573+
nodes = {{n=G.UIT.T, config={text = v, lang = G.LANGUAGES['en-us'], scale = 0.45, colour = G.C.WHITE, shadow = true}}}
3574+
}
3575+
end
3576+
contents[#contents+1] = {
3577+
n = G.UIT.R,
3578+
config = { align = "cm" },
3579+
nodes = {
3580+
UIBox_button({
3581+
colour = G.C.RED,
3582+
button = "log_cancel",
3583+
label = { localize("cry_code_exit") },
3584+
minw = 4.5,
3585+
focus_args = { snap_to = true },
3586+
}),
3587+
},
3588+
}
3589+
local t = create_UIBox_generic_options({
3590+
no_back = true,
3591+
colour = HEX("04200c"),
3592+
outline_colour = G.C.SECONDARY_SET.Code,
3593+
contents = contents
3594+
})
3595+
return t
3596+
end
3597+
G.FUNCS.log_cancel = function()
3598+
if G.CHOOSE_CARD then
3599+
G.CHOOSE_CARD:remove()
3600+
end
3601+
G.GAME.USING_CODE = false
3602+
end
3603+
end
34463604
-- bulk_use = function(self, card, area, copier, number)
34473605

34483606
-- end,
3449-
} -- UNIMPLEMENTED
3607+
}
34503608
-- ://Quantify
34513609
-- Jokerize! an object
34523610
local quantify = {
@@ -4959,7 +5117,6 @@ local code_cards = {
49595117
seed,
49605118
rigged,
49615119
patch,
4962-
-- cryupdate, -- WIP: no effect
49635120
hook,
49645121
hooked,
49655122
oboe,
@@ -4974,7 +5131,7 @@ local code_cards = {
49745131
global,
49755132
global_sticker,
49765133
variable,
4977-
-- crylog, -- this will be implemented later on
5134+
log,
49785135
quantify,
49795136
divide,
49805137
multiply,

localization/de.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ return {
666666
"zu einem {C:cry_code}gewählten{} Rang",
667667
},
668668
},
669-
c_cry_crylog = {
669+
c_cry_log = {
670670
name = "://LOG",
671671
text = {
672672
"Kommt in einem",

localization/en-us.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,11 +687,15 @@ return {
687687
"to a {C:cry_code}chosen{} rank",
688688
},
689689
},
690-
c_cry_crylog = {
690+
c_cry_log = {
691691
name = "://LOG",
692692
text = {
693-
"To Be {C:cry_code}Implemented{}",
694-
"in a future {C:cry_code}update{}",
693+
"Show a {C:cry_code}readout{} of either: ",
694+
"{C:attention}next{} antes {C:attention}Boss-Blind{} and {C:attention}Voucher{},",
695+
"the next {C:attention}5{} {C:attention}Jokers{} from the shop, or",
696+
"the next {C:attention}10{} playing cards to be {C:attention}drawn{}",
697+
"{C:inactive}(If in a Blind){}"
698+
695699
},
696700
},
697701
c_cry_quantify = {
@@ -5059,6 +5063,10 @@ return {
50595063
cry_code_without_suits = "IGNORE SUITS",
50605064
cry_code_suitless = "Hand does not require specific suits",
50615065
cry_code_empty = "[Declare Hand]",
5066+
cry_code_exit = "EXIT",
5067+
cry_code_antevoucher = "Next Boss Blind and Voucher",
5068+
cry_code_nextjokers = "Next Shop Jokers",
5069+
cry_code_nextcards = "Next Drawn Cards",
50625070

50635071
b_flip = "FLIP",
50645072
b_merge = "MERGE",

localization/fr.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ return {
619619
"de cette manière",
620620
},
621621
},
622-
c_cry_crylog = {
622+
c_cry_log = {
623623
name = "://LOG",
624624
text = {
625625
"To Be {C:cry_code}Implemented{}",

0 commit comments

Comments
 (0)