--E.V.Alution function c212155.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c212155.cost) e1:SetTarget(c212155.target) e1:SetCountLimit(1,212155) e1:SetOperation(c212155.activate) c:RegisterEffect(e1) --shuffle and draw local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1,212156) e2:SetRange(LOCATION_GRAVE) e2:SetCost(aux.bfgcost) e2:SetTarget(c212155.tdtg) e2:SetOperation(c212155.tdop) c:RegisterEffect(e2) end function c212155.costfilter(c,e,tp) if not c:IsSetCard(0x258) or not c:IsAbleToGraveAsCost() or not c:IsFaceup() then return false end local code=c:GetCode() local class=_G["c"..code] if class==nil or class.lvupcount==nil then return false end return Duel.IsExistingMatchingCard(c212155.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,class,e,tp) end function c212155.spfilter(c,class,e,tp) local code=c:GetCode() for i=1,class.lvupcount do if code==class.lvup[i] then return c:IsCanBeSpecialSummoned(e,0,tp,true,true) end end return false end function c212155.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c212155.costfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c212155.costfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SendtoGrave(g,REASON_COST) e:SetLabel(g:GetFirst():GetCode()) end function c212155.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE) end function c212155.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local code=e:GetLabel() local class=_G["c"..code] if class==nil or class.lvupcount==nil then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c212155.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,class,e,tp) local tc=g:GetFirst() if tc then Duel.SpecialSummon(tc,0,tp,tp,true,true,POS_FACEUP) if tc:GetPreviousLocation()==LOCATION_DECK then Duel.ShuffleDeck(tp) end end end function c212155.tdfilter(c) return c:IsSetCard(0x258) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() end function c212155.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c212155.tdfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c212155.tdfilter,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsPlayerCanDraw(tp,1) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,c212155.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c212155.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end Duel.SendtoDeck(tc,nil,0,REASON_EFFECT) if tc:IsLocation(LOCATION_DECK) then Duel.ShuffleDeck(tp) end if tc:IsLocation(LOCATION_DECK+LOCATION_EXTRA) then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end