name: Lightpulsar
card_text: You can Special Summon this card (from your hand) by banishing 1 LIGHT and 1 DARK monster from your GY. You can Special Summon this card (from your GY) by sending 1 LIGHT and 1 DARK monster from your hand to the GY. When this card is sent from the field to the GY: You can target 1 Level 5 or higher DARK Dragon monster in your GY; Special Summon that target.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	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:SetCondition(s.spcon1)
  	e1:SetTarget(s.sptg1)
  	e1:SetOperation(s.spop1)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCondition(s.spcon2)
  	e2:SetTarget(s.sptg2)
  	e2:SetOperation(s.spop2)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_TO_GRAVE)
  	e3:SetCondition(s.spcon3)
  	e3:SetTarget(s.sptg3)
  	e3:SetOperation(s.spop3)
  	c:RegisterEffect(e3)
  end
  function s.spcostfilter1(c)
  	return c:IsAbleToRemoveAsCost() and c:IsAttribute(ATTRIBUTE_LIGHT + ATTRIBUTE_DARK)
  end
  function s.spcostfilter2(c)
  	return c:IsAbleToGraveAsCost() and c:IsAttribute(ATTRIBUTE_LIGHT + ATTRIBUTE_DARK)
  end
  function s.spcon1(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	if Duel.GetMZoneCount(tp) <= 0 then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.spcostfilter1, tp, LOCATION_GRAVE, 0, nil)
  	return g:CheckSubGroup(aux.gfcheck, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  end
  function s.sptg1(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spcostfilter1, tp, LOCATION_GRAVE, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroup(tp, aux.gfcheck, true, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.spop1(e, tp, eg, ep, ev, re, r, rp, c)
  	local sg = e:GetLabelObject()
  	Duel.Remove(sg, POS_FACEUP, REASON_SPSUMMON)
  	sg:DeleteGroup()
  end
  function s.spcon2(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	if c:IsHasEffect(EFFECT_NECRO_VALLEY) or Duel.GetMZoneCount(tp) <= 0 then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.spcostfilter2, tp, LOCATION_HAND, 0, nil)
  	return g:CheckSubGroup(aux.gfcheck, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  end
  function s.sptg2(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spcostfilter2, tp, LOCATION_HAND, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local sg = g:SelectSubGroup(tp, aux.gfcheck, true, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.spop2(e, tp, eg, ep, ev, re, r, rp, c)
  	local sg = e:GetLabelObject()
  	Duel.SendtoGrave(sg, REASON_SPSUMMON)
  	sg:DeleteGroup()
  end
  function s.spcon3(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.spfilter3(c, e, tp)
  	return c:IsLevelAbove(5) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg3(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter3(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingTarget(s.spfilter3, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter3, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spop3(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  
source_text: Lightpulsar
  You can Special Summon this card (from your hand) by banishing 1 LIGHT and 1 DARK monster from your GY. You can Special Summon this card (from your GY) by sending 1 LIGHT and 1 DARK monster from your hand to the GY. When this card is sent from the field to the GY: You can target 1 Level 5 or higher DARK Dragon monster in your GY; Special Summon that target.
target_text: -- Lightpulsar
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	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:SetCondition(s.spcon1)
  	e1:SetTarget(s.sptg1)
  	e1:SetOperation(s.spop1)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCondition(s.spcon2)
  	e2:SetTarget(s.sptg2)
  	e2:SetOperation(s.spop2)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_TO_GRAVE)
  	e3:SetCondition(s.spcon3)
  	e3:SetTarget(s.sptg3)
  	e3:SetOperation(s.spop3)
  	c:RegisterEffect(e3)
  end
  function s.spcostfilter1(c)
  	return c:IsAbleToRemoveAsCost() and c:IsAttribute(ATTRIBUTE_LIGHT + ATTRIBUTE_DARK)
  end
  function s.spcostfilter2(c)
  	return c:IsAbleToGraveAsCost() and c:IsAttribute(ATTRIBUTE_LIGHT + ATTRIBUTE_DARK)
  end
  function s.spcon1(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	if Duel.GetMZoneCount(tp) <= 0 then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.spcostfilter1, tp, LOCATION_GRAVE, 0, nil)
  	return g:CheckSubGroup(aux.gfcheck, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  end
  function s.sptg1(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spcostfilter1, tp, LOCATION_GRAVE, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroup(tp, aux.gfcheck, true, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.spop1(e, tp, eg, ep, ev, re, r, rp, c)
  	local sg = e:GetLabelObject()
  	Duel.Remove(sg, POS_FACEUP, REASON_SPSUMMON)
  	sg:DeleteGroup()
  end
  function s.spcon2(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	if c:IsHasEffect(EFFECT_NECRO_VALLEY) or Duel.GetMZoneCount(tp) <= 0 then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.spcostfilter2, tp, LOCATION_HAND, 0, nil)
  	return g:CheckSubGroup(aux.gfcheck, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  end
  function s.sptg2(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spcostfilter2, tp, LOCATION_HAND, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local sg = g:SelectSubGroup(tp, aux.gfcheck, true, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.spop2(e, tp, eg, ep, ev, re, r, rp, c)
  	local sg = e:GetLabelObject()
  	Duel.SendtoGrave(sg, REASON_SPSUMMON)
  	sg:DeleteGroup()
  end
  function s.spcon3(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.spfilter3(c, e, tp)
  	return c:IsLevelAbove(5) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg3(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter3(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingTarget(s.spfilter3, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter3, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spop3(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  