name: Dark
card_text: When your opponent Normal or Special Summons a monster(s): Target 1 of those monsters and 1 Spellcaster monster you control; send both monsters to the GY, then you can Special Summon 1 DARK Spellcaster monster from your Deck or GY.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_SPECIAL_SUMMON + CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  end
  function s.filter1(c, e, tp)
  	return c:IsSummonPlayer(1 - tp) and c:IsLocation(LOCATION_MZONE) and c:IsCanBeEffectTarget(e) and Duel.IsExistingTarget(s.filter2, tp, LOCATION_MZONE, 0, 1, c)
  end
  function s.filter2(c)
  	return c:IsFaceup() and c:IsRace(RACE_SPELLCASTER)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return eg:IsExists(s.filter1, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g1 = eg:FilterSelect(tp, s.filter1, 1, 1, nil, e, tp)
  	Duel.SetTargetCard(g1)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g2 = Duel.SelectTarget(tp, s.filter2, tp, LOCATION_MZONE, 0, 1, 1, g1:GetFirst())
  	g1:Merge(g2)
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, g1, 2, 0, 0)
  end
  function s.spfilter(c, e, tp)
  	return c:IsRace(RACE_SPELLCASTER) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if g:GetCount() == 2 and Duel.SendtoGrave(g, REASON_EFFECT) == 2 and g:IsExists(Card.IsLocation, 2, nil, LOCATION_GRAVE) then
  		if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  			return
  		end
  		local sg = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter), tp, LOCATION_DECK + LOCATION_GRAVE, 0, nil, e, tp)
  		if sg:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  			local tg = sg:Select(tp, 1, 1, nil)
  			Duel.SpecialSummon(tg, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  
  
source_text: Dark
  When your opponent Normal or Special Summons a monster(s): Target 1 of those monsters and 1 Spellcaster monster you control; send both monsters to the GY, then you can Special Summon 1 DARK Spellcaster monster from your Deck or GY.
target_text: -- Dark
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_SPECIAL_SUMMON + CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  end
  function s.filter1(c, e, tp)
  	return c:IsSummonPlayer(1 - tp) and c:IsLocation(LOCATION_MZONE) and c:IsCanBeEffectTarget(e) and Duel.IsExistingTarget(s.filter2, tp, LOCATION_MZONE, 0, 1, c)
  end
  function s.filter2(c)
  	return c:IsFaceup() and c:IsRace(RACE_SPELLCASTER)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return eg:IsExists(s.filter1, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g1 = eg:FilterSelect(tp, s.filter1, 1, 1, nil, e, tp)
  	Duel.SetTargetCard(g1)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g2 = Duel.SelectTarget(tp, s.filter2, tp, LOCATION_MZONE, 0, 1, 1, g1:GetFirst())
  	g1:Merge(g2)
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, g1, 2, 0, 0)
  end
  function s.spfilter(c, e, tp)
  	return c:IsRace(RACE_SPELLCASTER) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if g:GetCount() == 2 and Duel.SendtoGrave(g, REASON_EFFECT) == 2 and g:IsExists(Card.IsLocation, 2, nil, LOCATION_GRAVE) then
  		if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  			return
  		end
  		local sg = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter), tp, LOCATION_DECK + LOCATION_GRAVE, 0, nil, e, tp)
  		if sg:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  			local tg = sg:Select(tp, 1, 1, nil)
  			Duel.SpecialSummon(tg, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  
  