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

# Add card_added context
[[patches]]
[patches.regex]
target = "card.lua"
pattern = '''
(?<indent>[\t ]*).*then G\.E_MANAGER:add_event\(Event\(\{ func = function\(\) G\.GAME\.blind:set_blind\(nil, true, nil\); return true end \}\)\) end
(?<root>)[\s\S]*
function Card:remove_from_deck'''
position = "after"
line_prepend = "$indent"
payload = '''
if not from_debuff and G.hand then
    local is_playing_card = self.ability.set == 'Default' or self.ability.set == 'Enhanced'
    
    -- TARGET: calculate card_added

    if not is_playing_card then
        SMODS.calculate_context({card_added = true, card = self})
        SMODS.enh_cache:clear()
    end
end
'''
root_capture = '$root'
times = 1 
