--coded by Lyris local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE) e0:SetCode(EFFECT_SPSUMMON_PROC) e0:SetRange(LOCATION_EXTRA) e0:SetCondition(s.lkcon) e0:SetOperation(s.lkop) e0:SetValue(SUMMON_TYPE_LINK) c:RegisterEffect(e0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_CONTROL) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.descon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e4:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e4:SetValue(1) c:RegisterEffect(e4) end function s.lkfilter(c,lc) return c:IsFaceup() and c:IsCanBeLinkMaterial(lc) and c:IsSetCard(0x617) end function s.lkcon(e,c) if c==nil then return true end if (c:IsType(TYPE_PENDULUM+TYPE_PANDEMONIUM+TYPE_RELAY)) and c:IsFaceup() then return false end local tp=c:GetControler() local mg=Duel.GetMatchingGroup(s.lkfilter,tp,LOCATION_MZONE,0,nil,c) return mg:CheckWithSumEqual(Card.GetLevel,12,4,4) end function s.lkop(e,tp,eg,ep,ev,re,r,rp,c) local mg=Duel.GetMatchingGroup(s.lkfilter,tp,LOCATION_MZONE,0,nil,c) local sg=mg:SelectWithSumEqual(tp,Card.GetLevel,12,4,4) Duel.SendtoGrave(sg,REASON_MATERIAL+REASON_LINK) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsControlerCanBeChanged() end Duel.SetOperationInfo(0,CATEGORY_CONTROL,c,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local seq=11-c:GetSequence() if c:IsRelateToEffect(e) and Duel.GetControl(c,1-tp,0,1) then Duel.MoveSequence(c,seq) end end function s.cfilter(c,tp,zone) local seq=c:GetSequence() if c:IsControler(1-tp) then seq=seq+16 end return bit.extract(zone,seq)~=0 end function s.descon(e,tp,eg,ep,ev,re,r,rp) local zone=c:GetLinkedZone()*(1<<16) return eg:IsExists(s.cfilter,1,nil,tp,zone) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,LOCATION_MZONE,0,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,1-tp,LOCATION_GRAVE) end function s.filter(c,e,tp) return g:GetLevel()==3 and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,1-tp,false,false) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,Card.IsDestructable,tp,LOCATION_MZONE,0,1,1,e:GetHandler()) if #g>0 then Duel.HintSelection(g) if Duel.Destroy(g,REASON_EFFECT)==0 then return end local mg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_GRAVE,nil,e,tp) if #mg>0 and Duel.SelectYesNo(1-tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON) local sg=mg:Select(1-tp,1,1,nil) Duel.BreakEffect() Duel.SpecialSummon(sg,0,1-tp,1-tp,false,false,POS_FACEUP) end end end