Skip to content

Commit 813a9cf

Browse files
committed
bring stuff over
1 parent b4ed075 commit 813a9cf

File tree

2 files changed

+97
-5
lines changed

2 files changed

+97
-5
lines changed

items/code.lua

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3499,7 +3499,7 @@ local log = {
34993499
G.CHOOSE_CARD = UIBox({
35003500
definition = create_UIBox_log({
35013501
bl and G.localization.descriptions.Blind[bl].name or "None",
3502-
voucher and G.localization.descriptions.Voucher[voucher[1]].name or "None",
3502+
voucher and G.P_CENTERS[voucher[1]] and localize { type = 'name_text', set = G.P_CENTERS[voucher[1]].set, key = voucher[1] } or "None",
35033503
}, localize("cry_code_antevoucher")),
35043504
config = {
35053505
align = "cm",
@@ -3519,8 +3519,18 @@ local log = {
35193519
local pseudorandom = copy_table(G.GAME.pseudorandom)
35203520
local j = {}
35213521
for i = 1, 5 do
3522-
local next_joker = G.localization.descriptions["Joker"][Cryptid.predict_joker("sho")]
3523-
j[#j + 1] = next_joker and next_joker.name or "[NOT A JOKER]"
3522+
local key = Cryptid.predict_joker("sho")
3523+
local next_joker = G.P_CENTERS[key] and localize { type = 'name_text', set = G.P_CENTERS[key].set, key = key }
3524+
or "ERROR"
3525+
if next_joker == "ERROR" then
3526+
local try = (G.localization.descriptions[G.P_CENTERS[key].set] or {})[key]
3527+
try = try and try.name or "[ERROR]"
3528+
if type(try or "a") == "table" then
3529+
try = try[1]
3530+
end
3531+
next_joker = try
3532+
end
3533+
j[#j + 1] = next_joker
35243534
end
35253535
G.GAME.pseudorandom = copy_table(pseudorandom)
35263536
G.GAME.USING_CODE = true
@@ -3544,7 +3554,9 @@ local log = {
35443554
local j = {}
35453555
for i = 1, 10 do
35463556
local card = G.deck.cards[#G.deck.cards + 1 - i]
3547-
j[#j + 1] = localize(card.base.value, "ranks") .. " of " .. localize(card.base.suit, "suits_plural")
3557+
if card then
3558+
j[#j + 1] = localize(card.base.value, "ranks") .. " of " .. localize(card.base.suit, "suits_plural")
3559+
end
35483560
end
35493561
G.GAME.USING_CODE = true
35503562
G.CHOOSE_CARD = UIBox({
@@ -3601,7 +3613,7 @@ local log = {
36013613
}),
36023614
},
36033615
},
3604-
G.GAME.blind and G.GAME.blind.in_blind and {
3616+
G.GAME.blind and G.GAME.blind.in_blind and G.deck and #(G.deck.cards or {}) > 0 and {
36053617
n = G.UIT.R,
36063618
config = { align = "cm" },
36073619
nodes = {

lib/overrides.lua

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,86 @@ function Game:update(dt)
471471
G.STATE = G.STATES.SELECTING_HAND
472472
G.STATE_COMPLETE = false
473473
end
474+
if
475+
G.STATE == G.STATES.HAND_PLAYED
476+
and to_big(G.GAME.chips) > to_big(G.GAME.blind.chips)
477+
and not G.hand.cards[1]
478+
and not G.deck.cards[1]
479+
then
480+
--im having to manually recreate some of this idk why
481+
G.RESET_BLIND_STATES = true
482+
G.RESET_JIGGLES = true
483+
G.GAME.blind.in_blind = false
484+
G.E_MANAGER:add_event(Event({
485+
trigger = 'after',
486+
delay = 0.3,
487+
func = function()
488+
if G.GAME.blind.config.blind.cry_before_cash and not G.GAME.blind.disabled then
489+
G.GAME.blind:cry_before_cash()
490+
else
491+
G.GAME.cry_make_a_decision = nil
492+
493+
G.STATE = G.STATES.ROUND_EVAL
494+
G.STATE_COMPLETE = false
495+
end
496+
497+
if G.GAME.blind_on_deck == 'Small' then
498+
G.GAME.round_resets.blind_states.Small = 'Defeated'
499+
elseif G.GAME.blind_on_deck == 'Big' then
500+
G.GAME.round_resets.blind_states.Big = 'Defeated'
501+
else
502+
if G.GAME.current_round.cry_voucher_stickers.pinned == false then
503+
G.GAME.current_round.voucher = SMODS.get_next_vouchers()
504+
G.GAME.current_round.cry_voucher_stickers = Cryptid.next_voucher_stickers()
505+
G.GAME.current_round.cry_voucher_edition = cry_get_next_voucher_edition() or {}
506+
G.GAME.current_round.cry_bonusvouchers = {}
507+
G.GAME.cry_bonusvouchersused = {} -- i'm not sure why i'm putting these in two separate tables but it doesn't matter much
508+
for i = 1, G.GAME.cry_bonusvouchercount do
509+
G.GAME.current_round.cry_bonusvouchers[i] = SMODS.get_next_vouchers()
510+
end
511+
if G.GAME.modifiers.cry_no_vouchers then
512+
very_fair_quip = pseudorandom_element(G.localization.misc.very_fair_quips, pseudoseed("cry_very_fair"))
513+
end
514+
end
515+
G.GAME.round_resets.blind_states.Boss = 'Defeated'
516+
for k, v in ipairs(G.playing_cards) do
517+
v.ability.played_this_ante = nil
518+
end
519+
end
520+
521+
if G.GAME.round_resets.temp_handsize then G.hand:change_size(-G.GAME.round_resets.temp_handsize); G.GAME.round_resets.temp_handsize = nil end
522+
if G.GAME.round_resets.temp_reroll_cost then G.GAME.round_resets.temp_reroll_cost = nil; calculate_reroll_cost(true) end
523+
for _, v in pairs(find_joker("cry-loopy")) do
524+
if v.ability.extra.retrigger ~= 0 then
525+
v.ability.extra.retrigger = 0
526+
card_eval_status_text(v, 'extra', nil, nil, nil, {message = localize("k_reset"), colour = G.C.GREEN})
527+
end
528+
end
529+
for _, v in pairs(G.deck.cards) do
530+
v.sus = nil
531+
end
532+
if G.GAME.sus_cards then
533+
SMODS.calculate_context({ remove_playing_cards = true, removed = G.GAME.sus_cards })
534+
G.GAME.sus_cards = nil
535+
end
536+
537+
reset_idol_card()
538+
reset_mail_rank()
539+
reset_ancient_card()
540+
reset_castle_card()
541+
for _, mod in ipairs(SMODS.mod_list) do
542+
if mod.reset_game_globals and type(mod.reset_game_globals) == 'function' then
543+
mod.reset_game_globals(false)
544+
end
545+
end
546+
for k, v in ipairs(G.playing_cards) do
547+
v.ability.discarded = nil
548+
v.ability.forced_selection = nil
549+
end
550+
return true
551+
end
552+
}))
553+
end
474554
end
475555

476556
-- All the scattered set_cost hooks from all the pre refactor files moved into one hook

0 commit comments

Comments
 (0)