--Geargiagantic Geargigant XGL-30 --Script by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --xyz summon aux.AddXyzProcedureLevelFree(c,cid.mfilter,cid.xyzcheck,2,99,cid.ovfilter,aux.Stringid(id,0)) c:EnableReviveLimit() --indes local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetCondition(cid.indcon) e1:SetValue(1) c:RegisterEffect(e1) local e1x=e1:Clone() e1x:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e1x) --set local e2=Effect.CreateEffect(c) e2:GLString(1) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCost(cid.setcost) e2:SetTarget(cid.settg) e2:SetOperation(cid.setop) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:GLString(2) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id+100) e3:SetCondition(cid.qcon0) e3:SetCost(cid.spcost) e3:SetTarget(cid.sptg) e3:SetOperation(cid.spop) c:RegisterEffect(e3) local e3x=e3:Clone() e3x:SetType(EFFECT_TYPE_QUICK_O) e3x:SetCode(EVENT_FREE_CHAIN) e3x:SetCondition(cid.qcon) c:RegisterEffect(e3x) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,aux.FilterBoolFunction(Card.IsRace,RACE_MACHINE)) end function cid.mfilter(c,xyzc) return c:IsRace(RACE_MACHINE) and c:IsXyzLevel(xyzc,4) end function cid.xyzcheck(g) return g:IsExists(Card.IsAttribute,1,nil,ATTRIBUTE_EARTH) end function cid.ovfilter(c) return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsRace(RACE_MACHINE) and not c:IsCode(id) end --INDES function cid.indcon(e) local g=e:GetHandler():GetOverlayGroup() return g and #g>0 end --SET function cid.filter(c) return c:IsSetCard(0x72) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable() end function cid.setcost(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.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(cid.filter,tp,LOCATION_DECK,0,1,nil) end end function cid.setop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,cid.filter,tp,LOCATION_DECK,0,1,1,nil) local tc=g:GetFirst() if tc and Duel.SSet(tp,tc)~=0 then if tc:IsType(TYPE_QUICKPLAY) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetCode(EFFECT_QP_ACT_IN_SET_TURN) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) end if tc:IsType(TYPE_TRAP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) end end end --SPSUMMON function cid.excfilter(c) return not c:IsType(TYPE_MONSTER) or not c:IsSetCard(0x72) end function cid.qcon(e,tp,eg,ep,ev,re,r,rp) return #e:GetHandler():GetOverlayGroup()>0 and not e:GetHandler():GetOverlayGroup():IsExists(cid.excfilter,1,nil) end function cid.qcon0(e,tp,eg,ep,ev,re,r,rp) return not cid.qcon(e,tp,eg,ep,ev,re,r,rp) end function cid.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,2,REASON_COST) and Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end e:GetHandler():RemoveOverlayCard(tp,2,2,REASON_COST) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetTarget(cid.splimit) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function cid.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsRace(RACE_MACHINE) end function cid.spfilter(c,e,tp) return c:IsSetCard(0x1072) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) 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 Duel.IsExistingMatchingCard(cid.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,PLAYER_ALL,LOCATION_ONFIELD) end function cid.ctfilter(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetLocationCount(tp,LOCATION_MZONE) local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cid.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,nil,e,tp) if ct<=0 or g:GetCount()==0 then return end ct=math.min(ct,g:GetClassCount(Card.GetCode)) if Duel.IsPlayerAffectedByEffect(tp,59822133) then ct=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:SelectSubGroup(tp,aux.dncheck,false,ct,ct) if sg and sg:GetCount()>0 then local ct=Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) if ct<=0 then return end local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,ct,nil) if #g<=0 then return end Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end