name: 墓穴の道連れ
card_text: 1:お互いは、それぞれ相手の手札を確認し、その中からカードを1枚選んで捨てる。
  その後、お互いはそれぞれデッキから1枚ドローする。
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_HANDES + CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsLocation(LOCATION_HAND) then
  		return Duel.GetFieldGroupCount(tp, 0, LOCATION_HAND) > 0 and Duel.GetFieldGroupCount(tp, LOCATION_HAND, 0) > 1
  	else
  		return Duel.GetFieldGroupCount(tp, 0, LOCATION_HAND) > 0 and Duel.GetFieldGroupCount(tp, LOCATION_HAND, 0) > 0
  	end
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1) and Duel.IsPlayerCanDraw(1 - tp, 1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, PLAYER_ALL, 1)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, 0, LOCATION_HAND) == 0 or Duel.GetFieldGroupCount(tp, LOCATION_HAND, 0) == 0 then
  		return
  	end
  	local g1 = Duel.GetFieldGroup(tp, 0, LOCATION_HAND)
  	local g2 = Duel.GetFieldGroup(tp, LOCATION_HAND, 0)
  	Duel.ConfirmCards(tp, g1)
  	Duel.ConfirmCards(1 - tp, g2)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
  	local sg1 = g1:Select(tp, 1, 1, nil)
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_DISCARD)
  	local sg2 = g2:Select(1 - tp, 1, 1, nil)
  	sg1:Merge(sg2)
  	Duel.SendtoGrave(sg1, REASON_EFFECT + REASON_DISCARD)
  	Duel.ShuffleHand(tp)
  	Duel.ShuffleHand(1 - tp)
  	Duel.BreakEffect()
  	Duel.Draw(tp, 1, REASON_EFFECT)
  	Duel.Draw(1 - tp, 1, REASON_EFFECT)
  end
  
  
source_text: 墓穴の道連れ
  1:お互いは、それぞれ相手の手札を確認し、その中からカードを1枚選んで捨てる。
  その後、お互いはそれぞれデッキから1枚ドローする。
target_text: -- 墓穴の道連れ
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_HANDES + CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsLocation(LOCATION_HAND) then
  		return Duel.GetFieldGroupCount(tp, 0, LOCATION_HAND) > 0 and Duel.GetFieldGroupCount(tp, LOCATION_HAND, 0) > 1
  	else
  		return Duel.GetFieldGroupCount(tp, 0, LOCATION_HAND) > 0 and Duel.GetFieldGroupCount(tp, LOCATION_HAND, 0) > 0
  	end
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1) and Duel.IsPlayerCanDraw(1 - tp, 1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, PLAYER_ALL, 1)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, 0, LOCATION_HAND) == 0 or Duel.GetFieldGroupCount(tp, LOCATION_HAND, 0) == 0 then
  		return
  	end
  	local g1 = Duel.GetFieldGroup(tp, 0, LOCATION_HAND)
  	local g2 = Duel.GetFieldGroup(tp, LOCATION_HAND, 0)
  	Duel.ConfirmCards(tp, g1)
  	Duel.ConfirmCards(1 - tp, g2)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
  	local sg1 = g1:Select(tp, 1, 1, nil)
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_DISCARD)
  	local sg2 = g2:Select(1 - tp, 1, 1, nil)
  	sg1:Merge(sg2)
  	Duel.SendtoGrave(sg1, REASON_EFFECT + REASON_DISCARD)
  	Duel.ShuffleHand(tp)
  	Duel.ShuffleHand(1 - tp)
  	Duel.BreakEffect()
  	Duel.Draw(tp, 1, REASON_EFFECT)
  	Duel.Draw(1 - tp, 1, REASON_EFFECT)
  end
  
  