[manifest]
version = "1.0.0"
dump_lua = true
priority = 0

# gonna use a separate file for this because it'll be a lot
# golden text
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
pattern = '''
{n=G.UIT.O, config={id = 'hand_name', func = 'hand_text_UI_set',object = DynaText({string = {{ref_table = G.GAME.current_round.current_hand, ref_value = "handname_text"}}, colours = {G.C.UI.TEXT_LIGHT}, shadow = true, float = true, scale = scale*1.4})}},
'''
position = "after"
payload = '''
{n=G.UIT.O, config={id = 'cry_asc', func = 'cry_asc_UI_set',object = DynaText({string = {{ref_table = G.GAME.current_round.current_hand, ref_value = "cry_asc_num_text"}}, colours = {G.C.GOLD}, shadow = true, float = true, scale = scale*1})}},
'''
match_indent = true

# state events moment
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''
                delay = G.GAME.current_round.current_hand.handname ~= disp_text and 0.4 or 0}, {handname=disp_text, level=G.GAME.hands[text].level, mult = G.GAME.hands[text].mult, chips = G.GAME.hands[text].chips})
'''
position = "at"
payload = '''
                delay = G.GAME.current_round.current_hand.handname ~= disp_text and 0.4 or 0}, {handname=disp_text, level=G.GAME.hands[text].level, mult = Cryptid.ascend(G.GAME.hands[text].mult), chips = Cryptid.ascend(G.GAME.hands[text].chips)})
'''
match_indent = true

# increment
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''
G.GAME.hands[text].played_this_round = G.GAME.hands[text].played_this_round + 1
'''
position = "before"
payload = '''
if G.GAME.current_round.current_hand.cry_asc_num and (((type(G.GAME.current_round.current_hand.cry_asc_num) == "table" and G.GAME.current_round.current_hand.cry_asc_num:gt(to_big(G.GAME.cry_exploit_override and 1 or 0)) or G.GAME.current_round.current_hand.cry_asc_num > (G.GAME.cry_exploit_override and 1 or 0)))) then
	G.GAME.cry_asc_played = G.GAME.cry_asc_played and G.GAME.cry_asc_played+1 or 1
end
'''
match_indent = true

# even worse
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''
        mult = mod_mult(G.GAME.hands[text].mult)
'''
position = "at"
payload = '''
        mult = mod_mult(Cryptid.ascend(G.GAME.hands[text].mult))
'''
match_indent = true

# again
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''
        hand_chips = mod_chips(G.GAME.hands[text].chips)
'''
position = "at"
payload = '''
        hand_chips = mod_chips(Cryptid.ascend(G.GAME.hands[text].chips))
'''
match_indent = true

# b
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = '''
        update_hand_text({delay = 0}, {chips = G.GAME.hands[hand].chips, StatusText = true})
'''
position = "at"
payload = '''
update_hand_text({delay = 0}, {chips = Cryptid.ascend(G.GAME.hands[hand].chips), StatusText = true})
'''
match_indent = true

# same old
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = '''
        update_hand_text({delay = 0}, {mult = G.GAME.hands[hand].mult, StatusText = true})
'''
position = "at"
payload = '''
update_hand_text({delay = 0}, {mult = Cryptid.ascend(G.GAME.hands[hand].mult), StatusText = true})
'''
match_indent = true

# the removal (this is slightly invasive, should switch to regex)
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''
check_and_set_high_score('hand', hand_chips*mult)
'''
position = "before"
payload = '''
    G.E_MANAGER:add_event(Event({
      trigger = 'immediate',
      func = (function() G.GAME.current_round.current_hand.cry_asc_num = 0;G.GAME.current_round.current_hand.cry_asc_num_text = '';return true end)
    }))
'''
match_indent = true

# the rare cardarea inject
[[patches]]
[patches.pattern]
target = "cardarea.lua"
pattern = '''
update_hand_text({immediate = true, nopulse = nil, delay = 0}, {handname=disp_text, level=G.GAME.hands[text].level, mult = G.GAME.hands[text].mult, chips = G.GAME.hands[text].chips})
'''
position = "at"
payload = '''
update_hand_text({immediate = true, nopulse = nil, delay = 0}, {handname=disp_text, level=G.GAME.hands[text].level, mult = Cryptid.ascend(G.GAME.hands[text].mult), chips = Cryptid.ascend(G.GAME.hands[text].chips)})
'''
match_indent = true

# hyperspace splasher
[[patches]]
[patches.pattern]
target = "state_events.lua"
pattern = '''
if next(find_joker('Splash')) then
'''
position = "at"
payload = '''
if next(find_joker('Splash')) or G.GAME.used_vouchers.v_cry_hyperspacetether then
'''
match_indent = true

# initialise variables
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = '''
                chip_total_text = '',
'''
position = "after"
payload = '''
                cry_asc_num = 0,
                cry_asc_num_text = '',
'''
match_indent = true

# i hope this is worth it
[[patches]]
[patches.pattern]
target = "functions/misc_functions.lua"
pattern = '''
G.ARGS.score_intensity.required_score = G.GAME.blind and G.GAME.blind.chips or 0
'''
position = "after"
payload = '''
if G.cry_flame_override and G.cry_flame_override['duration'] > 0 then
	G.cry_flame_override['duration'] = math.max(0, G.cry_flame_override['duration'] - dt)
end
'''
match_indent = true

# overwrite the value for better pulsing
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = '''
_F.real_intensity = math.max(0, _F.real_intensity + _F.intensity_vel)
'''
position = "after"
payload = '''

_F.real_intensity = (G.cry_flame_override and G.cry_flame_override['duration'] > 0) and ((_F.real_intensity + G.cry_flame_override['intensity'])/2) or _F.real_intensity
'''
match_indent = true

# again (this is messy, don't really know how these lines even work)
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = '''
_F.change = (_F.change or 0)*(1 - 4.*G.real_dt) + ( 4.*G.real_dt)*(_F.real_intensity < _F.intensity - 0.0 and 1 or 0)*_F.real_intensity
'''
position = "after"
payload = '''
_F.change = (G.cry_flame_override and G.cry_flame_override['duration'] > 0) and ((_F.change + G.cry_flame_override['intensity'])/2) or _F.change
'''
match_indent = true
