--Linkionista --Scripted by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddLinkProcedure(c,nil,2,2,s.lcheck) --extra material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_EXTRA_LINK_MATERIAL) e1:SetRange(LOCATION_EXTRA) e1:SetTargetRange(LOCATION_HAND,0) e1:SetTarget(s.extramats) e1:SetValue(s.matval) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,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) e2:SetCountLimit(1,id) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_MATERIAL_CHECK) e3:SetValue(s.valcheck) e3:SetLabelObject(e2) c:RegisterEffect(e3) --protection local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_BE_MATERIAL) e4:SetCountLimit(1,id+100) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end function s.lcheck(g,lc) return g:IsExists(s.matfilter,1,nil) end function s.matfilter(c) return c:IsLinkType(TYPE_NORMAL) and c:IsLinkRace(RACE_FAIRY+RACE_BEAST) end function s.extramats(e,c) return c:IsLinkType(TYPE_NORMAL) end function s.matval(e,lc,mg,c,tp) if e:GetHandler()~=lc then return false,nil end return true,true end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function s.filter(c,e,tp) return c:IsCode(1641882) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetLabel()>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local ft=e:GetLabel() if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_EXTRA,0,1,ft,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.valcheck(e,c) local g=c:GetMaterial() if not g then e:SetLabel(0) else local ct=g:FilterCount(Card.IsLinkType,nil,TYPE_NORMAL) e:GetLabelObject():SetLabel(ct) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return r&(REASON_FUSION+REASON_LINK)>0 end function s.spf(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) and not c:IsType(TYPE_EFFECT) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.spf(chkc) end if chk==0 then return Duel.IsExistingTarget(s.spf,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.spf,tp,LOCATION_MZONE,0,1,1,nil) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_GRAVE,0,nil) if #g<=0 then return end for fc in aux.Next(g) do fc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_OVERLAY,0,1) end local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetCondition(s.discon) e1:SetValue(s.efilter) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) end end function s.cfilter(c) return c:IsType(TYPE_MONSTER) and c:IsType(TYPE_NORMAL) end function s.cfilter2(c) return s.cfilter(c) and c:GetFlagEffect(id)~=0 end function s.cfilter3(c) return s.cfilter(c) and c:GetFlagEffect(id)==0 end function s.discon(e) local g=Duel.GetMatchingGroup(s.cfilter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,nil) if g:IsExists(s.cfilter2,1,nil) then local ng=g:Filter(s.cfilter3,nil) for tc in aux.Next(ng) do tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_OVERLAY,0,1) end return true end e:Reset() return false end function s.efilter(e,re) return re:IsActiveType(TYPE_MONSTER) and re:GetOwnerPlayer()~=e:GetOwnerPlayer() end