--Stardust Knight of the Signer Dragon local cid,id=GetID() function cid.initial_effect(c) --synchro custom local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCondition(cid.syncon) e1:SetTarget(cid.syntg) e1:SetValue(1) e1:SetOperation(cid.synop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND+LOCATION_GRAVE) e2:SetCondition(cid.spcon) e2:SetTarget(cid.sptg) e2:SetOperation(cid.spop) e2:SetCountLimit(1,id) c:RegisterEffect(e2) --hand synchro local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM) e3:SetCondition(cid.syncon) e3:SetCode(EFFECT_HAND_SYNCHRO) e3:SetTargetRange(0,1) c:RegisterEffect(e3) --tuner local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e4:SetCost(cid.descost) e4:SetTarget(cid.destg) e4:SetOperation(cid.desop) c:RegisterEffect(e4) end --SYNCHRO CUSTOM function cid.synfilter(c,syncard,tuner,f) return (c:IsFaceup() or (syncard:IsRace(RACE_DRAGON) and syncard:IsSetCard(0xcd01) and c:IsLocation(LOCATION_HAND))) and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard)) end function cid.syncheck(c,g,mg,tp,lv,syncard,minc,maxc) g:AddCard(c) local ct=g:GetCount() local res=cid.syngoal(g,tp,lv,syncard,minc,ct) or (ct=minc and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard) and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0 and g:FilterCount(Card.IsLocation,nil,LOCATION_HAND)<=1 end function cid.syncon(e) local c=e:GetHandler() return c:IsOnField() and c:IsFaceup() end function cid.syntg(e,syncard,f,min,max) local minc=min+1 local maxc=max+1 local c=e:GetHandler() local tp=syncard:GetControler() local lv=syncard:GetLevel() if lv<=c:GetLevel() then return false end local g=Group.FromCards(c) local mg=Duel.GetMatchingGroup(cid.synfilter,tp,LOCATION_MZONE+LOCATION_HAND,LOCATION_MZONE,c,syncard,c,f) return mg:IsExists(cid.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc) end function cid.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max) local minc=min+1 local maxc=max+1 local c=e:GetHandler() local lv=syncard:GetLevel() local g=Group.FromCards(c) local mg=Duel.GetMatchingGroup(cid.synfilter,tp,LOCATION_MZONE+LOCATION_HAND,LOCATION_MZONE,c,syncard,c,f) for i=1,maxc do local cg=mg:Filter(cid.syncheck,g,g,mg,tp,lv,syncard,minc,maxc) if cg:GetCount()==0 then break end local minct=1 if cid.syngoal(g,tp,lv,syncard,minc,i) then minct=0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL) local sg=cg:Select(tp,minct,1,nil) if sg:GetCount()==0 then break end g:Merge(sg) end Duel.SetSynchroMaterial(g) end ----- --SPSUMMON function cid.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1,true) end end --TUNER function cid.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) end function cid.filter(c) return c:IsFaceup() and c:GetLevel()>0 and not c:IsType(TYPE_TUNER) end function cid.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and cid.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(cid.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,cid.filter,tp,LOCATION_MZONE,0,1,1,nil) end function cid.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and cid.filter(tc) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) e1:SetValue(TYPE_TUNER) tc:RegisterEffect(e1) end end