[manifest]
version = "1.0.0"
dump_lua = true
priority = -1

# Level up modifier
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "amount = amount or 1"
position = "after"
payload = "if not next(find_joker('cry-Universum')) then"
match_indent = true


[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "G.GAME.hands[hand].mult = math.max(G.GAME.hands[hand].s_mult + G.GAME.hands[hand].l_mult*(G.GAME.hands[hand].level - 1), 1)"
position = "at"
payload = "G.GAME.hands[hand].mult = math.max(G.GAME.hands[hand].mult + G.GAME.hands[hand].l_mult*amount, 1)"
match_indent = true


[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = "G.GAME.hands[hand].chips = math.max(G.GAME.hands[hand].s_chips + G.GAME.hands[hand].l_chips*(G.GAME.hands[hand].level - 1), 0)"
position = "at"
payload = '''
G.GAME.hands[hand].chips = math.max(G.GAME.hands[hand].chips + G.GAME.hands[hand].l_chips*amount, 1)
else
    universum_mod = 1
    local effects = {}
    SMODS.calculate_context({cry_universum = true}, effects)
    for i = 1, #effects do
        universum_mod = universum_mod * (effects[i] and effects[i].jokers and effects[i].jokers.mod or 1)
    end
    G.GAME.hands[hand].level = math.max(0, G.GAME.hands[hand].level + amount)
    G.GAME.hands[hand].mult = math.max(G.GAME.hands[hand].mult * (universum_mod)^amount, 1)
    G.GAME.hands[hand].chips = math.max(G.GAME.hands[hand].chips * (universum_mod)^amount, 1)
end
'''
match_indent = true