[manifest]
version = "1.0.0"
dump_lua = true
priority = 114

[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "if v ~= chosen_joker then"
position = "at"
payload = "if v ~= chosen_joker and not next(SMODS.find_card('j_jane_saint')) then"
match_indent = true

[[patches]]
[patches.pattern]
target = "globals.lua"
pattern = "EDITION = {1,1,1,1},"
position = "before"
payload = '''jane_RGB = {0,0,0,1},
jane_RGB_HUE = 0,
almighty = {0,0,1,1},'''
match_indent = true

[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "if v.name == 'Black Hole' or v.name == 'The Soul' or v.hidden then"
position = "at"
payload = "if Jane.hidden(v) then"
match_indent = true

[[patches]]
[patches.pattern]
target = "functions/misc_functions.lua"
pattern = "G.GAME.current_round.current_hand.chips*G.GAME.current_round.current_hand.mult"
position = "at"
payload = '''Jane.get_chipmult_sum(G.GAME.current_round.current_hand.chips, G.GAME.current_round.current_hand.mult)'''
match_indent = true

[[patches]]
[patches.pattern]
target = "functions/misc_functions.lua"
pattern = "local AC = G.SETTINGS.ambient_control"
position = "before"
payload = '''if Jane and (type(G.ARGS.score_intensity.required_score) == "table" and G.ARGS.score_intensity.required_score:to_number() or G.ARGS.score_intensity.required_score) ~= 0 then
    local break_infinity = ((Talisman or {}).config_file or {}).break_infinity
    local big = (break_infinity == "" or break_infinity == nil) and function (x) return x end or to_big
    local base = Cryptid and 10 or G.ARGS.score_intensity.required_score
    local expo = Cryptid and G.ARGS.score_intensity.required_score or 10
    Jane.sinister = (G.ARGS.score_intensity.earned_score / (big(base) ^ big(expo))):to_number() > 1
end'''
match_indent = true

[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "for _, v in ipairs(SMODS.get_card_areas('playing_cards')) do"
position = "after"
payload = '''if v == G.hand and not (G.GAME.blind and G.GAME.blind.name == "The Card" and not G.GAME.blind.disabled) and next(SMODS.find_card("j_jane_survivor")) then
    for _, v in ipairs(G.hand.cards) do
        local area = {cards = {v}}
        SMODS.calculate_main_scoring({cardarea = area, full_hand = area.cards, scoring_hand = area.cards, scoring_name = text, poker_hands = poker_hands}, area.cards)
        SMODS.calculate_main_scoring({cardarea = area, full_hand = area.cards, scoring_hand = area.cards, scoring_name = text, poker_hands = poker_hands}, nil)
    end
else'''
match_indent = true

[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "SMODS.calculate_main_scoring({cardarea = v, full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands}, v == G.play and scoring_hand or nil)"
position = "after"
payload = "end"
match_indent = true

[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "-- context.final_scoring_step calculations"
position = "before"
payload = '''if not (G.GAME.blind and G.GAME.blind.name == "The Card" and not G.GAME.blind.disabled) and next(SMODS.find_card('j_jane_survivor')) then
    for _, area in ipairs(SMODS.get_card_areas('jokers')) do
        for _, _card in ipairs(area.cards) do
            local eval = eval_card(_card, {
                cardarea = G.jokers,
                full_hand = G.hand.cards,
                scoring_hand = G.hand.cards,
                scoring_name = text,
                poker_hands = poker_hands,
                edition = true,
                pre_joker = true
            })
        end
    end
end'''
match_indent = true

[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, final_scoring_step = true})"
position = "after"
payload = '''if not (G.GAME.blind and G.GAME.blind.name == "The Card" and not G.GAME.blind.disabled) and next(SMODS.find_card('j_jane_survivor')) then
    SMODS.calculate_context({full_hand = G.hand.cards, scoring_hand = G.hand.cards, scoring_name = text, poker_hands = poker_hands, final_scoring_step = true})
end'''
match_indent = true

[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = "-- context.remove_playing_cards calculations"
position = "before"
payload = '''if not (G.GAME.blind and G.GAME.blind.name == "The Card" and not G.GAME.blind.disabled) and next(SMODS.find_card('j_jane_survivor')) then
    SMODS.calculate_destroying_cards({ full_hand = G.hand.cards, scoring_hand = G.hand.cards, scoring_name = text, poker_hands = poker_hands, cardarea = G.hand }, cards_destroyed, G.hand)
end'''
match_indent = true

[[patches]]
[patches.regex]
target = "functions/state_events.lua"
pattern = '''hand_chips\*mult\)'''
position = "at"
payload = "Jane.get_chipmult_sum(hand_chips, mult))"
match_indent = true
