balatro-mods/Cryptid/lovely/code.toml

783 lines
25 KiB
TOML

[manifest]
version = "1.0.0"
dump_lua = true
priority = -1
# Code UI disables hold R shortcut
[[patches]]
[patches.pattern]
target = "engine/controller.lua"
pattern = 'if key == "r" and not G.SETTINGS.paused then'
position = "at"
payload = 'if key == "r" and not G.SETTINGS.paused and not (G.GAME and G.GAME.USING_CODE) then'
match_indent = true
# Payload - cash out UI
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "elseif config.name == 'interest' then"
position = "before"
payload = '''
elseif config.name == 'interest_payload' then
table.insert(left_text, {n=G.UIT.T, config={text = num_dollars, scale = 0.8*scale, colour = G.C.SECONDARY_SET.Code, shadow = true, juice = true}})
table.insert(left_text,{n=G.UIT.O, config={object = DynaText({string = {" "..localize{type = 'variable', key = 'interest', vars = {G.GAME.interest_amount*config.payload, 5, G.GAME.interest_amount*config.payload*G.GAME.interest_cap/5}}}, colours = {G.C.SECONDARY_SET.Code}, shadow = true, pop_in = 0, scale = 0.4*scale, silent = true})}})
'''
match_indent = true
# Payload - cash out
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "if G.GAME.dollars >= 5 and not G.GAME.modifiers.no_interest then"
position = "at"
payload = '''
if G.GAME.dollars >= 5 and not G.GAME.modifiers.no_interest and G.GAME.cry_payload then
add_round_eval_row({bonus = true, payload = G.GAME.cry_payload, name='interest_payload', pitch = pitch, dollars = G.GAME.interest_amount*G.GAME.cry_payload*math.min(math.floor(G.GAME.dollars/5), G.GAME.interest_cap/5)})
pitch = pitch + 0.06
if not G.GAME.seeded and not G.GAME.challenge then
if G.GAME.interest_amount*math.min(math.floor(G.GAME.dollars/5), G.GAME.interest_cap/5) == G.GAME.interest_amount*G.GAME.interest_cap/5 then
G.PROFILES[G.SETTINGS.profile].career_stats.c_round_interest_cap_streak = G.PROFILES[G.SETTINGS.profile].career_stats.c_round_interest_cap_streak + 1
else
G.PROFILES[G.SETTINGS.profile].career_stats.c_round_interest_cap_streak = 0
end
end
check_for_unlock({type = 'interest_streak'})
dollars = dollars + G.GAME.interest_amount*G.GAME.cry_payload*math.min(math.floor(G.GAME.dollars/5), G.GAME.interest_cap/5)
G.GAME.cry_payload = nil
elseif G.GAME.dollars >= 5 and not G.GAME.modifiers.no_interest then'''
match_indent = true
# Revert - fix a crash
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = "if area and area.cards[1] then"
position = "at"
payload = "if area and area.cards and area.cards[1] then"
match_indent = true
# Crash - use glitched shader
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = "G.SHADERS['CRT']:send('glitch_intensity', 0)--0.1*G.SETTINGS.GRAPHICS.crt/100 + (G.screenwipe_amt) + 1)"
position = "at"
payload = "G.SHADERS['CRT']:send('glitch_intensity', glitched_intensity or 0)"
match_indent = true
# Semicolon - don't lose
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''G.RESET_JIGGLES = true'''
position = 'after'
match_indent = true
payload = '''
if G.GAME.current_round.semicolon then
game_over = false
end
'''
# Semicolon - polished UI
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = '''{n=G.UIT.T, config={text = localize('b_cash_out')..": ", scale = 1, colour = G.C.UI.TEXT_LIGHT, shadow = true}},'''
position = "at"
payload = '''{n=G.UIT.T, config={text = G.GAME.current_round.semicolon and localize('k_end_blind') or (localize('b_cash_out')..": "), scale = 1, colour = G.C.UI.TEXT_LIGHT, shadow = true}},'''
match_indent = true
# Semicolon - polished UI
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = '''{n=G.UIT.T, config={text = localize('$')..format_ui_value(config.dollars), scale = 1.2*scale, colour = G.C.WHITE, shadow = true, juice = true}}'''
position = "at"
payload = '''{n=G.UIT.T, config={text = not G.GAME.current_round.semicolon and localize('$')..format_ui_value(config.dollars) or ';', scale = 1.2*scale, colour = G.C.WHITE, shadow = true, juice = true}}'''
match_indent = true
# Semicolon - polished UI
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = '''{n=G.UIT.R, config={id = 'cash_out_button', align = "cm", padding = 0.1, minw = 7, r = 0.15, colour = G.C.ORANGE, shadow = true, hover = true, one_press = true, button = 'cash_out', focus_args = {snap_to = true}}, nodes={'''
position = "at"
payload = '''{n=G.UIT.R, config={id = 'cash_out_button', align = "cm", padding = 0.1, minw = 7, r = 0.15, colour = G.GAME.current_round.semicolon and G.C.SET.Code or G.C.ORANGE, shadow = true, hover = true, one_press = true, button = 'cash_out', focus_args = {snap_to = true}}, nodes={'''
match_indent = true
# Delete - placeholder booster, in the case that all are deleted
[[patches]]
[patches.regex]
target = "functions/common_events.lua"
pattern = '''return center\nend\n\nfunction get_current_pool\(_type, _rarity, _legendary, _append\)'''
position = "before"
payload = '''if not center then center = G.P_CENTERS['p_buffoon_normal_1'] end '''
# Delete - banished keys prevent pool stuff, guess we're going for this method after all
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = '''if v.yes_pool_flag and not G.GAME.pool_flags[v.yes_pool_flag] then add = nil end'''
position = "after"
payload = '''if G.GAME.cry_banished_keys[v.key] then add = nil end'''
match_indent = true
# Delete - multiuse 1
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = '''if card.area and (not nc or card.area == G.pack_cards) then card.area:remove_card(card) end'''
position = "before"
payload = '''
local cry_muse = false
if card.ability.cry_multiuse and not (card.ability.cry_multiuse <= 1) then
cry_muse = true
dont_dissolve = true
end
'''
match_indent = true
# Multiuse + Function:// code
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = '''if (prev_state == G.STATES.TAROT_PACK or prev_state == G.STATES.PLANET_PACK or'''
position = "before"
payload = '''
if cry_muse then
card.ability.cry_multiuse = card.ability.cry_multiuse - 1
card.ability.extra_value = -1 * math.max(1, math.floor(card.cost/2))
card:set_cost()
delay(0.4)
-- i make my own card eval status text :D
card:juice_up()
play_sound('generic1')
attention_text({
text = format_ui_value(card.ability.cry_multiuse),
scale = 1.1,
hold = 0.6,
major = card,
backdrop_colour = G.C.SET[card.config.center.set],
align = 'bm',
offset = {x = 0, y = 0.2}
})
delay(0.8)
if card.playing_card then
draw_card(G.play, G.hand, 1, 'up', true, card, nil, true)
elseif not G.GAME.modifiers.cry_beta then
if to_big(#G.consumeables.cards) < to_big(G.consumeables.config.card_limit) then
draw_card(G.play, G.consumeables, 1, 'up', true, card, nil, true)
else card:start_dissolve()
end
else
if to_big(#G.jokers.cards) < to_big(G.jokers.config.card_limit) then
draw_card(G.play, G.jokers, 1, 'up', true, card, nil, true)
else card:start_dissolve()
end
end
end
if not G.GAME.modifiers.cry_beta then -- function code + fallback
if card.ability.cry_function_counter == 1 then
G.E_MANAGER:add_event(Event({
func = function()
local new_card = create_card(
"Consumeables",
G.consumeables,
nil,
nil,
nil,
nil,
G.GAME.cry_function_cards[2],
"cry_cryfunction"
)
new_card:add_to_deck()
new_card.ability.cry_function_sticker = true
new_card.ability.cry_function_counter = 2
G.consumeables:emplace(new_card)
G.GAME.consumeable_buffer = 0
return true
end,
}))
elseif card.ability.cry_function_counter == 2 then
G.E_MANAGER:add_event(Event({
func = function()
local new_card = create_card(
"Consumeables",
G.consumeables,
nil,
nil,
nil,
nil,
G.GAME.cry_function_cards[3],
"cry_cryfunction"
)
new_card:add_to_deck()
G.consumeables:emplace(new_card)
G.GAME.consumeable_buffer = 0
return true
end,
}))
elseif card.ability.cry_function_sticker and not card.ability.cry_function_counter == 3 then
G.E_MANAGER:add_event(Event({
func = function()
local new_card = create_card(
"Consumeables",
G.consumeables,
nil,
nil,
nil,
nil,
nil,
"cry_cryfunction"
)
new_card:add_to_deck()
G.consumeables:emplace(new_card)
G.GAME.consumeable_buffer = 0
return true
end,
}))
end
else
if card.ability.cry_function_counter == 1 then
G.E_MANAGER:add_event(Event({
func = function()
local new_card = create_card(
"Consumeables",
G.jokers,
nil,
nil,
nil,
nil,
G.GAME.cry_function_cards[2],
"cry_cryfunction"
)
new_card:add_to_deck()
new_card.ability.cry_function_sticker = true
new_card.ability.cry_function_counter = 2
G.jokers:emplace(new_card)
G.GAME.consumeable_buffer = 0
return true
end,
}))
elseif card.ability.cry_function_counter == 2 then
G.E_MANAGER:add_event(Event({
func = function()
local new_card = create_card(
"Consumeables",
G.jokers,
nil,
nil,
nil,
nil,
G.GAME.cry_function_cards[3],
"cry_cryfunction"
)
new_card:add_to_deck()
G.jokers:emplace(new_card)
G.GAME.consumeable_buffer = 0
return true
end,
}))
elseif card.ability.cry_function_sticker and not card.ability.cry_function_counter == 3 then
G.E_MANAGER:add_event(Event({
func = function()
local new_card = create_card(
"Consumeables",
G.jokers,
nil,
nil,
nil,
nil,
nil,
"cry_cryfunction"
)
new_card:add_to_deck()
G.jokers:emplace(new_card)
G.GAME.consumeable_buffer = 0
return true
end,
}))
end
end
'''
match_indent = true
# Run - don't clear shop
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = '''if self.shop then self.shop:remove(); self.shop = nil end'''
position = "at"
payload = '''if self.shop and not G.GAME.USING_CODE then self.shop:remove(); self.shop = nil end'''
match_indent = true
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = '''ease_background_colour_blind(G.STATES.SHOP)'''
position = "at"
payload = '''if not G.GAME.USING_RUN then ease_background_colour_blind(G.STATES.SHOP) end'''
match_indent = true
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = '''if self.STATE == self.STATES.SELECTING_HAND then'''
position = "before"
payload = '''
if G.GAME.USING_RUN then
if not (self.STATE == self.STATES.STANDARD_PACK or self.STATE == self.STATES.BUFFOON_PACK or self.STATE == self.STATES.PLANET_PACK or self.STATE == self.STATES.TAROT_PACK or self.STATE == self.STATES.SPECTRAL_PACK or self.STATE == self.STATES.SMODS_BOOSTER_OPENED) then -- do you are have stupid
self.STATE = self.STATES.SHOP
end
if G.GAME.blind then G.GAME.blind:change_colour() end -- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
if G.load_cry_runarea then
G.cry_runarea = CardArea(
G.discard.T.x,
G.discard.T.y,
G.discard.T.w,
G.discard.T.h,
{ type = "discard", card_limit = 1e100 }
)
G.cry_runarea:load(G.load_cry_runarea)
G.load_cry_runarea = nil
end
end
'''
match_indent = true
# Run - handle packs (this is incredibly invasive)
# we can't do "draw from run to hand" because modded packs presumably don't get ovewritten like that
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''for i=1, hand_space do --draw cards from deckL'''
position = "before"
payload = '''if not G.GAME.USING_RUN then'''
match_indent = true
# the inconsistency hurts
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = '''G.FUNCS.draw_from_hand_to_deck()'''
position = "at"
payload = '''if not G.GAME.USING_RUN then
G.FUNCS.draw_from_hand_to_deck()
else
G.FUNCS.draw_from_hand_to_run()
end'''
match_indent = true
[[patches]]
[patches.regex]
target = "functions/state_events.lua"
pattern = '''end\n\s+G\.FUNCS\.discard_cards_from_highlighted \= function\(e, hook\)'''
position = "before"
payload = '''
else
for i = 1, #G.cry_runarea.cards do
draw_card(G.cry_runarea,G.hand, i*100/#G.cry_runarea.cards,'up', true)
end
end
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''G.FUNCS.draw_from_deck_to_hand = function(e)'''
position = "before"
payload = '''
G.FUNCS.draw_from_hand_to_run = function(e)
local hand_count = #G.hand.cards
for i=1, hand_count do --draw cards from deck
draw_card(G.hand, G.cry_runarea, i*100/hand_count,'down', nil, nil, 0.08)
end
end
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = '''G.shop.alignment.offset.y = -5.3'''
position = "at"
payload = '''if not G.shop then return true end
G.shop.alignment.offset.y = -5.3'''
match_indent = true
# Increase highlight limit for consumables
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = "{card_limit = self.GAME.starting_params.consumable_slots, type = 'joker', highlight_limit = 1, negative_info = 'consumable'})"
position = "at"
payload = "{card_limit = self.GAME.starting_params.consumable_slots, type = 'joker', highlight_limit = 1e100, negative_info = 'consumable'})"
match_indent = true
# Increase highlight limit for jokers
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = "{card_limit = self.GAME.starting_params.joker_slots, type = 'joker', highlight_limit = 1, negative_info = 'joker'})"
position = "at"
payload = "{card_limit = self.GAME.starting_params.joker_slots, type = 'joker', highlight_limit = 1e100, negative_info = 'joker'})"
match_indent = true
# Satellite Uplink
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = '''card = create_card("Planet", G.pack_cards, nil, nil, true, true, nil, 'pl1')'''
position = "at"
payload = '''
if G.GAME.used_vouchers.v_cry_satellite_uplink and pseudorandom('cry_satellite_uplink') > 0.8 then
card = create_card("Code", G.pack_cards, nil, nil, true, true, nil, 'pl2')
else
card = create_card("Planet", G.pack_cards, nil, nil, true, true, nil, 'pl1')
end
'''
match_indent = true
# Exploit - reset variables
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''-- TARGET: effects after hand evaluation'''
position = "after"
payload = '''
G.E_MANAGER:add_event(Event({
func = function()
G.GAME.cry_exploit_override = nil
return true
end
}))
'''
match_indent = true
# Exploit - patch into smods
[[patches]]
[patches.pattern]
target = '''=[SMODS _ "src/overrides.lua"]'''
pattern = '''disp_text = text'''
position = "before"
payload = '''
text = G.GAME.cry_exploit_override or text
'''
match_indent = true
# Multiuse localization
[[patches]]
[patches.pattern]
target = '''functions/common_events.lua'''
pattern = '''if main_end then'''
position = "before"
payload = '''
if cfg and cfg.cry_multiuse then
local loc = {}
localize{type = 'other', key = 'cry_multiuse', nodes = loc, vars = {cfg.cry_multiuse}}
desc_nodes[#desc_nodes+1] = loc[1]
end
'''
match_indent = true
# Double Tag makes exact copy of rework tag
[[patches]]
[patches.pattern]
target = "tag.lua"
pattern = 'add_tag(Tag(_context.tag.key))'
position = "at"
payload = '''
local tag = Tag(_context.tag.key)
if _context.tag.key == "tag_cry_rework" then
tag.ability.rework_edition = _context.tag.ability.rework_edition
tag.ability.rework_key = _context.tag.ability.rework_key
end
add_tag(tag)
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "G.GAME.last_hand_played = text"
position = "after"
payload = '''
G.GAME.last_hand_played_cards = {}
for i = 1, #G.play.cards do
G.GAME.last_hand_played_cards[i] = G.play.cards[i].sort_id
end
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "cardarea.lua"
pattern = "local text,disp_text,poker_hands = G.FUNCS.get_poker_hand_info(self.highlighted)"
position = "after"
payload = '''
local text,disp_text,poker_hands
if self == G.hand then
local tbl = {}
for i, v in pairs(G.jokers.cards) do
if v.base.nominal and v.base.suit then
tbl[#tbl+1] = v
end
end
text,disp_text,poker_hands = G.FUNCS.get_poker_hand_info(Cryptid.table_merge(self.highlighted, tbl))
else
text,disp_text,poker_hands = G.FUNCS.get_poker_hand_info(self.highlighted)
end
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "local text,disp_text,poker_hands,scoring_hand,non_loc_disp_text = G.FUNCS.get_poker_hand_info(G.play.cards)"
position = "after"
payload = '''
local tbl = {}
for i, v in pairs(G.jokers.cards) do
if v.base.nominal and v.base.suit then
tbl[#tbl+1] = v
end
end
local text,disp_text,poker_hands,scoring_hand,non_loc_disp_text = G.FUNCS.get_poker_hand_info(Cryptid.table_merge(G.play.cards, tbl))
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
pattern = "local text = {ref_table = args.ref_table, ref_value = args.ref_value, letters = {}, current_position = string.len(args.ref_table[args.ref_value])}"
position = "at"
payload = '''
local text = {ref_table = args.ref_table, ref_value = args.ref_value, letters = {}, current_position = string.len(args.ref_table[args.ref_value] or "")}
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
pattern = '''
UIBox_button({button = 'your_collection_enhancements', label = {localize('b_enhanced_cards')}, minw = 5}),
UIBox_button({button = 'your_collection_seals', label = {localize('b_seals')}, minw = 5, id = 'your_collection_seals'}),
UIBox_button({button = 'your_collection_editions', label = {localize('b_editions')}, count = G.DISCOVER_TALLIES.editions, minw = 5, id = 'your_collection_editions'}),
'''
position = "at"
payload = '''
enhanced,
seals,
editions,
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
pattern = '''
local t = create_UIBox_generic_options({ back_func = G.STAGE == G.STAGES.RUN and 'options' or 'exit_overlay_menu', contents = {
'''
position = "before"
payload = '''
local use_pointer = G.GAME.USING_POINTER or G.GAME.POINTER_COLLECTION
local enhanced = (not use_pointer and UIBox_button({button = 'your_collection_enhancements', label = {localize('b_enhanced_cards')}, minw = 5}))
or UIBox_button({button = 'your_collection_create_card_rank', label = {localize('b_playing_cards')}, minw = 5, minh = 3.4, id = 'your_collection_create_card'})
local seals = (not use_pointer and UIBox_button({button = 'your_collection_seals', label = {localize('b_seals')}, minw = 5, id = 'your_collection_seals'})) or nil
local editions = not use_pointer and UIBox_button({button = 'your_collection_editions', label = {localize('b_editions')}, count = G.DISCOVER_TALLIES.editions, minw = 5, id = 'your_collection_editions'}) or nil
local blinds = UIBox_button({button = 'your_collection_blinds', label = {localize('b_blinds')}, count = G.DISCOVER_TALLIES.blinds, minw = 5, minh = (use_pointer and 2.8 or 2.0), id = 'your_collection_blinds', focus_args = {snap_to = true}})
local other = not use_pointer and UIBox_button({button = 'your_collection_other_gameobjects', label = {localize('k_other')}, minw = 5, id = 'your_collection_other_gameobjects', focus_args = {snap_to = true}}) or nil
local decks = not use_pointer and UIBox_button({button = 'your_collection_decks', label = {localize('b_decks')}, count = G.DISCOVER_TALLIES.backs, minw = 5}) or nil
local vouchers = UIBox_button({button = 'your_collection_vouchers', label = {localize('b_vouchers')}, count = G.DISCOVER_TALLIES.vouchers, minw = 5, id = 'your_collection_vouchers', minh = use_pointer and 2.0})
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
pattern = '''
UIBox_button({button = 'your_collection_blinds', label = {localize('b_blinds')}, count = G.DISCOVER_TALLIES.blinds, minw = 5, minh = 2.0, id = 'your_collection_blinds', focus_args = {snap_to = true}}),UIBox_button({button = 'your_collection_other_gameobjects', label = {localize('k_other')}, minw = 5, id = 'your_collection_other_gameobjects', focus_args = {snap_to = true}}),
'''
position = "at"
payload = '''
blinds,
other
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
pattern = '''
UIBox_button({button = 'your_collection_decks', label = {localize('b_decks')}, count = G.DISCOVER_TALLIES.backs, minw = 5}),
UIBox_button({button = 'your_collection_vouchers', label = {localize('b_vouchers')}, count = G.DISCOVER_TALLIES.vouchers, minw = 5, id = 'your_collection_vouchers'}),
'''
position = "at"
payload = '''
decks,
vouchers,
'''
match_indent = true
[[patches]]
[patches.pattern]
target = '''=[SMODS _ "src/overrides.lua"]'''
pattern = '''
if v.discovered and not v.alerted then
blinds_to_be_alerted[#blinds_to_be_alerted + 1] = card
end
'''
position = "at"
payload = '''
if v.discovered and not v.alerted then
blinds_to_be_alerted[#blinds_to_be_alerted + 1] = card
end
card.click = function()
if G.GAME.USING_POINTER then
local self = v
local b = self
if not b.no_doe and not b.hidden and not b.no_pointer then
local bl = "Boss"
G.GAME.round_resets.blind_choices[bl] = b.key
if G.blind_select or G.GAME.blind_on_deck ~= "Boss" then
if G.blind_select then
G.blind_select:remove()
G.blind_prompt_box:remove()
G.STATE_COMPLETE = false
end
else
G.GAME.blind:disable()
G.GAME.blind:set_blind(G.P_BLINDS[b.key])
end
G.FUNCS.exit_overlay_menu_code()
if G.GAME.CODE_DESTROY_CARD then
G.GAME.CODE_DESTROY_CARD:start_dissolve()
G.GAME.CODE_DESTROY_CARD = nil
end
end
end
end
'''
match_indent = true
[[patches]]
[patches.pattern]
target = '''=[SMODS _ "src/overrides.lua"]'''
pattern = '''
for k, _hand in pairs(SMODS.PokerHands) do
results[k] = _hand.evaluate(parts, hand) or {}
end
'''
position = "after"
payload = '''
local hands = {
G.GAME.hands.cry_Declare0,
G.GAME.hands.cry_Declare1,
G.GAME.hands.cry_Declare2,
}
for i, v in pairs(hands) do
if v.index then
local is_this_hand = true
local cards = {}
if v.declare_cards then
local satisfied = true
for i, v in pairs(v.declare_cards) do
local rank
local suit
for i2, v2 in pairs(hand) do
if not v2.canfit then
if SMODS.has_no_rank(v2) and v.rank == "rankless" or v2:get_id() == v.rank then
if v2:is_suit(v.suit) or (v.suit == "suitless" and SMODS.has_no_suit(v2)) or not v.suit then
v2.canfit = true
end
end
end
if not v2.marked and not (suit and rank) then
if SMODS.has_no_rank(v2) and v.rank == "rankless" or v2:get_id() == v.rank then rank = true end
if v2:is_suit(v.suit) or (v.suit == "suitless" and SMODS.has_no_suit(v2)) or not v.suit then suit = true end
if not (suit and rank) then
suit = false
rank = false
end
if suit and rank then
cards[#cards+1] = v2
v2.marked = true
end
end
end
if not rank or not suit then satisfied = false end
end
for i2, v2 in pairs(hand) do
v2.marked = false
if v2.canfit then
cards[#cards+1] = v2
v2.canfit = nil
end
end
if not satisfied then is_this_hand = false end
end
if is_this_hand then
key = "cry_Declare"..tostring(v.index)
local tbl = {cards}
local skey = ({
[0] = "Flush",
[1] = "Straight",
[2] = "Full House"
})[v.index]
results[key] = tbl
results[skey] = tbl
if skey == "Full House" then
results["Three of a Kind"] = tbl
results["Two Pair"] = tbl
results["Pair"] = tbl
end
results.top = tbl
else
key = "cry_Declare"..tostring(v.index)
results[key] = {}
end
end
end
if not results["cry_Declare0"] then results["cry_Declare0"] = {} end
if not results["cry_Declare1"] then results["cry_Declare1"] = {} end
if not results["cry_Declare2"] then results["cry_Declare2"] = {} end
'''
match_indent = true
[[patches]]
[patches.pattern]
target = '''=[SMODS _ "src/overrides.lua"]'''
pattern = '''
for k, v in pairs(SMODS.PokerHands[key]) do
'''
position = "at"
payload = '''
for k, v in pairs(SMODS.PokerHands[key] or {}) do
'''
match_indent = true
[[patches]]
[patches.pattern]
target = '''card.lua'''
pattern = '''
for k, v in pairs(G.P_CENTER_POOLS.Planet) do
if v.config.hand_type == G.GAME.last_hand_played then
_planet = v.key
end
end
'''
position = "after"
payload = '''
if (G.GAME.last_hand_played == "cry_Declare0" or G.GAME.last_hand_played == "cry_Declare1" or G.GAME.last_hand_played == "cry_Declare2") and Cryptid.enabled("c_cry_voxel") == true then
_planet = "c_cry_voxel"
end
'''
match_indent = true