--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 e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id*10) e1:SetTarget(cid.atktg) e1:SetOperation(cid.atkop) c:RegisterEffect(e1) 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+EFFECT_FLAG_DELAY) 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.atkfilter(c,g) return c:IsFaceup() and c:GetAttack()>0 and c:IsSetCard(0xff2) end function cid.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local c=e:GetHandler() if chk==0 then return Duel.IsExistingTarget(cid.atkfilter,tp,LOCATION_MZONE,0,1,c) and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF) local g=Duel.SelectTarget(tp,cid.atkfilter,tp,LOCATION_MZONE,0,1,1,c) e:SetLabelObject(g:GetFirst()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPPO) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) end function cid.atkop(e,tp,eg,ep,ev,re,r,rp) local tc1=e:GetLabelObject() local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local tc2=g:GetFirst() if tc1==tc2 then tc2=g:GetNext() end if tc1:IsFaceup() and tc1:IsControler(tp) and tc1:IsSetCard(0xff2) and tc1:IsRelateToEffect(e) and tc2:IsFaceup() and tc2:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-tc1:GetAttack()) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc2:RegisterEffect(e1) end 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