--created by Hoshi, coded by Lyris local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0xcda),2,2) c:SetUniqueOnField(1,0,id) aux.AddCodeList(c,id-10) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCondition(function(e,tp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) and not Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceup,Card.IsCode),tp,LOCATION_ONFIELD,0,1,nil,id-10) end) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCategory(CATEGORY_EQUIP) e2:SetCondition(function(e,tp,eg) return eg:IsExists(aux.AND(Card.IsFaceup,Card.IsCode),1,nil,id-10) end) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) local e4=e2:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_EQUIP) e0:SetCode(EFFECT_IMMUNE_EFFECT) e0:SetCondition(function(e) return e:GetHandler():GetEquipTarget():IsCode(id-10) end) e0:SetValue(function(e,te) return te:IsActiveType(TYPE_MONSTER) and e:GetHandlerPlayer()~=te:GetOwnerPlayer() end) c:RegisterEffect(e0) end function s.filter(c,e,tp) return c:IsCode(id-10) 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 Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND) if Duel.IsPlayerAffectedByEffect(tp,id+4) then Duel.SetChainLimit(function(e,rpr,p) return rpr==p end) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.SpecialSummon(Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil,e,tp),0,tp,tp,false,false,POS_FACEUP) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local g=c:GetLinkedGroup():Filter(aux.AND(Card.IsSetCard,aux.NOT(Card.IsForbidden)),nil,0xcda)+c if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>=#g and Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceup,Card.IsCode),tp,LOCATION_MZONE,0,1,nil,id-10) and #g>0 and not c:IsForbidden() end Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,#g,0,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local sg=e:GetHandler():GetLinkedGroup():Filter(aux.AND(Card.IsSetCard,aux.NOT(Card.IsForbidden)),nil,0xcda)+c if not c:IsRelateToEffect(e) or c:IsForbidden() or Duel.GetLocationCount(tp,LOCATION_SZONE)<#sg or #sg==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local tc=Duel.SelectMatchingCard(tp,aux.AND(Card.IsFaceup,Card.IsCode),tp,LOCATION_MZONE,0,1,1,nil,id-10):GetFirst() if not tc then return end for sc in aux.Next(sg) do if Duel.Equip(tp,sc,tc,true,true) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetValue(function(ef,cc) return cc==tc end) sc:RegisterEffect(e1) end end Duel.EquipComplete() end