--Extra Gear --Script by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:GLString(0) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH) e1:SetTarget(cid.target) e1:SetOperation(cid.activate) c:RegisterEffect(e1) --equip limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_EQUIP_LIMIT) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetValue(1) c:RegisterEffect(e2) --disable local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_DISABLE) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(0,LOCATION_ONFIELD) e3:SetTarget(cid.distg) c:RegisterEffect(e3) --disable effect local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_CHAIN_SOLVING) e4:SetRange(LOCATION_SZONE) e4:SetOperation(cid.disop) c:RegisterEffect(e4) --spsummon local e5=Effect.CreateEffect(c) e5:GLString(1) e5:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_SZONE) e5:SetTarget(cid.sptg) e5:SetOperation(cid.spop) c:RegisterEffect(e5) --grant effect local e6=Effect.CreateEffect(c) e6:GLString(2) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetProperty(EFFECT_FLAG_DELAY) e6:SetCode(EVENT_TO_GRAVE) e6:SetCondition(cid.ctcon) e6:SetTarget(cid.cttg) e6:SetOperation(cid.ctop) c:RegisterEffect(e6) end --ACTIVATE function cid.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function cid.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,e:GetHandler(),tc) end end --DISABLE function cid.distg(e,c) if not e:GetHandler():GetEquipTarget() or c:GetControler()==e:GetHandlerPlayer() or c:GetCardTargetCount()==0 then return false end return c:GetCardTarget():IsContains(e:GetHandler():GetEquipTarget()) end function cid.disop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():GetEquipTarget() or rp==tp then return end if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if not g or g:GetCount()==0 then return end if g:IsContains(e:GetHandler():GetEquipTarget()) then Duel.NegateEffect(ev) end end --SPSUMMON function cid.spfilter(c,e,tp,attr) return c:IsType(TYPE_MONSTER) and c:IsRace(RACE_MACHINE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsAttribute(attr) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local ec=c:GetEquipTarget() if chk==0 then return c:IsDestructable(e) and ec:IsDestructable(e) and ((ec:IsControler(1-tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0) or Duel.GetMZoneCount(tp,c)>0) and Duel.IsExistingMatchingCard(cid.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp,ec:GetAttribute()) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,Group.FromCards(c,ec),2,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ec=c:GetEquipTarget() if not c:IsRelateToEffect(e) or not ec then return end local attr=ec:GetAttribute() if Duel.Destroy(Group.FromCards(c,ec),REASON_EFFECT)==2 then 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.spfilter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp,attr) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end --GRANT EFFECT function cid.ctcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ec=c:GetPreviousEquipTarget() return ec and ec:GetReasonCard() and c:IsReason(REASON_LOST_TARGET) and ec:IsReason(REASON_MATERIAL) and ec:GetReasonCard():IsType(TYPE_EXTRA) end function cid.cttg(e,tp,eg,ep,ev,re,r,rp,chk) local ec=e:GetHandler():GetPreviousEquipTarget() local rc=ec:GetReasonCard() if chk==0 then return true end rc:CreateEffectRelation(e) end function cid.ctop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ec=c:GetPreviousEquipTarget() local rc=ec:GetReasonCard() if rc and rc:IsRelateToEffect(e) then --disable local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,3)) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_CLIENT_HINT) e3:SetCode(EFFECT_DISABLE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(0,LOCATION_ONFIELD) e3:SetTarget(cid.distg2) e3:SetReset(RESET_EVENT+RESETS_STANDARD) rc:RegisterEffect(e3) --disable effect local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_CHAIN_SOLVING) e4:SetRange(LOCATION_MZONE) e4:SetOperation(cid.disop2) e4:SetReset(RESET_EVENT+RESETS_STANDARD) rc:RegisterEffect(e4) end end function cid.distg2(e,c) if c:GetControler()==e:GetOwner():GetOwner() or c:GetCardTargetCount()==0 then return false end return c:GetCardTarget():IsContains(e:GetHandler()) end function cid.disop2(e,tp,eg,ep,ev,re,r,rp) if rp==e:GetOwner():GetOwner() then return end if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if not g or g:GetCount()==0 then return end if g:IsContains(e:GetHandler()) then if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(re:GetHandler(),REASON_EFFECT) end end end