--Gramnad, Holy Knight of Ichyaltas --Scripted by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --recycle local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_RELEASE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCountLimit(1,id+100) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end function s.spfilter(c,tp) return c:IsSetCard(0x2a7) and c:IsType(TYPE_MONSTER) and (c:IsControler(tp) or c:IsFaceup()) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetReleaseGroup(tp):Filter(s.spfilter,nil,e,tp) if chk==0 then return g:CheckSubGroup(aux.mzctcheckrel,1,1,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local rg=g:SelectSubGroup(tp,aux.mzctcheckrel,false,1,1,tp) aux.UseExtraReleaseCount(rg,tp) Duel.Release(rg,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end -- function s.drfilter(c) return c:IsSetCard(0x2a7) and c:IsAbleToDeck() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.drfilter(chkc) end if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(s.drfilter,tp,LOCATION_GRAVE,0,5,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,aux.NecroValleyFilter(s.drfilter),tp,LOCATION_GRAVE,0,5,5,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,5,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)<=0 then return end Duel.SendtoDeck(tg,nil,0,REASON_EFFECT) local g=Duel.GetOperatedGroup() for p=0,1 do local cg=g:Filter(Card.IsControler,nil,p):Filter(Card.IsLocation,nil,LOCATION_DECK) if #cg>0 then Duel.ShuffleDeck(p) end end local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA) if ct>0 then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end