--ShortRAT --Scripted by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,nil,1,2) c:EnableReviveLimit() --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END+TIMING_BATTLE_START+TIMING_BATTLE_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(cid.sptg) e1:SetOperation(cid.spop) c:RegisterEffect(e1) --immune local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetCost(cid.cost) e2:SetOperation(cid.operation) c:RegisterEffect(e2) end --SPSUMMON function cid.spfilter(c,e,tp) return c:IsType(TYPE_XYZ) and c:IsCode(55935416) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_XMATERIAL) and Duel.IsExistingMatchingCard(cid.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) if not aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_XMATERIAL) then return end local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,cid.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() if tc then if Duel.SpecialSummon(tc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)~=0 then if c:IsRelateToEffect(e) then if c:GetOverlayCount()>0 then Duel.Overlay(tc,c:GetOverlayGroup()) end Duel.Overlay(tc,c) end tc:CompleteProcedure() end end end --IMMUNE function cid.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function cid.operation(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(cid.etarget) e1:SetValue(cid.efilter) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCountLimit(1) e2:SetOperation(cid.tgop) e2:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e2,tp) end function cid.etarget(e,c) return c:IsType(TYPE_XYZ) and c:IsRank(1) end function cid.efilter(e,te,c) return te:GetOwnerPlayer()~=e:GetHandlerPlayer() end function cid.tgfilter(c) return c:IsType(TYPE_XYZ) and c:IsAbleToGrave() and not c:IsCode(id,55935416) end function cid.tgop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(cid.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #g<=0 then return end Duel.Hint(HINT_CARD,0,id) Duel.SendtoGrave(g,REASON_EFFECT) end