name: Raidraptor
card_text: During your Main Phase, if this card was Normal or Special Summoned this turn: You can Tribute this card; Special Summon 2 "Raidraptor" monsters from your hand and/or Graveyard whose total Levels equal 6.
external_ids: local SETCARD_ID_0 = 0xba --Raidraptor
  
lua: local SETCARD_ID_0 = 0xba --Raidraptor
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.spcon)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	if not s.global_check then
  		s.global_check = true
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_SUMMON_SUCCESS)
  		ge1:SetLabel(id)
  		ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		ge1:SetOperation(aux.sumreg)
  		Duel.RegisterEffect(ge1, 0)
  		local ge2 = ge1:Clone()
  		ge2:SetCode(EVENT_SPSUMMON_SUCCESS)
  		ge2:SetLabel(id)
  		Duel.RegisterEffect(ge2, 0)
  	end
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) > 0
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.spfilter1(c, e, tp)
  	local lv = c:GetLevel()
  	return c:IsLevelBelow(5)
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and Duel.IsExistingMatchingCard(s.spfilter2, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, c, e, tp, 6 - lv)
  end
  function s.spfilter2(c, e, tp, lv)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsLevel(lv) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter1, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_GRAVE)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter1), tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	local tc1 = g1:GetFirst()
  	if not tc1 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g2 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter2), tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, tc1, e, tp, 6 - tc1:GetLevel())
  	g1:Merge(g2)
  	Duel.SpecialSummon(g1, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  
source_text: Raidraptor
  During your Main Phase, if this card was Normal or Special Summoned this turn: You can Tribute this card; Special Summon 2 "Raidraptor" monsters from your hand and/or Graveyard whose total Levels equal 6.
target_text: -- Raidraptor
  local SETCARD_ID_0 = 0xba --Raidraptor
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.spcon)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	if not s.global_check then
  		s.global_check = true
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_SUMMON_SUCCESS)
  		ge1:SetLabel(id)
  		ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		ge1:SetOperation(aux.sumreg)
  		Duel.RegisterEffect(ge1, 0)
  		local ge2 = ge1:Clone()
  		ge2:SetCode(EVENT_SPSUMMON_SUCCESS)
  		ge2:SetLabel(id)
  		Duel.RegisterEffect(ge2, 0)
  	end
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) > 0
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.spfilter1(c, e, tp)
  	local lv = c:GetLevel()
  	return c:IsLevelBelow(5)
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and Duel.IsExistingMatchingCard(s.spfilter2, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, c, e, tp, 6 - lv)
  end
  function s.spfilter2(c, e, tp, lv)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsLevel(lv) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter1, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_GRAVE)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter1), tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	local tc1 = g1:GetFirst()
  	if not tc1 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g2 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter2), tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, tc1, e, tp, 6 - tc1:GetLevel())
  	g1:Merge(g2)
  	Duel.SpecialSummon(g1, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  