--UZW - Utopic Lancer --Automate ID local s,id=GetID() function s.initial_effect(c) --xyz summon c:EnableReviveLimit() aux.AddXyzProcedureLevelFree(c,s.mfilter,s.xyzcheck,2,2) --xyzlv local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_XYZ_LEVEL) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.xyzlv) c:RegisterEffect(e1) --special summon local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCost(s.hspcost) e1:SetTarget(s.hsptg) e1:SetOperation(s.hspop) c:RegisterEffect(e1) --indes local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_REMOVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET|EFFECT_FLAG_DELAY) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) --atkup local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetValue(1500) c:RegisterEffect(e3) end function s.xyzlv(e,c,rc) if rc:IsXyzType(TYPE_XYZ) and rc:IsSetCard(ARCHE_UTOPIA) then return e:GetHandler():GetRank() else return 0 end end function s.mfilter(c,xyzc) return c:IsXyzLevel(xyzc,4) end function s.xyzcheck(g) return g:IsExists(Card.IsSetCard,1,nil,ARCHE_ZW) end function s.rfilter(c) return c:IsFaceupEx() and c:IsSetCard(ARCHE_ZW) and c:IsMonster() and c:IsAbleToRemoveAsCost() end function s.gcheck(g,e,tp) return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,g,e,tp,g) end function s.spfilter(c,e,tp,g) return c:IsMonster(TYPE_XYZ) and c:IsSetCard(ARCHE_UTOPIA) and c:IsRank(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,g,c)>0 end function s.hspcost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.Group(s.rfilter,tp,LOCATION_HAND|LOCATION_MZONE|LOCATION_GRAVE,0,nil) if chk==0 then return g:CheckSubGroup(s.gcheck,2,2,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rg=g:SelectSubGroup(tp,s.gcheck,false,2,2,e,tp) Duel.Remove(rg,POS_FACEUP,REASON_COST) end function s.hsptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:IsCostChecked() or Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.hspop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,nil) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end 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 (c:IsLocation(LOCATION_MZONE) and c:IsFacedown()) then return end local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or not tc:IsRelateToChain() 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) end function s.eqlimit(e,c) return c==e:GetLabelObject() end