name: Necroid
card_text: Banish 1 Tuner and up to 2 non-Tuner monsters from your Graveyard, and if you do, Special Summon 1 "Stardust" Synchro Monster from your Extra Deck whose Level equals the total Levels of those banished monsters, but it has its effects negated. (This Special Summon is treated as a Synchro Summon.)
external_ids: local SETCARD_ID_0 = 0xa3 --Stardust
  
lua: local SETCARD_ID_0 = 0xa3 --Stardust
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_REMOVE + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter1(c, e, tp)
  	local lv = c:GetLevel()
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsType(TYPE_SYNCHRO)
  		and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_SYNCHRO, tp, false, false)
  		and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0
  		and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_GRAVE, 0, 1, nil, tp, lv)
  end
  function s.filter2(c, tp, lv)
  	local rlv = lv - c:GetLevel()
  	local rg = Duel.GetMatchingGroup(s.filter3, tp, LOCATION_GRAVE, 0, c)
  	return rlv > 0 and c:IsType(TYPE_TUNER) and c:IsAbleToRemove() and rg:CheckWithSumEqual(Card.GetLevel, rlv, 1, 2)
  end
  function s.filter3(c)
  	return c:GetLevel() > 0 and not c:IsType(TYPE_TUNER) and c:IsAbleToRemove()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return aux.MustMaterialCheck(nil, tp, EFFECT_MUST_BE_SMATERIAL) and Duel.IsExistingMatchingCard(s.filter1, tp, LOCATION_EXTRA, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if not aux.MustMaterialCheck(nil, tp, EFFECT_MUST_BE_SMATERIAL) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = Duel.SelectMatchingCard(tp, s.filter1, tp, LOCATION_EXTRA, 0, 1, 1, nil, e, tp)
  	local tc = g1:GetFirst()
  	if tc then
  		local lv = tc:GetLevel()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local g2 = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_GRAVE, 0, 1, 1, nil, tp, lv)
  		local rlv = lv - g2:GetFirst():GetLevel()
  		local rg = Duel.GetMatchingGroup(s.filter3, tp, LOCATION_GRAVE, 0, g2:GetFirst())
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local g3 = rg:SelectWithSumEqual(tp, Card.GetLevel, rlv, 1, 2)
  		g2:Merge(g3)
  		Duel.Remove(g2, POS_FACEUP, REASON_EFFECT)
  		tc:SetMaterial(nil)
  		Duel.SpecialSummonStep(tc, SUMMON_TYPE_SYNCHRO, tp, tp, false, false, POS_FACEUP)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1, true)
  		local e2 = Effect.CreateEffect(e:GetHandler())
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2, true)
  		tc:CompleteProcedure()
  		Duel.SpecialSummonComplete()
  	end
  end
  
  
source_text: Necroid
  Banish 1 Tuner and up to 2 non-Tuner monsters from your Graveyard, and if you do, Special Summon 1 "Stardust" Synchro Monster from your Extra Deck whose Level equals the total Levels of those banished monsters, but it has its effects negated. (This Special Summon is treated as a Synchro Summon.)
target_text: -- Necroid
  local SETCARD_ID_0 = 0xa3 --Stardust
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_REMOVE + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter1(c, e, tp)
  	local lv = c:GetLevel()
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsType(TYPE_SYNCHRO)
  		and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_SYNCHRO, tp, false, false)
  		and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0
  		and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_GRAVE, 0, 1, nil, tp, lv)
  end
  function s.filter2(c, tp, lv)
  	local rlv = lv - c:GetLevel()
  	local rg = Duel.GetMatchingGroup(s.filter3, tp, LOCATION_GRAVE, 0, c)
  	return rlv > 0 and c:IsType(TYPE_TUNER) and c:IsAbleToRemove() and rg:CheckWithSumEqual(Card.GetLevel, rlv, 1, 2)
  end
  function s.filter3(c)
  	return c:GetLevel() > 0 and not c:IsType(TYPE_TUNER) and c:IsAbleToRemove()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return aux.MustMaterialCheck(nil, tp, EFFECT_MUST_BE_SMATERIAL) and Duel.IsExistingMatchingCard(s.filter1, tp, LOCATION_EXTRA, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if not aux.MustMaterialCheck(nil, tp, EFFECT_MUST_BE_SMATERIAL) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = Duel.SelectMatchingCard(tp, s.filter1, tp, LOCATION_EXTRA, 0, 1, 1, nil, e, tp)
  	local tc = g1:GetFirst()
  	if tc then
  		local lv = tc:GetLevel()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local g2 = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_GRAVE, 0, 1, 1, nil, tp, lv)
  		local rlv = lv - g2:GetFirst():GetLevel()
  		local rg = Duel.GetMatchingGroup(s.filter3, tp, LOCATION_GRAVE, 0, g2:GetFirst())
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local g3 = rg:SelectWithSumEqual(tp, Card.GetLevel, rlv, 1, 2)
  		g2:Merge(g3)
  		Duel.Remove(g2, POS_FACEUP, REASON_EFFECT)
  		tc:SetMaterial(nil)
  		Duel.SpecialSummonStep(tc, SUMMON_TYPE_SYNCHRO, tp, tp, false, false, POS_FACEUP)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1, true)
  		local e2 = Effect.CreateEffect(e:GetHandler())
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2, true)
  		tc:CompleteProcedure()
  		Duel.SpecialSummonComplete()
  	end
  end
  
  