balatro-mods/smods-main/lovely/dollar_row.toml

78 lines
2.8 KiB
TOML

[manifest]
version = "1.0.0"
dump_lua = true
priority = -10
### Dollar row patches (API removed)
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "if num_dollars > 60 then"
position = "at"
payload = '''
if num_dollars > 60 or num_dollars < -60 then'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "local dollar_string = localize('$')..num_dollars"
position = "at"
payload = '''
if num_dollars < 0 then --if negative
G.E_MANAGER:add_event(Event({
trigger = 'before',delay = 0.38,
func = function()
G.round_eval:add_child(
{n=G.UIT.R, config={align = "cm", id = 'dollar_row_'..(dollar_row+1)..'_'..config.name}, nodes={
{n=G.UIT.O, config={object = DynaText({string = {'-'..localize('$')..format_ui_value(-num_dollars)}, colours = {G.C.MONEY}, shadow = true, pop_in = 0, scale = 0.65, float = true})}}
}},
G.round_eval:get_UIE_by_ID('dollar_'..config.name))
play_sound('coin3', 0.9+0.2*math.random(), 0.7)
play_sound('coin6', 1.3, 0.8)
return true
end
}))
else --if positive
'''
match_indent = true
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "for i = 1, num_dollars or 1 do"
position = "at"
payload = '''
local dollars_to_loop
if num_dollars < 0 then dollars_to_loop = (num_dollars*-1)+1 else dollars_to_loop = num_dollars end
for i = 1, dollars_to_loop do'''
match_indent = true
[[patches]]
[patches.regex]
target = "functions/common_events.lua"
pattern = '''(?<indent>[\t ]*)else\n[\t ]*local dollars_to_loop'''
position = "before"
line_prepend = "$indent"
payload = '''
--asdf
end'''
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "local r = {n=G.UIT.T, config={text = localize('$'), colour = G.C.MONEY, scale = ((num_dollars > 20 and 0.28) or (num_dollars > 9 and 0.43) or 0.58), shadow = true, hover = true, can_collide = false, juice = true}}"
position = "at"
payload = '''
local r
if i == 1 and num_dollars < 0 then
r = {n=G.UIT.T, config={text = '-', colour = G.C.RED, scale = ((num_dollars < -20 and 0.28) or (num_dollars < -9 and 0.43) or 0.58), shadow = true, hover = true, can_collide = false, juice = true}}
play_sound('coin3', 0.9+0.2*math.random(), 0.7 - (num_dollars < -20 and 0.2 or 0))
else
if num_dollars < 0 then r = {n=G.UIT.T, config={text = localize('$'), colour = G.C.RED, scale = ((num_dollars > 20 and 0.28) or (num_dollars > 9 and 0.43) or 0.58), shadow = true, hover = true, can_collide = false, juice = true}}
else r = {n=G.UIT.T, config={text = localize('$'), colour = G.C.MONEY, scale = ((num_dollars > 20 and 0.28) or (num_dollars > 9 and 0.43) or 0.58), shadow = true, hover = true, can_collide = false, juice = true}} end
end'''
match_indent = true