balatro-mods/Steamodded/lovely/enhancement.toml
2025-01-19 15:01:49 +08:00

277 lines
8.5 KiB
TOML

[manifest]
version = "1.0.0"
dump_lua = true
priority = 0
## no_rank, no_suit, all_suits
# Card:get_id()
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "if self.ability.effect == 'Stone Card' and not self.vampired then"
match_indent = true
position = "at"
payload = "if (self.ability.effect == 'Stone Card' or self.config.center.no_rank) and not self.vampired then"
# Card:get_chip_bonus()
[[patches]]
[patches.regex]
target = "card.lua"
pattern = '''
(?<indent>[\t ]*)if self\.ability\.effect == 'Stone Card' then
[\t ]* return self\.ability\.bonus \+ \(self\.ability\.perma_bonus or 0\)
[\t ]*end'''
position = "at"
payload = '''
if self.ability.effect == 'Stone Card' or self.config.center.replace_base_card then
return self.ability.bonus + (self.ability.perma_bonus or 0)
end'''
line_prepend = '$indent'
# Card:calculate_joker()
# Raised Fist
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "if temp_ID >= G.hand.cards[i].base.id and G.hand.cards[i].ability.effect ~= 'Stone Card' then temp_Mult = G.hand.cards[i].base.nominal; temp_ID = G.hand.cards[i].base.id; raised_card = G.hand.cards[i] end"
match_indent = true
position = "at"
payload = """
if temp_ID >= G.hand.cards[i].base.id and (G.hand.cards[i].ability.effect ~= 'Stone Card' and not G.hand.cards[i].config.center.no_rank) then
temp_Mult = G.hand.cards[i].base.nominal
temp_ID = G.hand.cards[i].base.id
raised_card = G.hand.cards[i]
end"""
# Flower Pot, Seeing Double
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "if context.scoring_hand[i].ability.name ~= 'Wild Card' then"
match_indent = true
position = "at"
payload = "if context.scoring_hand[i].ability.name ~= 'Wild Card' and not context.scoring_hand[i].config.center.any_suit then"
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "if context.scoring_hand[i].ability.name == 'Wild Card' then"
match_indent = true
position = "at"
payload = "if context.scoring_hand[i].ability.name == 'Wild Card' or context.scoring_hand[i].config.center.any_suit then"
# Card:get_suit()
[[patches]]
[patches.regex]
target = "card.lua"
pattern = '''(?<indent>[\t ]*)if self\.ability\.effect == 'Stone Card' then'''
line_prepend = '$indent'
position = "at"
payload = "if self.ability.effect == 'Stone Card' or self.config.center.no_suit then"
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = 'if self.ability.name == "Wild Card" then'
match_indent = true
position = "at"
payload = "if self.ability.name == 'Wild Card' or self.config.center.any_suit then"
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = 'if self.ability.name == "Wild Card" and not self.debuff then'
match_indent = true
position = "at"
payload = "if (self.ability.name == 'Wild Card' or self.config.center.any_suit) and not self.debuff then"
# check_for_unlock
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "if v.ability.name ~= 'Stone Card' and v.base.suit == 'Hearts' then"
match_indent = true
position = "at"
payload = "if (v.ability.name ~= 'Stone Card' and not v.config.center.no_suit) and v.base.suit == 'Hearts' then"
# reset_idol_card()
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "valid_idol_cards[#valid_idol_cards+1] = v"
match_indent = true
position = "at"
payload = """
if (not v.config.center.no_suit) and (not v.config.center.no_rank) then
valid_idol_cards[#valid_idol_cards+1] = v
end"""
# reset_mail_rank()
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "valid_mail_cards[#valid_mail_cards+1] = v"
match_indent = true
position = "at"
payload = """
if not v.config.center.no_rank then
valid_mail_cards[#valid_mail_cards+1] = v
end"""
# reset_castle_card()
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "valid_castle_cards[#valid_castle_cards+1] = v"
match_indent = true
position = "at"
payload = """
if not v.config.center.no_suit then
valid_castle_cards[#valid_castle_cards+1] = v
end"""
# G.FUNCS.evaluate_play()
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "if G.play.cards[i].ability.effect == 'Stone Card' then"
match_indent = true
position = "at"
payload = "if G.play.cards[i].ability.effect == 'Stone Card' or G.play.cards[i].config.center.always_scores then"
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "if scoring_hand[i].ability.effect ~= 'Stone Card' then"
match_indent = true
position = "at"
payload = "if scoring_hand[i].ability.effect ~= 'Stone Card' and not scoring_hand[i].config.center.no_rank then"
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "G.GAME.cards_played[scoring_hand[i].base.value].suits[scoring_hand[i].base.suit] = true"
match_indent = true
position = "at"
payload = """
if not scoring_hand[i].config.center.no_suit then
G.GAME.cards_played[scoring_hand[i].base.value].suits[scoring_hand[i].base.suit] = true
end"""
## replace_base_card
# Determines whether to draw the base card's front or not
# Card:draw()
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "if self.children.front and self.ability.effect ~= 'Stone Card' then"
match_indent = true
position = "at"
payload = "if self.children.front and self.ability.effect ~= 'Stone Card' and not self.config.center.replace_base_card then"
# Card:generate_UIBox_ability_table()
# replaces two consecutive lines
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "if (_c.name == 'Stone Card') then full_UI_table.name = true end"
match_indent = true
position = "at"
payload = "if _c.name == 'Stone Card' or _c.replace_base_card then full_UI_table.name = true"
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "if (specific_vars.playing_card and (_c.name ~= 'Stone Card')) then"
match_indent = true
position = "at"
payload = "elseif specific_vars.playing_card then"
# eval_card()
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "function eval_card(card, context)"
match_indent = true
position = "after"
payload = """
local enhancement_calculated = false
local center = card.config.center"""
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "local jokers = card:calculate_joker(context)"
match_indent = true
position = "before"
payload = """
if card.ability.set == 'Enhanced' and center.calculate and type(center.calculate) == 'function' then
center:calculate(card, context, ret)
enhancement_calculated = true
end"""
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "local seals = card:calculate_seal(context)"
match_indent = true
position = "before"
payload = """
if card.ability.set == 'Enhanced' and center.calculate and type(center.calculate) == 'function' then
center:calculate(card, context, ret)
enhancement_calculated = true
end"""
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "if context.cardarea == G.jokers or context.card == G.consumeables then"
match_indent = true
position = "before"
payload = """
if not enhancement_calculated and card.ability.set == 'Enhanced' and center.calculate and type(center.calculate) == 'function' then
center:calculate(card, context, ret)
enhancement_calculated = true
end
local seals = card:calculate_seal(context)
if seals then
ret.seals = seals
end"""
## Add additional eval_card() calls
# Game:update_draw_to_hand()
[[patches]]
[patches.pattern]
target = "game.lua"
pattern = "G.GAME.current_round.discards_used == 0 and G.GAME.facing_blind then"
match_indent = true
position = "after"
payload = """
for i = 1, #G.hand.cards do
eval_card(G.hand.cards[i], {first_hand_drawn = true})
end"""
# G.FUNCS.discard_cards_from_highlighted()
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "inc_career_stat('c_cards_discarded', highlighted_count)"
match_indent = true
position = "after"
payload = """
for i = 1, #G.hand.cards do
eval_card(G.hand.cards[i], {pre_discard = true, full_hand = G.hand.highlighted, hook = hook})
end"""
[[patches]]
[patches.regex]
target = "functions/state_events.lua"
pattern = '''
(?<indent>[\t ]*)G\.hand\.highlighted\[i\]:calculate_seal\(\{discard = true\}\)
[\t ]*local removed = false'''
line_prepend = '$indent'
position = "at"
payload = """
local removed = false
local eval = nil
eval = eval_card(G.hand.highlighted[i], {discard = true, full_hand = G.hand.highlighted})
if eval and eval.remove then
removed = true
card_eval_status_text(G.hand.highlighted[i], 'jokers', nil, 1, nil, eval)
end"""