--Sovraccarica Puntodifuoco --Script by XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAIN_NEGATED) e1:SetCountLimit(1,id) e1:SetLabel(10) e1:SetCondition(cid.condition) e1:SetTarget(cid.target) e1:SetOperation(cid.activate) c:RegisterEffect(e1) local e1x=e1:Clone() e1x:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e1x:SetCode(EVENT_CUSTOM+id) e1x:SetLabel(11) c:RegisterEffect(e1x) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(aux.bfgcost) e2:SetTarget(cid.sptg) e2:SetOperation(cid.spop) c:RegisterEffect(e2) --check disabled chain if not cid.global_check then cid.global_check=true local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_CHAIN_DISABLED) ge1:SetOperation(cid.checkop) Duel.RegisterEffect(ge1,0) end end --check disabled chain function cid.checkop(e,tp,eg,ep,ev,re,r,rp) if ep==tp then return end local dp=Duel.GetChainInfo(ev,CHAININFO_DISABLE_PLAYER) if not (re:IsActiveType(TYPE_MONSTER) or re:IsHasType(EFFECT_TYPE_ACTIVATE)) then return end Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,dp,ep,0) end --filters function cid.filter(c,e,tp) return c:IsSetCard(0xb05) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end --Activate function cid.condition(e,tp,eg,ep,ev,re,r,rp) if e:GetLabel()==10 then local dp=Duel.GetChainInfo(ev,CHAININFO_DISABLE_PLAYER) return ep~=tp and dp~=tp and (re:IsActiveType(TYPE_MONSTER) or re:IsHasType(EFFECT_TYPE_ACTIVATE)) else return ep~=tp and rp==tp end end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cid.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function cid.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cid.filter),tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.HintSelection(g) if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetValue(aux.tgoval) g:GetFirst():RegisterEffect(e1) g:GetFirst():RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2)) end end end --special summon function cid.cfilter(c,e,tp) return c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_EFFECT+REASON_BATTLE) and c:IsPreviousSetCard(0xb05) and c:GetBaseAttack()>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and eg:IsExists(cid.cfilter,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=eg:FilterSelect(tp,cid.cfilter,1,1,nil,e,tp) if g:GetCount()>0 then Duel.HintSelection(g) if Duel.SpecialSummonStep(g:GetFirst(),0,tp,tp,false,false,POS_FACEUP)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) g:GetFirst():RegisterEffect(e1) end end end