name: Convert
card_text: If you control no monsters: Send 2 "Neo-Spacian" monsters (1 from your hand and 1 from your Deck) to the GY, then draw 2 cards.
external_ids: local SETCARD_ID_0 = 0x1f --Neo-Spacian
  
lua: local SETCARD_ID_0 = 0x1f --Neo-Spacian
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + 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)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) == 0
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGrave()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 2)
  			and Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) >= 3
  			and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil)
  			and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g1 = Duel.GetMatchingGroup(s.filter, tp, LOCATION_HAND, 0, nil)
  	local g2 = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil)
  	if g1:GetCount() > 0 and g2:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg1 = g1:Select(tp, 1, 1, nil)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg2 = g2:Select(tp, 1, 1, nil)
  		sg1:Merge(sg2)
  		if Duel.SendtoGrave(sg1, REASON_EFFECT) > 0 and sg1:IsExists(Card.IsLocation, 1, nil, LOCATION_GRAVE) then
  			Duel.ShuffleDeck(tp)
  			Duel.BreakEffect()
  			Duel.Draw(tp, 2, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Convert
  If you control no monsters: Send 2 "Neo-Spacian" monsters (1 from your hand and 1 from your Deck) to the GY, then draw 2 cards.
target_text: -- Convert
  local SETCARD_ID_0 = 0x1f --Neo-Spacian
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + 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)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) == 0
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGrave()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 2)
  			and Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) >= 3
  			and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil)
  			and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g1 = Duel.GetMatchingGroup(s.filter, tp, LOCATION_HAND, 0, nil)
  	local g2 = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil)
  	if g1:GetCount() > 0 and g2:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg1 = g1:Select(tp, 1, 1, nil)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg2 = g2:Select(tp, 1, 1, nil)
  		sg1:Merge(sg2)
  		if Duel.SendtoGrave(sg1, REASON_EFFECT) > 0 and sg1:IsExists(Card.IsLocation, 1, nil, LOCATION_GRAVE) then
  			Duel.ShuffleDeck(tp)
  			Duel.BreakEffect()
  			Duel.Draw(tp, 2, REASON_EFFECT)
  		end
  	end
  end
  
  