name: Shiranui
card_text: If this card is in your Graveyard, except the turn this card was sent to the Graveyard: You can target 1 non-Tuner Zombie-Type monster in your Graveyard; banish both it and this card, and if you do, Special Summon 1 Zombie-Type Synchro Monster from your Extra Deck whose Level equals the total Levels those 2 monsters had. You can only use this effect of "Shiranui Spectralsword" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(aux.exccon)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter1(c, e, tp, lv)
  	local clv = c:GetLevel()
  	return clv > 0 and not c:IsType(TYPE_TUNER) and c:IsRace(RACE_ZOMBIE) and c:IsAbleToRemove() and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, lv + clv)
  end
  function s.filter2(c, e, tp, lv)
  	return c:IsLevel(lv) and c:IsRace(RACE_ZOMBIE) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter1(chkc, e, tp, e:GetHandler():GetLevel())
  	end
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and Duel.IsExistingTarget(s.filter1, tp, LOCATION_GRAVE, 0, 1, nil, e, tp, e:GetHandler():GetLevel())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(tp, s.filter1, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp, e:GetHandler():GetLevel())
  	g:AddCard(e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 2, tp, LOCATION_GRAVE)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if not c:IsRelateToEffect(e) or not tc:IsRelateToEffect(e) then
  		return
  	end
  	local lv = c:GetLevel() + tc:GetLevel()
  	local g = Group.FromCards(c, tc)
  	if Duel.Remove(g, POS_FACEUP, REASON_EFFECT) == 2 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_EXTRA, 0, 1, 1, nil, e, tp, lv)
  		if sg:GetCount() > 0 then
  			Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  
  
source_text: Shiranui
  If this card is in your Graveyard, except the turn this card was sent to the Graveyard: You can target 1 non-Tuner Zombie-Type monster in your Graveyard; banish both it and this card, and if you do, Special Summon 1 Zombie-Type Synchro Monster from your Extra Deck whose Level equals the total Levels those 2 monsters had. You can only use this effect of "Shiranui Spectralsword" once per turn.
target_text: -- Shiranui
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(aux.exccon)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter1(c, e, tp, lv)
  	local clv = c:GetLevel()
  	return clv > 0 and not c:IsType(TYPE_TUNER) and c:IsRace(RACE_ZOMBIE) and c:IsAbleToRemove() and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, lv + clv)
  end
  function s.filter2(c, e, tp, lv)
  	return c:IsLevel(lv) and c:IsRace(RACE_ZOMBIE) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter1(chkc, e, tp, e:GetHandler():GetLevel())
  	end
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and Duel.IsExistingTarget(s.filter1, tp, LOCATION_GRAVE, 0, 1, nil, e, tp, e:GetHandler():GetLevel())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(tp, s.filter1, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp, e:GetHandler():GetLevel())
  	g:AddCard(e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 2, tp, LOCATION_GRAVE)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if not c:IsRelateToEffect(e) or not tc:IsRelateToEffect(e) then
  		return
  	end
  	local lv = c:GetLevel() + tc:GetLevel()
  	local g = Group.FromCards(c, tc)
  	if Duel.Remove(g, POS_FACEUP, REASON_EFFECT) == 2 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_EXTRA, 0, 1, 1, nil, e, tp, lv)
  		if sg:GetCount() > 0 then
  			Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  
  