--created by Dragonecro, coded by Lyris local cid,id=GetID() function cid.initial_effect(c) c:EnableReviveLimit() aux.AddFusionProcFun2(c,cid.mfilter,aux.FilterBoolFunction(Card.IsRace,RACE_MACHINE),false) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(cid.splimit) 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:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id*10) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCategory(CATEGORY_DESTROY) e3:SetTarget(cid.destg) e3:SetOperation(cid.desop) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_DESTROY) e4:SetCountLimit(1,id*10+1) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetCondition(function(e) return e:GetHandler():IsReason(REASON_EFFECT+REASON_BATTLE) end) e4:SetTarget(cid.tg) e4:SetOperation(cid.op) c:RegisterEffect(e4) end function cid.mfilter(c) return c:IsFusionSetCard(0xff2) and c:IsRace(RACE_MACHINE) end function cid.splimit(e,se,sp,st) return not e:GetHandler():IsLocation(LOCATION_EXTRA) or st&SUMMON_TYPE_FUSION==SUMMON_TYPE_FUSION 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.cfilter(c) return c:IsLevelAbove(5) and c:IsSetCard(0xff2) and c:IsFaceup() end function cid.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end local ct=Duel.GetMatchingGroupCount(cid.cfilter,tp,LOCATION_MZONE,0,nil) if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) and ct>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function cid.dfilter(c,e,tp) return c:IsRelateToEffect(e) and c:IsControler(tp) end function cid.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(cid.dfilter,nil,e,1-tp) Duel.Destroy(g,REASON_EFFECT) end function cid.sfilter(c,e,tp) return c:IsLevel(4) and c:IsSetCard(0xff2) 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.sfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND) end function cid.op(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end if ft>=2 then ft=2 end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cid.sfilter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,ft,nil,e,tp) if #g>0 then local t1=g:GetFirst() local t2=g:GetNext() Duel.SpecialSummonStep(t1,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(function(e,re) return e:GetOwnerPlayer()~=re:GetOwnerPlayer() end) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,2) e1:SetOwnerPlayer(tp) t1:RegisterEffect(e1) if t2 then Duel.SpecialSummonStep(t2,0,tp,tp,false,false,POS_FACEUP) local e2=e1:Clone() t2:RegisterEffect(e2) end Duel.SpecialSummonComplete() end end