--ZW - Circuit Halo --Automate ID local s,id=GetID() function s.initial_effect(c) --link summon c:EnableReviveLimit() aux.AddLinkProcedure(c,s.matfilter,1,1) --equip local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --salvage local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetCategory(CATEGORY_SPECIAL_SUMMON|CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.matfilter(c) return c:IsLinkSetCard(ARCHE_ZW) and not c:IsLinkCode(id) end function s.eqfilter(c) return c:IsFaceup() and c:IsSetCard(ARCHE_UTOPIA) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.eqfilter(chkc) end local c=e:GetHandler() if chk==0 then return not c:IsForbidden() and c:CheckUniqueOnField(tp,LOCATION_SZONE) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.eqfilter,tp,LOCATION_MZONE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.eqfilter,tp,LOCATION_MZONE,0,1,1,c) Duel.SetCardOperationInfo(c,CATEGORY_EQUIP) if c:IsInGY() then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,tp,0) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToChain() or not c:IsLocation(LOCATION_MZONE) or c:IsFacedown() then return end local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or not tc:IsRelateToChain() or not tc:IsControler(tp) or not s.eqfilter(tc) then Duel.SendtoGrave(c,REASON_EFFECT) return end if not Duel.Equip(tp,c,tc) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) e1:SetLabelObject(tc) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(500) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) end function s.eqlimit(e,c) return c==e:GetLabelObject() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local ec=eg:GetFirst() local bc=ec:GetBattleTarget() return ec==e:GetHandler():GetEquipTarget() and ec:IsStatus(STATUS_OPPO_BATTLE) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetCardOperationInfo(c,CATEGORY_SPECIAL_SUMMON) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_ONFIELD) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToChain() or c:IsFacedown() or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,nil) if #g>0 and Duel.SelectYesNo(tp,STRING_ASK_SEND_TO_GY) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sg=g:Select(tp,1,1,nil) if #sg>0 then Duel.HintSelection(sg) Duel.SendtoGrave(sg,REASON_EFFECT) end end end end