name: Priestess
card_text: When a card or effect is activated that targets this card (Quick Effect): You can send 1 Effect Monster you control to the GY, and if you do, add up to 2 "Blue-Eyes" monsters with different names from your Deck to your hand. If this card is in your GY: You can target 1 "Blue-Eyes" monster you control; shuffle it into the Deck, and if you do, Special Summon this card. You can only use 1 "Priestess with Eyes of Blue" effect per turn, and only once that turn.
external_ids: local SETCARD_ID_0 = 0xdd --Blue-Eyes
  
lua: local SETCARD_ID_0 = 0xdd --Blue-Eyes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EVENT_BECOME_TARGET)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TODECK + CATEGORY_SPECIAL_SUMMON)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsContains(e:GetHandler())
  end
  function s.tgfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsAbleToGrave()
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_MZONE)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local tg = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	local tc = tg:GetFirst()
  	if tc and Duel.SendtoGrave(tc, REASON_EFFECT) ~= 0 and tc:IsLocation(LOCATION_GRAVE) then
  		local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil)
  		if g:GetCount() <= 0 then
  			return
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local sg1 = g:SelectSubGroup(tp, aux.dncheck, false, 1, 2)
  		Duel.SendtoHand(sg1, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, sg1)
  	end
  end
  function s.spfilter(c, ft)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToDeck() and (ft > 0 or c:GetSequence() < 5)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.spfilter(chkc, ft)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.spfilter, tp, LOCATION_MZONE, 0, 1, nil, ft) and ft > -1 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, ft)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) ~= 0 and c:IsRelateToEffect(e) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  
source_text: Priestess
  When a card or effect is activated that targets this card (Quick Effect): You can send 1 Effect Monster you control to the GY, and if you do, add up to 2 "Blue-Eyes" monsters with different names from your Deck to your hand. If this card is in your GY: You can target 1 "Blue-Eyes" monster you control; shuffle it into the Deck, and if you do, Special Summon this card. You can only use 1 "Priestess with Eyes of Blue" effect per turn, and only once that turn.
target_text: -- Priestess
  local SETCARD_ID_0 = 0xdd --Blue-Eyes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EVENT_BECOME_TARGET)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TODECK + CATEGORY_SPECIAL_SUMMON)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsContains(e:GetHandler())
  end
  function s.tgfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsAbleToGrave()
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_MZONE)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local tg = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	local tc = tg:GetFirst()
  	if tc and Duel.SendtoGrave(tc, REASON_EFFECT) ~= 0 and tc:IsLocation(LOCATION_GRAVE) then
  		local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil)
  		if g:GetCount() <= 0 then
  			return
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local sg1 = g:SelectSubGroup(tp, aux.dncheck, false, 1, 2)
  		Duel.SendtoHand(sg1, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, sg1)
  	end
  end
  function s.spfilter(c, ft)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToDeck() and (ft > 0 or c:GetSequence() < 5)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.spfilter(chkc, ft)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.spfilter, tp, LOCATION_MZONE, 0, 1, nil, ft) and ft > -1 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, ft)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) ~= 0 and c:IsRelateToEffect(e) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  