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

265 lines
8.6 KiB
TOML

[manifest]
version = "1.0.0"
dump_lua = true
priority = -10
## Booster Pack API
# Card:open
[[patches]]
[patches.regex]
target = "card.lua"
pattern = '''(?<indent>[\t ]*)if self\.ability\.name:find\('Arcana'\) then \n[\s\S]{12}G\.STATE'''
position = "before"
payload = '''
booster_obj = self.config.center
if booster_obj and SMODS.Centers[booster_obj.key] then
G.STATE = G.STATES.SMODS_BOOSTER_OPENED
SMODS.OPENED_BOOSTER = self
end'''
line_prepend = '$indent'
# Card:open
[[patches]]
[patches.regex]
target = "card.lua"
pattern = '''(?<indent>[\t ]*)if self\.ability\.name:find\('Arcana'\) then[\t\n ]*if G\.GAME\.used_vouchers\.v_omen_globe and pseudorandom\('omen_globe'\) > 0\.8 then''' # Possibly try to target something else
position = "at"
payload = '''if booster_obj.create_card and type(booster_obj.create_card) == "function" then
local _card_to_spawn = booster_obj:create_card(self, i)
if type((_card_to_spawn or {}).is) == 'function' and _card_to_spawn:is(Card) then
card = _card_to_spawn
else
card = SMODS.create_card(_card_to_spawn)
end
elseif self.ability.name:find('Arcana') then
if G.GAME.used_vouchers.v_omen_globe and pseudorandom('omen_globe') > 0.8 then'''
line_prepend = '$indent'
# Game:set_globals
[[patches]]
[patches.regex]
target = "globals.lua"
pattern = '''(?<indent>[\t ]*)self\.STATES = \{'''
position = "after"
payload = '''
SMODS_BOOSTER_OPENED = 999,'''
line_prepend = '$indent'
# Game:update
[[patches]]
[patches.regex]
target = "game.lua"
pattern = '''(?<indent>[\t ]*)if self\.STATE == self\.STATES\.TAROT_PACK then'''
position = "before"
payload = '''
if G.STATE == G.STATES.SMODS_BOOSTER_OPENED then
SMODS.OPENED_BOOSTER.config.center:update_pack(dt)
end
'''
line_prepend = '$indent'
# G.FUNC.can_skip_booster
# TODO customize whether pack can be skipped
[[patches]]
[patches.regex]
target = "functions/button_callbacks.lua"
pattern = '''(?<indent>[\t ]*)\(G\.STATE == G\.STATES\.PLANET_PACK or G\.STATE == G\.STATES\.STANDARD_PACK'''
position = "at"
payload = '''(G.STATE == G.STATES.SMODS_BOOSTER_OPENED or G.STATE == G.STATES.PLANET_PACK or G.STATE == G.STATES.STANDARD_PACK'''
# CardArea:draw()
[[patches]]
[patches.pattern]
target = "cardarea.lua"
pattern = "(self.config.type == 'deck' and self ~= G.deck) or"
position = "before"
payload = '''
(self.config.type == 'hand' and state == G.STATES.SMODS_BOOSTER_OPENED) or'''
match_indent = true
# G.FUNCS.use_card
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = "prev_state == G.STATES.SPECTRAL_PACK or prev_state == G.STATES.STANDARD_PACK or"
position = "after"
payload = '''
prev_state == G.STATES.SMODS_BOOSTER_OPENED or'''
match_indent = true
# CardArea:align_cards()
[[patches]]
[patches.pattern]
target = "cardarea.lua"
pattern = "if self.config.type == 'hand' and (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.PLANET_PACK) then"
position = "at"
payload = "if self.config.type == 'hand' and (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.PLANET_PACK or G.STATE == G.STATES.SMODS_BOOSTER_OPENED) then"
match_indent = true
# CardArea:align_cards()
[[patches]]
[patches.pattern]
target = "cardarea.lua"
pattern = "if self.config.type == 'hand' and not (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.PLANET_PACK) then"
position = "at"
payload = "if self.config.type == 'hand' and not (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.PLANET_PACK or G.STATE == G.STATES.SMODS_BOOSTER_OPENED) then"
match_indent = true
# Card:can_use_consumable()
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "if G.STATE == G.STATES.SELECTING_HAND or G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.PLANET_PACK then"
position = "at"
payload = "if G.STATE == G.STATES.SELECTING_HAND or G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.PLANET_PACK or G.STATE == G.STATES.SMODS_BOOSTER_OPENED then"
match_indent = true
# G.FUNCS.use_card()
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = "if G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.PLANET_PACK or G.STATE == G.STATES.SPECTRAL_PACK then"
position = "at"
payload = """
if nc then
if area then area:remove_from_highlighted(card) end
play_sound('cardSlide2', nil, 0.3)
dont_dissolve = true
end
if (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.PLANET_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.SMODS_BOOSTER_OPENED) then"""
match_indent = true
# G.FUNC.use_card()
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = 'if area == G.consumeables then'
position = 'before'
match_indent = true
payload = '''
if nc and area == G.pack_cards then G.pack_cards:remove_card(card); G.consumeables:emplace(card) end'''
# G.FUNC.use_card()
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = "(G.STATE == G.STATES.BUFFOON_PACK and G.STATES.BUFFOON_PACK) or"
position = "before"
payload = "(G.STATE == G.STATES.SMODS_BOOSTER_OPENED and G.STATES.SMODS_BOOSTER_OPENED) or"
match_indent = true
# G.FUNC.use_card()
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "if not (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK) and"
position = "at"
payload = "if not (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.SMODS_BOOSTER_OPENED) and"
match_indent = true
# Card:use_consumeable()
[[patches]]
[patches.regex]
target = "card.lua"
pattern = '''(?<indent>[\t ]*)align = \(G\.STATE[\s\S]*and -0\.2 or 0},'''
position = "at"
payload = '''
align = (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.SMODS_BOOSTER_OPENED) and 'tm' or 'cm',
offset = {x = 0, y = (G.STATE == G.STATES.TAROT_PACK or G.STATE == G.STATES.SPECTRAL_PACK or G.STATE == G.STATES.SMODS_BOOSTER_OPENED) and -0.2 or 0},'''
line_prepend = '$indent'
# G.FUNCS.use_card()
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = "e.config.ref_table:redeem()"
position = "before"
payload = "if area == G.pack_cards then e.config.ref_table.cost = 0 end"
match_indent = true
## Stopping ease_dollars anim from playing when voucher is free
# Card:redeem()
[[patches]]
[patches.regex]
target = "card.lua"
pattern = '''(?<indent>[\t ]*)ease_dollars\(-self\.cost\)\n[\s\S]{8}inc_career_stat\('c_shop_dollars_spent', self\.cost\)'''
position = "at"
payload = '''
if self.cost ~= 0 then
ease_dollars(-self.cost)
inc_career_stat('c_shop_dollars_spent', self.cost)
end'''
line_prepend = '$indent'
# Add support for saving consumables
# comment
[[patches]]
[patches.pattern]
target = 'functions/UI_definitions.lua'
match_indent = true
position = 'before'
pattern = '''
if card.ability.consumeable then
if (card.area == G.pack_cards and G.pack_cards) then
'''
payload = '''
if card.ability.consumeable and booster_obj and booster_obj.select_card then
if (card.area == G.pack_cards and G.pack_cards) then
return {n=G.UIT.ROOT, config = {padding = 0, colour = G.C.CLEAR}, nodes={
{n=G.UIT.R, config={ref_table = card, r = 0.08, padding = 0.1, align = "bm", minw = 0.5*card.T.w - 0.15, maxw = 0.9*card.T.w - 0.15, minh = 0.3*card.T.h, hover = true, shadow = true, colour = G.C.UI.BACKGROUND_INACTIVE, one_press = true, button = 'use_card', func = 'can_select_from_booster'}, nodes={
{n=G.UIT.T, config={text = localize('b_select'),colour = G.C.UI.TEXT_LIGHT, scale = 0.45, shadow = true}}
}},
}}
end
end
'''
# comment
[[patches]]
[patches.pattern]
target = 'functions/button_callbacks.lua'
match_indent = true
position = 'at'
pattern = '''
if card.ability.consumeable then
if nc then
'''
payload = '''
if booster_obj and booster_obj.select_card then
local area = type(booster_obj.select_card) == 'table' and (booster_obj.select_card[e.config.ref_table.ability.set] or nil) or booster_obj.select_card
G[area]:emplace(card)
play_sound('card1', 0.8, 0.6)
play_sound('generic1')
dont_dissolve = true
delay_fac = 0.2
elseif card.ability.consumeable then
if nc then
'''
# comment
[[patches]]
[patches.pattern]
target = 'functions/button_callbacks.lua'
match_indent = true
position = 'before'
pattern = '''
if area == G.consumeables then
'''
payload = '''
booster_obj = nil
'''
# comment
[[patches]]
[patches.pattern]
target = 'functions/button_callbacks.lua'
match_indent = true
position = 'after'
pattern = '''
G.FUNCS.skip_booster = function(e)
'''
payload = '''
booster_obj = nil
'''