--Lanternal Ushi local cid,id=GetID() function cid.initial_effect(c) --return local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(cid.tdtg) e1:SetOperation(cid.tdop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP) c:RegisterEffect(e2) --return local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetOperation(cid.regop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_FLIP) c:RegisterEffect(e4) end --filters function cid.tdfilter(c) return c:IsSetCard(0xd2e) and c:IsAbleToDeck() end function cid.setfilter(c) return c:IsSetCard(0xd2e) and c:IsType(TYPE_TRAP) and c:IsSSetable() end --return function cid.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingTarget(cid.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g1=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) e:SetLabelObject(g1:GetFirst()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g2=Duel.SelectTarget(tp,cid.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g1,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,g2,1,0,0) end function cid.tdop(e,tp,eg,ep,ev,re,r,rp) local tc1,tc2=Duel.GetFirstTarget() if tc1~=e:GetLabelObject() then tc1,tc2=tc2,tc1 end if tc1:IsRelateToEffect(e) and Duel.SendtoHand(tc1,nil,REASON_EFFECT)>0 and tc1:IsLocation(LOCATION_HAND) and tc2:IsRelateToEffect(e) then Duel.SendtoDeck(tc2,nil,0,REASON_EFFECT) end end --return function cid.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetTarget(cid.rettg) e1:SetOperation(cid.retop) e1:SetReset(RESET_EVENT+0x1ec0000+RESET_PHASE+PHASE_END) c:RegisterEffect(e1) end function cid.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.setfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function cid.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SendtoHand(c,nil,REASON_EFFECT)~=0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,cid.setfilter,tp,LOCATION_DECK,0,1,1,nil,false) if g:GetCount()>0 then Duel.SSet(tp,g:GetFirst()) Duel.ConfirmCards(1-tp,g) end end end