Skip to content

Commit c48d829

Browse files
committed
fix softlock related to beating a round with none
1 parent 0e949a0 commit c48d829

File tree

1 file changed

+244
-4
lines changed

1 file changed

+244
-4
lines changed

lib/overrides.lua

Lines changed: 244 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function Blind:defeat(s)
171171
and (self.name ~= "The Needle" or not G.GAME.defeated_blinds["bl_cry_tax"])
172172
and (self.name ~= "cry-Tax" or not G.GAME.defeated_blinds["bl_needle"])
173173
then
174-
G.GAME.defeated_blinds[self.config.blind.key] = true
174+
G.GAME.defeated_blinds[self.config.blind.key or ""] = true
175175
end
176176
end
177177

@@ -319,6 +319,7 @@ cry_pointer_dt = 0
319319
cry_jimball_dt = 0
320320
cry_glowing_dt = 0
321321
cry_glowing_dt2 = 0
322+
local none_eval = 0
322323
function Game:update(dt)
323324
upd(self, dt)
324325
if not Cryptid.member_count_delay then
@@ -513,13 +514,252 @@ function Game:update(dt)
513514
G.STATE = G.STATES.SELECTING_HAND
514515
G.STATE_COMPLETE = false
515516
end
517+
if G.STATE == G.STATES.NEW_ROUND or G.STATE == G.STATES.HAND_PLAYED then
518+
none_eval = none_eval + dt
519+
else
520+
none_eval = 0
521+
end
516522
if
517-
G.STATE == G.STATES.HAND_PLAYED
518-
and to_big(G.GAME.chips) > to_big(G.GAME.blind.chips)
523+
(G.STATE == G.STATES.NEW_ROUND or G.STATE == G.STATES.HAND_PLAYED)
524+
and to_big(G.GAME.chips) >= to_big(G.GAME.blind.chips)
519525
and not G.hand.cards[1]
520526
and not G.deck.cards[1]
527+
and not G.play.cards[1]
528+
and not G.discard.cards[1]
529+
and none_eval > 2
521530
then
522-
--im having to manually recreate some of this idk why
531+
none_eval = -999
532+
G.GAME.blind.in_blind = false
533+
local game_over = true
534+
local game_won = false
535+
G.RESET_BLIND_STATES = true
536+
G.RESET_JIGGLES = true
537+
if G.GAME.current_round.semicolon then
538+
game_over = false
539+
end
540+
if to_big(G.GAME.chips) >= to_big(G.GAME.blind.chips) then
541+
game_over = false
542+
end
543+
-- context.end_of_round calculations
544+
SMODS.saved = false
545+
SMODS.calculate_context({end_of_round = true, game_over = game_over, beat_boss = G.GAME.blind.boss })
546+
if SMODS.saved then game_over = false end
547+
-- TARGET: main end_of_round evaluation
548+
local i = 1
549+
while i <= #G.jokers.cards do
550+
local gone = G.jokers.cards[i]:calculate_banana()
551+
if not gone then i = i + 1 end
552+
end
553+
if G.GAME.round_resets.ante >= G.GAME.win_ante and G.GAME.blind_on_deck == 'Boss' then
554+
game_won = true
555+
G.GAME.won = true
556+
end
557+
if game_over then
558+
G.STATE = G.STATES.GAME_OVER
559+
if not G.GAME.won and not G.GAME.seeded and not G.GAME.challenge then
560+
G.PROFILES[G.SETTINGS.profile].high_scores.current_streak.amt = 0
561+
end
562+
G:save_settings()
563+
G.FILE_HANDLER.force = true
564+
G.STATE_COMPLETE = false
565+
else
566+
G.GAME.unused_discards = (G.GAME.unused_discards or 0) + G.GAME.current_round.discards_left
567+
if G.GAME.blind and G.GAME.blind.config.blind then
568+
discover_card(G.GAME.blind.config.blind)
569+
end
570+
571+
if G.GAME.blind_on_deck == 'Boss' then
572+
local _handname, _played, _order = 'High Card', -1, 100
573+
for k, v in pairs(G.GAME.hands) do
574+
if v.played > _played or (v.played == _played and _order > v.order) then
575+
_played = v.played
576+
_handname = k
577+
end
578+
end
579+
G.GAME.current_round.most_played_poker_hand = _handname
580+
end
581+
582+
if G.GAME.blind:get_type() == 'Boss' and not G.GAME.seeded and not G.GAME.challenge then
583+
G.GAME.current_boss_streak = G.GAME.current_boss_streak + 1
584+
check_and_set_high_score('boss_streak', G.GAME.current_boss_streak)
585+
end
586+
587+
if G.GAME.current_round.hands_played == 1 then
588+
inc_career_stat('c_single_hand_round_streak', 1)
589+
else
590+
if not G.GAME.seeded and not G.GAME.challenge then
591+
G.PROFILES[G.SETTINGS.profile].career_stats.c_single_hand_round_streak = 0
592+
G:save_settings()
593+
end
594+
end
595+
596+
check_for_unlock({type = 'round_win'})
597+
set_joker_usage()
598+
if game_won and not G.GAME.win_notified then
599+
G.GAME.win_notified = true
600+
G.E_MANAGER:add_event(Event({
601+
trigger = 'immediate',
602+
blocking = false,
603+
blockable = false,
604+
func = (function()
605+
if G.STATE == G.STATES.ROUND_EVAL then
606+
win_game()
607+
G.GAME.won = true
608+
return true
609+
end
610+
end)
611+
}))
612+
end
613+
for _,v in ipairs(SMODS.get_card_areas('playing_cards', 'end_of_round')) do
614+
SMODS.calculate_end_of_round_effects({ cardarea = v, end_of_round = true, beat_boss = G.GAME.blind.boss })
615+
end
616+
617+
618+
619+
local i = 1
620+
while i <= #G.hand.cards do
621+
local gone = G.hand.cards[i]:calculate_banana()
622+
if not gone then i = i + 1 end
623+
end
624+
for i = 1, #G.discard.cards do
625+
G.discard.cards[i]:calculate_perishable()
626+
end
627+
i = 1
628+
while i <= #G.deck.cards do
629+
G.deck.cards[i]:calculate_perishable()
630+
local gone = G.deck.cards[i]:calculate_banana()
631+
if not gone then i = i + 1 end
632+
end
633+
if G.GAME.used_vouchers.v_cry_double_down then
634+
local function update_dbl(area)
635+
local area = G.jokers
636+
for i = 1, #area.cards do
637+
if area.cards[i].ability.immutable and type(area.cards[i].ability.immutable.other_side) == "table" then
638+
--tweak to do deck effects with on the flip side
639+
if not G.P_CENTERS[area.cards[i].ability.immutable.other_side.key].immutable then
640+
if area.cards[i].ability.immutable.other_side and area.cards[i].edition.cry_double_sided then
641+
Cryptid.manipulate_table(
642+
area.cards[i],
643+
area.cards[i].ability.immutable,
644+
"other_side",
645+
{
646+
value = 1.5,
647+
type = "X",
648+
big = Cryptid.is_card_big({config = {center = G.P_CENTERS[area.cards[i].ability.immutable.other_side.key]}})
649+
}
650+
)
651+
card_eval_status_text(area.cards[i], "extra", nil, nil, nil, { message = localize("k_upgrade_ex") })
652+
end
653+
end
654+
end
655+
end
656+
end
657+
update_dbl(G.jokers)
658+
update_dbl(G.consumeables)
659+
update_dbl(G.hand)
660+
update_dbl(G.discard)
661+
update_dbl(G.deck)
662+
end
663+
i = 1
664+
while i <= #G.hand.cards do
665+
local gone = G.hand.cards[i]:calculate_abstract_break()
666+
if not gone then i = i + 1 end
667+
end
668+
-- i = 1
669+
-- while i <= #G.deck.cards do
670+
-- local gone = G.deck.cards[i]:calculate_abstract_break()
671+
-- if not gone then i = i + 1 end
672+
-- end
673+
-- i = 1
674+
-- while i <= #G.discard.cards do
675+
-- local gone = G.discard.cards[i]:calculate_abstract_break()
676+
-- if not gone then i = i + 1 end
677+
-- end
678+
G.FUNCS.draw_from_hand_to_discard()
679+
if G.GAME.blind_on_deck == 'Boss' then
680+
G.GAME.voucher_restock = nil
681+
if G.GAME.modifiers.set_eternal_ante and (G.GAME.round_resets.ante == G.GAME.modifiers.set_eternal_ante) then
682+
for k, v in ipairs(G.jokers.cards) do
683+
v:set_eternal(true)
684+
end
685+
end
686+
if G.GAME.modifiers.set_joker_slots_ante and (G.GAME.round_resets.ante == G.GAME.modifiers.set_joker_slots_ante) then
687+
G.jokers.config.card_limit = 0
688+
end
689+
delay(0.4); ease_ante(G.GAME.blind and G.GAME.blind:cry_calc_ante_gain() or 1); Cryptid.apply_ante_tax(); delay(0.4); check_for_unlock({type = 'ante_up', ante = G.GAME.round_resets.ante + 1})
690+
end
691+
G.FUNCS.draw_from_discard_to_deck()
692+
G.E_MANAGER:add_event(Event({
693+
trigger = 'after',
694+
delay = 0.3,
695+
func = function()
696+
if G.GAME.blind.config.blind.cry_before_cash and not G.GAME.blind.disabled then
697+
G.GAME.blind:cry_before_cash()
698+
else
699+
G.GAME.cry_make_a_decision = nil
700+
701+
G.STATE = G.STATES.ROUND_EVAL
702+
G.STATE_COMPLETE = false
703+
end
704+
705+
if G.GAME.blind_on_deck == 'Small' then
706+
G.GAME.round_resets.blind_states.Small = 'Defeated'
707+
elseif G.GAME.blind_on_deck == 'Big' then
708+
G.GAME.round_resets.blind_states.Big = 'Defeated'
709+
else
710+
if G.GAME.current_round.cry_voucher_stickers.pinned == false then
711+
G.GAME.current_round.voucher = SMODS.get_next_vouchers()
712+
G.GAME.current_round.cry_voucher_stickers = Cryptid.next_voucher_stickers()
713+
G.GAME.current_round.cry_voucher_edition = cry_get_next_voucher_edition() or {}
714+
G.GAME.current_round.cry_bonusvouchers = {}
715+
G.GAME.cry_bonusvouchersused = {} -- i'm not sure why i'm putting these in two separate tables but it doesn't matter much
716+
for i = 1, G.GAME.cry_bonusvouchercount do
717+
G.GAME.current_round.cry_bonusvouchers[i] = SMODS.get_next_vouchers()
718+
end
719+
if G.GAME.modifiers.cry_no_vouchers then
720+
very_fair_quip = pseudorandom_element(G.localization.misc.very_fair_quips, pseudoseed("cry_very_fair"))
721+
end
722+
end
723+
G.GAME.round_resets.blind_states.Boss = 'Defeated'
724+
for k, v in ipairs(G.playing_cards) do
725+
v.ability.played_this_ante = nil
726+
end
727+
end
728+
729+
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
730+
if G.GAME.round_resets.temp_reroll_cost then G.GAME.round_resets.temp_reroll_cost = nil; calculate_reroll_cost(true) end
731+
for _, v in pairs(find_joker("cry-loopy")) do
732+
if v.ability.extra.retrigger ~= 0 then
733+
v.ability.extra.retrigger = 0
734+
card_eval_status_text(v, 'extra', nil, nil, nil, {message = localize("k_reset"), colour = G.C.GREEN})
735+
end
736+
end
737+
for _, v in pairs(G.deck.cards) do
738+
v.sus = nil
739+
end
740+
if G.GAME.sus_cards then
741+
SMODS.calculate_context({ remove_playing_cards = true, removed = G.GAME.sus_cards })
742+
G.GAME.sus_cards = nil
743+
end
744+
745+
reset_idol_card()
746+
reset_mail_rank()
747+
reset_ancient_card()
748+
reset_castle_card()
749+
for _, mod in ipairs(SMODS.mod_list) do
750+
if mod.reset_game_globals and type(mod.reset_game_globals) == 'function' then
751+
mod.reset_game_globals(false)
752+
end
753+
end
754+
for k, v in ipairs(G.playing_cards) do
755+
v.ability.discarded = nil
756+
v.ability.forced_selection = nil
757+
end
758+
return true
759+
end
760+
}))
761+
end
762+
523763
end
524764
end
525765

0 commit comments

Comments
 (0)