--created & coded by Lyris --機光襲雷竜-ビッグバン local s,id,o=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddFusionProcFunRep(c,s.ffilter,2,true) c:EnableCounterPermit(0x921) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_SELF_DESTROY) e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCounter(tp,1,1,0x921)>=5 end) c:RegisterEffect(e1) local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e0:SetCode(EFFECT_IMMUNE_EFFECT) e0:SetRange(LOCATION_MZONE) e0:SetCondition(s.tgcon) e0:SetValue(s.etarget) c:RegisterEffect(e0) local e5=e0:Clone() e5:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET) e5:SetValue(aux.imval1) c:RegisterEffect(e5) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_MZONE) e2:SetOperation(s.acop) c:RegisterEffect(e2) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_DESTROYED) e4:SetCategory(CATEGORY_DESTROY) e4:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return re==e1 end) e4:SetTarget(s.target) e4:SetOperation(s.activate) c:RegisterEffect(e4) local e0=Effect.CreateEffect(c) e0:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e0:SetType(EFFECT_TYPE_QUICK_O) e0:SetRange(LOCATION_MZONE) e0:SetCode(EVENT_FREE_CHAIN) e0:SetCountLimit(1) e0:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_BATTLE_START) e0:SetTarget(s.destg) e0:SetOperation(s.desop) c:RegisterEffect(e0) end function s.desfilter(c,e,tp) return c:IsLevelBelow(5) and c:IsSetCard(0x7c4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetMZoneCount(tp,c)>0 and Duel.GetTurnPlayer()~=tp and aux.bpcon() and Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.Destroy(c,REASON_EFFECT)~=0 then if Duel.GetAttacker() then Duel.NegateAttack() else local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetOperation(function() if Duel.GetTurnPlayer()~=tp then Duel.Hint(HINT_CARD,0,id) Duel.NegateAttack() end end) Duel.RegisterEffect(e1,tp) end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.SpecialSummon(Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.desfilter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp),0,tp,tp,false,false,POS_FACEUP) end end function s.ffilter(c,fc,sub,mg,sg) return c:IsFusionSetCard(0x7c4) and (not sg or sg:FilterCount(aux.TRUE,c)==0 or sg:IsExists(s.fcheck,1,c,c:GetAttack())) end function s.fcheck(c,atk) local dif=math.abs(c:GetAttack()-atk) return dif>0 and dif<=400 end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.SelectEffectYesNo(tp,e:GetOwner()) then Duel.Hint(HINT_CARD,0,id) Duel.NegateAttack() end end function s.tgfilter(c) return c:IsFaceup() and c:IsSetCard(0x7c4) and c:IsLevelBelow(5) end function s.tgcon(e) return Duel.IsExistingMatchingCard(s.tgfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.etarget(e,re) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) return g and g:IsContains(e:GetHandler()) end function s.filter(c,tp) return c:IsPreviousLocation(LOCATION_MZONE) and (c:IsPreviousPosition(POS_FACEUP) or c:GetPreviousControler()==tp) and c:IsPreviousSetCard(0x7c4) end function s.acop(e,tp,eg,ep,ev,re,r,rp) local ct=eg:FilterCount(s.filter,e:GetHandler(),tp) if ct>0 then e:GetHandler():AddCounter(0x921,ct,true) end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local sg=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil) Duel.Destroy(sg,REASON_EFFECT) end