--created by Lyris / NovaTsukimori, coded by Lyris, art by Meerin of DeviantArt --襲雷メカドラゴン・イーチー local s,id,o=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e0=Effect.CreateEffect(c) e0:SetCategory(CATEGORY_DESTROY) e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e0:SetCode(EVENT_BE_BATTLE_TARGET) e0:SetTarget(s.destg) e0:SetOperation(s.desop) c:RegisterEffect(e0) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,id) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetCondition(function(e) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) end) e3:SetTarget(s.tg) e3:SetOperation(s.op) c:RegisterEffect(e3) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.Destroy(e:GetHandler(),REASON_EFFECT) end end function s.filter(c,tp) return c:IsSetCard(0x7c4) and c:IsFaceup() and Duel.GetMZoneCount(tp,c)>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local c=e:GetHandler() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsSetCard(0x7c4) and tc:IsControler(tp) and Duel.Destroy(tc,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.BreakEffect() Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.spfilter(c,e,tp) return c:IsSetCard(0x7c4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(id) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.op(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsSetCard(0x7c4) and not tc:IsCode(id) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end