balatro-mods/Steamodded/lovely/challenge.toml

82 lines
2.6 KiB
TOML

[manifest]
version = "1.0.0"
dump_lua = true
priority = -5
# function G.UIDEF.challenge_list_page()
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
pattern = "local challenge_unlocked = G.PROFILES[G.SETTINGS.profile].challenges_unlocked and (G.PROFILES[G.SETTINGS.profile].challenges_unlocked >= k)"
position = 'after'
payload = """
if v.unlocked and type(v.unlocked) == 'function' then
challenge_unlocked = v:unlocked()
elseif type(v.unlocked) == 'boolean' then
challenge_unlocked = v.unlocked
end
challenge_unlocked = challenge_unlocked or G.PROFILES[G.SETTINGS.profile].all_unlocked
"""
match_indent = true
# Add button colour
[[patches]]
[patches.pattern]
target = "functions/UI_definitions.lua"
pattern = "UIBox_button({id = k, col = true, label = {challenge_unlocked and localize(v.id, 'challenge_names') or localize('k_locked'),}, button = challenge_unlocked and 'change_challenge_description' or 'nil', colour = challenge_unlocked and G.C.RED or G.C.GREY, minw = 4, scale = 0.4, minh = 0.6, focus_args = {snap_to = not snapped}}),"
position = 'at'
match_indent = true
payload = '''
UIBox_button({id = k, col = true, label = {challenge_unlocked and localize(v.id, 'challenge_names') or localize('k_locked'),}, button = challenge_unlocked and 'change_challenge_description' or 'nil', colour = challenge_unlocked and (v.button_colour or G.C.RED) or G.C.GREY, minw = 4, scale = 0.4, minh = 0.6, focus_args = {snap_to = not snapped}}),
'''
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = '''if _ch.restrictions.banned_cards then'''
position = "after"
payload = ''' if type(_ch.restrictions.banned_cards) == 'function' then
_ch.restrictions.banned_cards = _ch.restrictions.banned_cards()
end'''
match_indent = true
times = 1
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = '''if _ch.restrictions.banned_tags then'''
position = "after"
payload = '''
if type(_ch.restrictions.banned_tags) == 'function' then
_ch.restrictions.banned_tags = _ch.restrictions.banned_tags()
end'''
match_indent = true
times = 1
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = '''if _ch.restrictions.banned_other then'''
position = "after"
payload = '''
if type(_ch.restrictions.banned_other) == 'function' then
_ch.restrictions.banned_other = _ch.restrictions.banned_other()
end'''
match_indent = true
times = 1
# apply
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = '''
local _ch = args.challenge
'''
position = "after"
payload = '''
if _ch.apply and type(_ch.apply) == "function" then
_ch:apply()
end
'''
match_indent = true