--Dracosis Trade-Out local s,id=GetID() function s.initial_effect(c) --activate local e0=Effect.CreateEffect(c) e0:Desc(0) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --search local e1=Effect.CreateEffect(c) e1:Desc(1) e1:SetCategory(CATEGORIES_SEARCH) e1:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_DECK) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(2,id+EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cfilter(c,tp) if not c:IsControler(tp) then return false end return (c:IsSetCard(0x300) and c:IsType(TYPE_MONSTER)) or (c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousTypeOnField(TYPE_MONSTER) and c:IsPreviousSetCard(0x300)) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFlagEffect(tp,id)==0 end local g=eg:Filter(aux.NOT(Card.IsPreviousPosition),nil,POS_FACEUP) if #g>0 then Duel.ConfirmCards(1-tp,g) end Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.filter(c) return c:IsSetCard(0x300) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.Select(HINTMSG_ATOHAND,false,tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.Search(g,tp) end end