name: Ragnaraika
card_text: You can Special Summon this card (from your hand) by sending 1 Insect, Plant, or Reptile monster from your hand to the GY. You can only Special Summon "Ragnaraika the Evil Seed" once per turn this way. If this card is Normal or Special Summoned: You can add to your hand up to 2 different "Ragnaraika" cards of yours that are banished and/or in your Deck, except "Ragnaraika the Evil Seed", then banish 1 card from your hand, also you cannot Special Summon for the rest of this turn, except Insect, Plant, or Reptile monsters. You can only use this effect of "Ragnaraika the Evil Seed" once per turn.
external_ids: local SETCARD_ID_0 = 0x1ab --Ragnaraika
  
lua: local SETCARD_ID_0 = 0x1ab --Ragnaraika
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetCountLimit(1, id + o)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsRace(RACE_INSECT + RACE_PLANT + RACE_REPTILE) and c:IsAbleToGraveAsCost()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, c)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, 1, c)
  	Duel.SendtoGrave(g, REASON_COST)
  end
  function s.thfilter(c)
  	return not c:IsCode(id) and c:IsFaceupEx() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK + LOCATION_REMOVED, 0, nil)
  	if chk == 0 then
  		return Duel.IsPlayerCanRemove(tp) and g:GetCount() >= 1
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_REMOVED)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK + LOCATION_REMOVED, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local tg1 = g:SelectSubGroup(tp, aux.dncheck, false, 1, 2)
  	if tg1 and Duel.SendtoHand(tg1, nil, REASON_EFFECT) ~= 0 then
  		Duel.ConfirmCards(1 - tp, tg1)
  		Duel.ShuffleHand(tp)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local tg2 = Duel.SelectMatchingCard(tp, Card.IsAbleToRemove, tp, LOCATION_HAND, 0, 1, 1, nil)
  		if #tg2 > 0 then
  			Duel.BreakEffect()
  			Duel.Remove(tg2, POS_FACEUP, REASON_EFFECT)
  		end
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsRace(RACE_INSECT + RACE_PLANT + RACE_REPTILE)
  end
  
  
source_text: Ragnaraika
  You can Special Summon this card (from your hand) by sending 1 Insect, Plant, or Reptile monster from your hand to the GY. You can only Special Summon "Ragnaraika the Evil Seed" once per turn this way. If this card is Normal or Special Summoned: You can add to your hand up to 2 different "Ragnaraika" cards of yours that are banished and/or in your Deck, except "Ragnaraika the Evil Seed", then banish 1 card from your hand, also you cannot Special Summon for the rest of this turn, except Insect, Plant, or Reptile monsters. You can only use this effect of "Ragnaraika the Evil Seed" once per turn.
target_text: -- Ragnaraika
  local SETCARD_ID_0 = 0x1ab --Ragnaraika
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetCountLimit(1, id + o)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsRace(RACE_INSECT + RACE_PLANT + RACE_REPTILE) and c:IsAbleToGraveAsCost()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, c)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, 1, c)
  	Duel.SendtoGrave(g, REASON_COST)
  end
  function s.thfilter(c)
  	return not c:IsCode(id) and c:IsFaceupEx() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK + LOCATION_REMOVED, 0, nil)
  	if chk == 0 then
  		return Duel.IsPlayerCanRemove(tp) and g:GetCount() >= 1
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_REMOVED)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK + LOCATION_REMOVED, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local tg1 = g:SelectSubGroup(tp, aux.dncheck, false, 1, 2)
  	if tg1 and Duel.SendtoHand(tg1, nil, REASON_EFFECT) ~= 0 then
  		Duel.ConfirmCards(1 - tp, tg1)
  		Duel.ShuffleHand(tp)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local tg2 = Duel.SelectMatchingCard(tp, Card.IsAbleToRemove, tp, LOCATION_HAND, 0, 1, 1, nil)
  		if #tg2 > 0 then
  			Duel.BreakEffect()
  			Duel.Remove(tg2, POS_FACEUP, REASON_EFFECT)
  		end
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsRace(RACE_INSECT + RACE_PLANT + RACE_REPTILE)
  end
  
  