name: Chemicritter
card_text: This card is treated as a Normal Monster while face-up on the field or in the Graveyard. While this card is a Normal Monster on the field, you can Normal Summon it to have it become an Effect Monster with this effect.
  ● During your Main Phase: You can send 1 Gemini monster from your Deck to the Graveyard, then add 1 Gemini monster from your Deck to your hand. You can only use this effect of "Chemicritter Carbo Crab" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.EnableDualAttribute(c)
  	--to grave/search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetCountLimit(1, id)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(aux.IsDualState)
  	e1:SetTarget(s.tgtg)
  	e1:SetOperation(s.tgop)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, tp)
  	return c:IsType(TYPE_DUAL) and c:IsAbleToGrave() and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, c)
  end
  function s.tgfilter(c)
  	return c:IsType(TYPE_DUAL) and c:IsAbleToGrave()
  end
  function s.thfilter(c)
  	return c:IsType(TYPE_DUAL) and c:IsAbleToHand()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 and Duel.SendtoGrave(g, REASON_EFFECT) ~= 0 and g:GetFirst():IsLocation(LOCATION_GRAVE) then
  		local sg = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil)
  		if sg:GetCount() > 0 then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  			local tg = sg:Select(tp, 1, 1, nil)
  			Duel.SendtoHand(tg, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tg)
  		end
  	end
  end
  
  
source_text: Chemicritter
  This card is treated as a Normal Monster while face-up on the field or in the Graveyard. While this card is a Normal Monster on the field, you can Normal Summon it to have it become an Effect Monster with this effect.
  ● During your Main Phase: You can send 1 Gemini monster from your Deck to the Graveyard, then add 1 Gemini monster from your Deck to your hand. You can only use this effect of "Chemicritter Carbo Crab" once per turn.
target_text: -- Chemicritter
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.EnableDualAttribute(c)
  	--to grave/search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetCountLimit(1, id)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(aux.IsDualState)
  	e1:SetTarget(s.tgtg)
  	e1:SetOperation(s.tgop)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, tp)
  	return c:IsType(TYPE_DUAL) and c:IsAbleToGrave() and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, c)
  end
  function s.tgfilter(c)
  	return c:IsType(TYPE_DUAL) and c:IsAbleToGrave()
  end
  function s.thfilter(c)
  	return c:IsType(TYPE_DUAL) and c:IsAbleToHand()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 and Duel.SendtoGrave(g, REASON_EFFECT) ~= 0 and g:GetFirst():IsLocation(LOCATION_GRAVE) then
  		local sg = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil)
  		if sg:GetCount() > 0 then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  			local tg = sg:Select(tp, 1, 1, nil)
  			Duel.SendtoHand(tg, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tg)
  		end
  	end
  end
  
  