--[[ Eternadir Dragon Eindrenth Drago Eternadir Eindrenth Card Author: D1G1TAL Scripted by: XGlitchy30 ]] local s,id=GetID() function s.initial_effect(c) aux.EnablePendulumAttribute(c,false) --Register Activation local reg=Effect.CreateEffect(c) reg:SetType(EFFECT_TYPE_ACTIVATE) reg:SetCode(EVENT_FREE_CHAIN) reg:SetRange(LOCATION_HAND) reg:SetCost(s.reg) c:RegisterEffect(reg) --[[You cannot Pendulum Summon monsters, except "Eternadir" monsters.]] local p1=Effect.CreateEffect(c) p1:SetType(EFFECT_TYPE_FIELD) p1:SetProperty(EFFECT_FLAG_PLAYER_TARGET|EFFECT_FLAG_CANNOT_DISABLE|EFFECT_FLAG_CAN_FORBIDDEN|EFFECT_FLAG_UNCOPYABLE) p1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) p1:SetRange(LOCATION_PZONE) p1:SetTargetRange(1,0) p1:SetTarget(s.splimit) c:RegisterEffect(p1) --[[During your Main Phase, if this card was activated this turn: You can target 1 "Eternadir" Spell/Trap in your GY; add it to your hand.]] local p2=Effect.CreateEffect(c) p2:Desc(0) p2:SetCategory(CATEGORY_TOHAND) p2:SetType(EFFECT_TYPE_IGNITION) p2:SetProperty(EFFECT_FLAG_CARD_TARGET) p2:SetRange(LOCATION_PZONE) p2:HOPT() p2:SetFunctions(s.discon,nil,s.distg,s.disop) c:RegisterEffect(p2) --Must be Pendulum Summoned. aux.EnableReviveLimitPendulumSummonable(c) 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(s.splimit_self) c:RegisterEffect(e0) --[[All monsters your opponent controls lose 400 ATK.]] local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(-400) c:RegisterEffect(e1) --If this card on the field is destroyed: You can target 1 card on the field; shuffle it into the Deck. local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetCategory(CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY|EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_DESTROYED) e2:SetFunctions(s.tdcon,nil,s.tdtg,s.tdop) c:RegisterEffect(e2) end function s.reg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end e:GetHandler():RegisterFlagEffect(id,RESET_PHASE|PHASE_END,EFFECT_FLAG_OATH,1) end --P1 function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return (sumtype&SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM and not c:IsSetCard(ARCHE_ETERNADIR) end --P2 function s.discon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():HasFlagEffect(id) end function s.thfilter(c) return c:IsST() and c:IsSetCard(ARCHE_ETERNADIR) and c:IsAbleToHand() end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil):GetFirst() Duel.SetCardOperationInfo(tc,CATEGORY_TOHAND) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToChain() then Duel.Search(tc,tp) end end --E0 function s.splimit_self(e,se,sp,st) return (st&SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end --E2 function s.tdcon(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsAbleToDeck() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetCardOperationInfo(g,CATEGORY_TODECK) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToChain() then Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end