--created by Dragonecro, coded by Slient Knight local cid,id=GetID() function cid.initial_effect(c) local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetCategory(CATEGORY_SPECIAL_SUMMON) e0:SetType(EFFECT_TYPE_IGNITION) e0:SetRange(LOCATION_GRAVE) e0:SetCountLimit(1,id*10) e0:SetCost(aux.bfgcost) e0:SetTarget(cid.sptg) e0:SetOperation(cid.spop) c:RegisterEffect(e0) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id*10+1) e1:SetTarget(cid.target) e1:SetOperation(cid.operation) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetRange(LOCATION_MZONE) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetValue(cid.atkval) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e5) end function cid.spfilter(c,e,tp) return c:IsSetCard(0xff2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(id) 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_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,cid.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(cid.splimit) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function cid.splimit(e,c) return not c:IsRace(RACE_MACHINE) end function cid.filter(c) return c:IsSetCard(0xff2) and c:IsAbleToGrave() end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function cid.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,cid.filter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoGrave(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function cid.cfilter(c) return c:IsRace(RACE_MACHINE) end function cid.atkval(e,c) return Duel.GetMatchingGroupCount(cid.cfilter,0,LOCATION_GRAVE+LOCATION_MZONE,LOCATION_GRAVE+LOCATION_MZONE,nil)*100 end