content: [manifest]
  version = "0.1.0"
  dump_lua = true
  priority = 0
  
  # Add Hanafuda enhancements to poker hand screen
  [[patches]]
  [patches.pattern]
  target = "functions/UI_definitions.lua"
  pattern = '''local card = Card(0,0, 0.5*G.CARD_W, 0.5*G.CARD_H, G.P_CARDS[v[1]], G.P_CENTERS[v.enhancement or 'c_base'])'''
  position = "after"
  payload = '''
  if v.joy_hanafuda then
      G.E_MANAGER:add_event(Event({
          blockable = false,
          func = (function()
              card.children.center:set_sprite_pos(JoyousSpring.hanafuda_cards[v.joy_hanafuda].pos)
              return true
          end)
      }))
  end
  '''
  match_indent = true
  
  # Add Hanafuda sorting
  [[patches]]
  [patches.pattern]
  target = "functions/UI_definitions.lua"
  pattern = '''
  {n=G.UIT.T, config={text = localize('k_suit'), scale = text_scale*0.7, colour = G.C.UI.TEXT_LIGHT}}
  }}
  '''
  position = "after"
  payload = '''
  ,JoyousSpring.create_hanafuda_month_sort_UIBox(),
  JoyousSpring.create_hanafuda_type_sort_UIBox()
  '''
  match_indent = true
  
  # Add controller UI
  [[patches]]
  [patches.pattern]
  target = "functions/UI_definitions.lua"
  pattern = '''
  --The card UI can have BUY, REDEEM, USE, and SELL buttons depending on the context of the card
  '''
  position = "after"
  payload = '''
  if JoyousSpring.is_monster_card(card) then
      return JoyousSpring.card_focus_ui(card, base_background)
  end
  '''
  match_indent = true
  