--Leggenda Bushido Chupacabra --Script by: XGlitchy30 local s,id,o=GetID() function s.initial_effect(c) --protection c:UnaffectedProtection(s.unval) --summon proc local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(s.otcon) e1:SetOperation(s.otop) e1:SetValue(SUMMON_TYPE_ADVANCE+1) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DDD) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCondition(s.descon) e2:SetCost(aux.AttackRestrictionCost(true,nil,2)) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --target local e3=c:DestroysByBattleTrigger(false,nil,3,CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_ACTION+CATEGORY_GRAVE_SPSUMMON,EFFECT_FLAG_CARD_TARGET,true, nil, nil, aux.Target(s.filter,LOCATION_GB,0,1,1,nil), s.thop ) local e4=e3:Clone() e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DDD) e4:SetCode(EVENT_TO_GRAVE) e4:SetCondition(aux.TRUE) c:RegisterEffect(e4) end function s.unval(e,te) return te:IsActiveType(TYPE_MONSTER) and te:GetOwnerPlayer()~=e:GetHandlerPlayer() and (te:GetOwner():IsSummonType(SUMMON_TYPE_SPECIAL) or te:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL)) end function s.otfilter(c,tp) return c:IsSetCard(0x4b0) and (c:IsControler(tp) or c:IsFaceup()) end function s.otcon(e,c,minc) if c==nil then return true end local tp=c:GetControler() local mg=Duel.GetMatchingGroup(s.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp) return c:IsLevelAbove(7) and minc<=1 and Duel.CheckTribute(c,1,1,mg) end function s.otop(e,tp,eg,ep,ev,re,r,rp,c) local mg=Duel.GetMatchingGroup(s.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp) local sg=Duel.SelectTribute(tp,c,1,1,mg) c:SetMaterial(sg) Duel.Release(sg,REASON_SUMMON+REASON_MATERIAL) end function s.descon(e,tp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_ADVANCE+1 end function s.desfilter(c) return c:IsSummonType(SUMMON_TYPE_SPECIAL) and c:HasLevel() and c:IsLevelBelow(7) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.desfilter,tp,0,LOCATION_MZONE,1,nil) end local sg=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,1-tp,LOCATION_MZONE) Duel.SetCustomOperationInfo(0,CATEGORY_ATKCHANGE,e:GetHandler(),1,tp,LOCATION_MZONE,300) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local sg=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil) if #sg>0 and Duel.Destroy(sg,REASON_EFFECT)>0 and c:IsRelateToChain() and c:IsFaceup() then c:UpdateATK(300,true) end end function s.filter(c,e,tp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) return c:IsMonster() and c:IsSetCard(0x4b0) and c:IsLevel(4) and c:NotBanishedOrFaceup() and (c:IsAbleToHand() or (ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local sc=Duel.GetFirstTarget() if not sc or not sc:IsRelateToChain() then return end aux.ToHandOrElse(sc,tp, function(sc) return ft>0 and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) end, function(sc) return Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end, aux.Stringid(id,5)) end