--Asmitala Branchia local x=888011 local cx=_G["c"..x] function cx.initial_effect(c) c:EnableReviveLimit() aux.AddFusionProcFunRep(c,cx.ffilter,2,false) local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetValue(cx.splimit) c:RegisterEffect(e0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_EXTRA) e1:SetCondition(cx.spcon) e1:SetOperation(cx.spop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TODECK+CATEGORY_TOHAND) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,888011) e2:SetTarget(cx.rettg) e2:SetOperation(cx.retop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,888111) e3:SetCondition(cx.spcon2) e3:SetTarget(cx.thtg) e3:SetOperation(cx.thop) c:RegisterEffect(e3) end function cx.ffilter(c) return c:IsSetCard(0xffa) end function cx.splimit(e,se,sp,st) return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION end function cx.spfilter(c,fc) return cx.ffilter(c) and c:IsCanBeFusionMaterial(fc) end function cx.spfilter1(c,tp,g) return g:IsExists(cx.spfilter2,1,c,tp,c) end function cx.spfilter2(c,tp,mc) return Duel.GetLocationCountFromEx(tp,tp,Group.FromCards(c,mc))>0 end function cx.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local g=Duel.GetReleaseGroup(tp):Filter(cx.spfilter,nil,c) return g:IsExists(cx.spfilter1,1,nil,tp,g) end function cx.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.GetReleaseGroup(tp):Filter(cx.spfilter,nil,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local g1=g:FilterSelect(tp,cx.spfilter1,1,1,nil,tp,g) local mc=g1:GetFirst() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local g2=g:FilterSelect(tp,cx.spfilter2,1,1,mc,tp,mc) g1:Merge(g2) c:SetMaterial(g1) Duel.Release(g1,REASON_COST+REASON_FUSION+REASON_MATERIAL) end function cx.spcon2(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) end function cx.retfilter1(c) return c:IsSetCard(0xffa) and c:IsAbleToDeck() end function cx.retfilter2(c) return c:IsAbleToHand() end function cx.rettg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(cx.retfilter1,tp,LOCATION_GRAVE+LOCATION_EXTRA,0,2,nil) and Duel.IsExistingTarget(cx.retfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g1=Duel.SelectTarget(tp,cx.retfilter1,tp,LOCATION_GRAVE+LOCATION_EXTRA,0,2,2,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g2=Duel.SelectTarget(tp,cx.retfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,g1:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g2,1,0,0) end function cx.retop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) local g1=g:Filter(Card.IsLocation,nil,LOCATION_GRAVE+LOCATION_EXTRA) if Duel.SendtoDeck(g1,nil,0,REASON_EFFECT)~=0 then local og=Duel.GetOperatedGroup() if og:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end local g2=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD) Duel.SendtoHand(g2,nil,REASON_EFFECT) end end function cx.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function cx.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end