--created by Dragonecro, coded by Lyris local cid,id=GetID() function cid.initial_effect(c) c:EnableReviveLimit() aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_MACHINE),2,2) local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetRange(LOCATION_EXTRA) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.linklimit) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetValue(cid.val) c:RegisterEffect(e2) local e0=e2:Clone() e0:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e0) local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id*10) e3:SetCost(cid.sumcost) e3:SetTarget(cid.sumtg) e3:SetOperation(cid.sumop) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_TO_GRAVE) e4:SetCountLimit(1,id*10+1) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetCost(aux.bfgcost) e4:SetTarget(cid.tg) e4:SetOperation(cid.op) c:RegisterEffect(e4) end function cid.filter(c) return c:IsRace(RACE_MACHINE) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) end function cid.val(e,c) return Duel.GetMatchingGroupCount(cid.filter,0,0x14,LOCATION_ONFIELD,nil)*200 end function cid.scfilter(c) return c:IsSetCard(0xff2) and c:IsAbleToRemoveAsCost() end function cid.sumcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.scfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,cid.scfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function cid.sfilter(c) return c:IsSetCard(0xff2) and c:IsSummonable(true,nil) end function cid.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.sfilter,tp,LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) end function cid.sumop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local g=Duel.SelectMatchingCard(tp,cid.sfilter,tp,LOCATION_HAND,0,1,1,nil) if #g>0 then Duel.Summon(tp,g:GetFirst(),true,nil) end end function cid.spfilter(c,e,tp) return c:IsSetCard(0xff2) and c:IsLevelBelow(6) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cid.tg(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_DECK+LOCATION_GRAVE+LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_HAND) end function cid.op(e,tp,eg,ep,ev,re,r,rp) 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_DECK+LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end