name: Votis
card_text: When this card is Normal Summoned: You can excavate the top 3 cards of your Deck, and if you do, you can banish 1 excavated monster to add 1 monster with its same name to your hand, from either your Deck or the other excavated cards, also shuffle the rest into the Deck. Once per turn, during the End Phase, if this card is in your GY because it was sent there this turn after being Normal Summoned/Set: You can excavate the top 3 cards of your Deck, and if you do, place them on top of the Deck in any order.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--to hand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--to grave
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCondition(s.regcon)
  	e2:SetOperation(s.regop)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_PHASE + PHASE_END)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.seqcon)
  	e3:SetTarget(s.seqtg)
  	e3:SetOperation(s.seqop)
  	c:RegisterEffect(e3)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) >= 3 and Duel.IsPlayerCanRemove(tp)
  	end
  end
  function s.rmfilter(c, g)
  	return c:IsType(TYPE_MONSTER) and c:IsAbleToRemove() and g:IsExists(s.thfilter, 1, c, c:GetCode())
  end
  function s.thfilter(c, code)
  	return c:IsCode(code) and c:IsAbleToHand()
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) < 3 then
  		return
  	end
  	Duel.ConfirmDecktop(tp, 3)
  	local g = Duel.GetDecktopGroup(tp, 3)
  	local dg = Duel.GetFieldGroup(tp, LOCATION_DECK, 0)
  	local sg = g:Filter(s.rmfilter, nil, dg)
  	if sg:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local rc = sg:Select(tp, 1, 1, nil):GetFirst()
  		Duel.Remove(rc, POS_FACEUP, REASON_EFFECT)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local tc = dg:FilterSelect(tp, s.thfilter, 1, 1, rc, rc:GetCode())
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, tc)
  	end
  	Duel.ShuffleDeck(tp)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSummonType(SUMMON_TYPE_NORMAL)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.seqcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) > 0
  end
  function s.seqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, 0, LOCATION_DECK) > 2
  	end
  end
  function s.seqop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.SortDecktop(tp, tp, 3)
  end
  
  
source_text: Votis
  When this card is Normal Summoned: You can excavate the top 3 cards of your Deck, and if you do, you can banish 1 excavated monster to add 1 monster with its same name to your hand, from either your Deck or the other excavated cards, also shuffle the rest into the Deck. Once per turn, during the End Phase, if this card is in your GY because it was sent there this turn after being Normal Summoned/Set: You can excavate the top 3 cards of your Deck, and if you do, place them on top of the Deck in any order.
target_text: -- Votis
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--to hand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--to grave
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCondition(s.regcon)
  	e2:SetOperation(s.regop)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_PHASE + PHASE_END)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.seqcon)
  	e3:SetTarget(s.seqtg)
  	e3:SetOperation(s.seqop)
  	c:RegisterEffect(e3)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) >= 3 and Duel.IsPlayerCanRemove(tp)
  	end
  end
  function s.rmfilter(c, g)
  	return c:IsType(TYPE_MONSTER) and c:IsAbleToRemove() and g:IsExists(s.thfilter, 1, c, c:GetCode())
  end
  function s.thfilter(c, code)
  	return c:IsCode(code) and c:IsAbleToHand()
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) < 3 then
  		return
  	end
  	Duel.ConfirmDecktop(tp, 3)
  	local g = Duel.GetDecktopGroup(tp, 3)
  	local dg = Duel.GetFieldGroup(tp, LOCATION_DECK, 0)
  	local sg = g:Filter(s.rmfilter, nil, dg)
  	if sg:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local rc = sg:Select(tp, 1, 1, nil):GetFirst()
  		Duel.Remove(rc, POS_FACEUP, REASON_EFFECT)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local tc = dg:FilterSelect(tp, s.thfilter, 1, 1, rc, rc:GetCode())
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, tc)
  	end
  	Duel.ShuffleDeck(tp)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSummonType(SUMMON_TYPE_NORMAL)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.seqcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) > 0
  end
  function s.seqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, 0, LOCATION_DECK) > 2
  	end
  end
  function s.seqop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.SortDecktop(tp, tp, 3)
  end
  
  