--Millenium Eye's Trick
function c29387617.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_HANDES+CATEGORY_TODECK+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c29387617.target)
e1:SetOperation(c29387617.activate)
c:RegisterEffect(e1)
end
function c29387617.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,29387617)==0 end
if chk==0 then return Duel.GetFieldGroupCount(1-tp,0,LOCATION_HAND)>0 end
Duel.RegisterFlagEffect(tp,29387617,0,0,0)
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,1-tp,1)
end
function c29387617.activate(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local g=Duel.GetFieldGroup(p,0,LOCATION_HAND)
if g:GetCount()>0 then
Duel.ConfirmCards(p,g)
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_REMOVE)
local sg=g:Select(p,1,1,nil)
Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)
if chk==0 then return Duel.IsPlayerCanDraw(1-tp)
and Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,0,LOCATION_HAND,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,1-tp,LOCATION_HAND)
local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if g:GetCount()==0 then return end
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
Duel.ShuffleDeck(1-tp)
Duel.BreakEffect()
Duel.Draw(1-tp,g:GetCount(),REASON_EFFECT)
end
end
only thing that kept me busy was once per duel because outlaw never told me it had to be before anything else.