--Enigmatic Untergang Assassin, Flower function c400006.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c400006.spcon) e1:SetOperation(c400006.spop) e1:SetCountLimit(1,400006) c:RegisterEffect(e1) --draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(73881652,0)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetTarget(c400006.drtg) e2:SetOperation(c400006.drop) e2:SetCountLimit(1,1400006) c:RegisterEffect(e2) -- local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(400001,0)) e3:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e3:SetType(EFFECT_TYPE_QUICK_F) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1,11400006) e3:SetCondition(c400006.condition) e3:SetTarget(c400006.target) e3:SetOperation(c400006.operation) c:RegisterEffect(e3) end function c400006.spfilter(c) return c:IsType(TYPE_QUICKPLAY) and c:IsSetCard(0x246) and c:IsAbleToGraveAsCost() end function c400006.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c400006.spfilter,tp,LOCATION_DECK,0,1,nil) end function c400006.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c400006.spfilter,tp,LOCATION_DECK,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function c400006.drfilter(c) return c:IsSetCard(0x246) and c:IsAbleToDeck() and c:IsType(TYPE_QUICKPLAY) end function c400006.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=Duel.GetMatchingGroup(c400006.drfilter,tp,LOCATION_GRAVE,0,nil) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and g:GetClassCount(Card.GetCode)>2 end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,3,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c400006.drop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c400006.drfilter,tp,LOCATION_GRAVE,0,nil) if not (g:GetClassCount(Card.GetCode)>2) then return end local sg=Group.CreateGroup() for i=1,3 do Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g1=g:Select(tp,1,1,nil) g:Remove(Card.IsCode,nil,g1:GetFirst():GetCode()) sg:Merge(g1) end Duel.SendtoDeck(sg,nil,0,REASON_EFFECT) local g=Duel.GetOperatedGroup() if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA) if ct==3 then Duel.Draw(tp,1,REASON_EFFECT) end end function c400006.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()~=tp and re:GetHandler():IsType(TYPE_QUICKPLAY) and re:GetHandler():IsSetCard(0x246) and rp==tp end function c400006.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0) end function c400006.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end