--Macchina da Guerra Finale di Elyria --Script by XGlitchy30 function c38648114.initial_effect(c) --link summon aux.AddLinkProcedure(c,nil,2,99,c38648114.lcheck) c:EnableReviveLimit() --protection local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetValue(1) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(38648114,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) e2:SetCondition(c38648114.spcon) e2:SetTarget(c38648114.sptg) e2:SetOperation(c38648114.spop) c:RegisterEffect(e2) --cannot attack local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_CANNOT_ATTACK) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e3:SetTarget(c38648114.atklimit) c:RegisterEffect(e3) --extra attack local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_EXTRA_ATTACK) e4:SetValue(c38648114.extraatk) c:RegisterEffect(e4) end --filters function c38648114.lcheck(g,lc) return g:IsExists(Card.IsType,1,nil,TYPE_NORMAL) end function c38648114.spfilter(c,e,tp,zone) return c:IsSetCard(0xe841) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end function c38648114.extrafilter(c,g) return c:IsType(TYPE_NORMAL) and g:IsContains(c) end --special summon function c38648114.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function c38648114.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local zone=e:GetHandler():GetLinkedZone(tp) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c38648114.spfilter(chkc,e,tp,zone) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c38648114.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,aux.NecroValleyFilter(c38648114.spfilter),tp,LOCATION_GRAVE,0,1,1,nil,e,tp,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c38648114.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local zone=c:GetLinkedZone(tp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone) end end --cannot attack function c38648114.atklimit(e,c) return c:IsType(TYPE_NORMAL) and e:GetHandler():GetLinkedGroup():IsContains(c) end --extra attack function c38648114.extraatk(e,c) local lgroup=e:GetHandler():GetLinkedGroup() return Duel.GetMatchingGroupCount(c38648114.extrafilter,c:GetControler(),LOCATION_MZONE,LOCATION_MZONE,nil,lgroup) end