balatro-mods/smods-old-calc/lovely/seal.toml

235 lines
7.2 KiB
TOML

[manifest]
version = "1.0.0"
dump_lua = true
priority = -10
### Seal API
# Card:open()
[[patches]]
[patches.regex]
target = 'card.lua'
pattern = '''
(?<indent>[\t ]*)local seal_rate = 10
[\n\t ]*local seal_poll = pseudorandom\(pseudoseed\('stdseal'..G.GAME.round_resets.ante\)\)
[\n\t ]*if seal_poll > 1 - 0.02\*seal_rate then
[\n\t ]*local seal_type = pseudorandom\(pseudoseed\('stdsealtype'..G.GAME.round_resets.ante\)\)
[\n\t ]*if seal_type > 0.75 then card:set_seal\('Red'\)
[\n\t ]*elseif seal_type > 0.5 then card:set_seal\('Blue'\)
[\n\t ]*elseif seal_type > 0.25 then card:set_seal\('Gold'\)
[\n\t ]*else card:set_seal\('Purple'\)
[\n\t ]*end
[\n\t ]*end'''
position = 'at'
line_prepend = '$indent'
payload = '''
card:set_seal(SMODS.poll_seal({mod = 10}))'''
# Card:calculate_joker()
[[patches]]
[patches.regex]
target = 'card.lua'
pattern = '''
(?<indent>[\t ]*)local seal_type = pseudorandom\(pseudoseed\('certsl'\)\)
[\n\t ]*if seal_type > 0.75 then _card:set_seal\('Red', true\)
[\n\t ]*elseif seal_type > 0.5 then _card:set_seal\('Blue', true\)
[\n\t ]*elseif seal_type > 0.25 then _card:set_seal\('Gold', true\)
[\n\t ]*else _card:set_seal\('Purple', true\)
[\n\t ]*end'''
position = 'at'
line_prepend = '$indent'
payload = '''_card:set_seal(SMODS.poll_seal({guaranteed = true, type_key = 'certsl'}))'''
# get_badge_colour()
[[patches]]
[patches.pattern]
target = 'functions/UI_definitions.lua'
pattern = 'return G.BADGE_COL[key] or {1, 0, 0, 1}'
position = 'before'
match_indent = true
payload = '''
for k, v in pairs(SMODS.Seals) do
G.BADGE_COL[k:lower()..'_seal'] = v.badge_colour
end'''
# Card:calculate_seal()
[[patches]]
[patches.regex]
target = "card.lua"
pattern = 'function Card:calculate_seal\(context\)\n(?<indent>[\t ]*)if self.debuff then return nil end'
position = 'after'
line_prepend = '$indent'
payload = '''
local obj = G.P_SEALS[self.seal] or {}
if obj.calculate and type(obj.calculate) == 'function' then
local o = obj:calculate(self, context)
if o then return o end
end'''
# Card:update()
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = 'if G.STAGE == G.STAGES.RUN then'
position = 'before'
match_indent = true
payload = '''
local obj = G.P_SEALS[self.seal] or {}
if obj.update and type(obj.update) == 'function' then
obj:update(self, dt)
end'''
# G.FUNCS.evaluate_play()
# Allow seals to return mult, chips and xmult like jokers.
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "--If x_mult added, do mult add event and mult the mult to the total"
match_indent = true
position = "before"
payload = '''
if effects[ii].seals then
if effects[ii].seals.chips then
if effects[ii].card then juice_card(effects[ii].card) end
hand_chips = mod_chips(hand_chips + effects[ii].seals.chips)
update_hand_text({delay = 0}, {chips = hand_chips})
card_eval_status_text(scoring_hand[i], 'chips', effects[ii].seals.chips, percent)
end
if effects[ii].seals.mult then
if effects[ii].card then juice_card(effects[ii].card) end
mult = mod_mult(mult + effects[ii].seals.mult)
update_hand_text({delay = 0}, {mult = mult})
card_eval_status_text(scoring_hand[i], 'mult', effects[ii].seals.mult, percent)
end
if effects[ii].seals.p_dollars then
if effects[ii].card then juice_card(effects[ii].card) end
ease_dollars(effects[ii].seals.p_dollars)
card_eval_status_text(scoring_hand[i], 'dollars', effects[ii].seals.p_dollars, percent)
end
if effects[ii].seals.dollars then
if effects[ii].card then juice_card(effects[ii].card) end
ease_dollars(effects[ii].seals.dollars)
card_eval_status_text(scoring_hand[i], 'dollars', effects[ii].seals.dollars, percent)
end
if effects[ii].seals.x_mult then
if effects[ii].card then juice_card(effects[ii].card) end
mult = mod_mult(mult*effects[ii].seals.x_mult)
update_hand_text({delay = 0}, {mult = mult})
card_eval_status_text(scoring_hand[i], 'x_mult', effects[ii].seals.x_mult, percent)
end
if effects[ii].seals.func then
effects[ii].seals.func()
end
end
'''
# Card:get_p_dollars()
[[patches]]
[patches.regex]
target = "card.lua"
pattern = '''(?<indent>[\t ]*)if (?<cond>self\.seal == 'Gold' then\n)'''
position = 'at'
line_prepend = '$indent'
payload = '''
local obj = G.P_SEALS[self.seal] or {}
if obj.get_p_dollars and type(obj.get_p_dollars) == 'function' then
ret = ret + obj:get_p_dollars(self)
elseif $cond'''
# generate_card_ui()
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = "if v == 'gold_seal'*"
match_indent = true
position = 'before'
payload = '''
local seal = SMODS.Seals[v] or SMODS.Seal.badge_to_key[v] and SMODS.Seals[SMODS.Seal.badge_to_key[v]]
if seal and seal.generate_ui ~= 0 then
local t = { key = v, set = 'Other' }
info_queue[#info_queue+1] = t
if seal.loc_vars and type(seal.loc_vars) == 'function' then
local res = seal:loc_vars(info_queue, card) or {}
t.vars = res.vars
t.key = res.key or t.key
t.set = res.set or t.set
end
else'''
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = "if v == 'purple_seal'*"
match_indent = true
position = 'after'
payload = 'end'
# Card:update_alert()
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = "function Card:update_alert()"
match_indent = true
position = 'after'
payload = '''
if self.ability.set == 'Default' and self.config.center and self.config.center.key == 'c_base' and self.seal then
if G.P_SEALS[self.seal].alerted and self.children.alert then
self.children.alert:remove()
self.children.alert = nil
elseif not G.P_SEALS[self.seal].alerted and not self.children.alert and G.P_SEALS[self.seal].discovered then
self.children.alert = UIBox{
definition = create_UIBox_card_alert(),
config = {align="tli",
offset = {x = 0.1, y = 0.1},
parent = self}
}
end
end'''
# Card:hover()
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = "G:save_progress()"
match_indent = false
position = "after"
payload = '''
elseif self.children.alert and self.seal and not G.P_SEALS[self.seal].alerted then
G.P_SEALS[self.seal].alerted = true
G:save_progress()'''
# Game:init_item_prototypes()
[[patches]]
[patches.regex]
target = 'game.lua'
pattern = '''(?<indent>[\t ]*)Gold =[ {A-z=1-4,"}\n]*},[\n\t ]*}'''
position = 'at'
line_prepend = '$indent'
payload = '''
Red = {order = 1, discovered = false, set = "Seal"},
Blue = {order = 2, discovered = false, set = "Seal"},
Gold = {order = 3, discovered = false, set = "Seal"},
Purple = {order = 4, discovered = false, set = "Seal"},
}
'''
# Card:set_seal()
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = '''G.CONTROLLER.locks.seal = true'''
position = 'after'
match_indent = true
payload = '''local sound = G.P_SEALS[_seal].sound or {sound = 'gold_seal', per = 1.2, vol = 0.4}'''
[[patches]]
[patches.pattern]
target = 'card.lua'
pattern = '''play_sound('gold_seal', 1.2, 0.4)'''
position = 'at'
match_indent = true
payload = '''play_sound(sound.sound, sound.per, sound.vol)'''