--created by Lyris / LionHeartKIng, coded by Lyris --襲雷竜-金 local s,id,o=GetID() function s.initial_effect(c) aux.EnablePendulumAttribute(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetTarget(s.sumtg) e1:SetOperation(s.sumop) c:RegisterEffect(e1) local e0=Effect.CreateEffect(c) e0:SetCategory(CATEGORY_DESTROY) e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e0:SetRange(LOCATION_MZONE) e0:SetCode(EVENT_ATTACK_ANNOUNCE) e0:SetCountLimit(1,id) e0:SetCondition(s.descon) e0:SetTarget(s.destg) e0:SetOperation(s.desop) c:RegisterEffect(e0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_DESTROYED) e1:SetCountLimit(1,id) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetTarget(s.sumtg) e1:SetOperation(s.sumop) c:RegisterEffect(e1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Duel.GetTurnPlayer()~=tp and c:IsFaceup() and Duel.GetAttackTarget()==c 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) local c=e:GetHandler() Duel.NegateAttack() if c:IsRelateToEffect(e) and Duel.Destroy(c,REASON_EFFECT)~=0 then local g=Duel.SelectMatchingCard(tp,Card.IsType,tp,0,LOCATION_ONFIELD,1,1,nil,TYPE_SPELL+TYPE_TRAP) Duel.HintSelection(g) if #g>0 then Duel.BreakEffect() Duel.Destroy(g,REASON_EFFECT) end end end function s.cfilter(c,tp) return c:GetOriginalType()&TYPE_MONSTER~=0 and (c:IsPreviousPosition(POS_FACEUP) or c:GetPreviousControler()==tp) and c:IsSetCard(0x7c4) end function s.filter2(c,e,sp) return c:IsSetCard(0x7c4) and c:IsCanBeSpecialSummoned(e,0,sp,false,false) and not c:IsCode(id) end function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter2(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter2,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter2,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.sumop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if e:IsHasType(EFFECT_TYPE_FIELD) and not c:IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsSetCard(0x7c4) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_CANNOT_ATTACK) e0:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e0:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e0,true) Duel.SpecialSummonComplete() end end