--Automate ID local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) e1:SetCountLimit(1,id) c:RegisterEffect(e1) --damage local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_HANDES) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(s.condition1) e2:SetCost(aux.bfgcost) e2:SetTarget(s.target1) e2:SetOperation(s.operation1) e2:SetCountLimit(1,id+1000) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(0x301) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,2,nil) end function s.filter(c) return c:IsFaceup() and c:IsSetCard(0x301) and c:IsLevelAbove(0) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) if chkc then return g:IsContains(chkc) end if chk==0 then return #g>0 end if g:GetClassCount(Card.GetLevel)==1 then ex=g:GetFirst():GetLevel() end Duel.Hint(HINT_SELECTMSG,tp,HINGMSG_LVRANK) local lv=Duel.AnnounceLevel(tp,1,4,ex) e:SetLabel(lv) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) local lv=e:GetLabel() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(lv) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) e3:SetValue(s.matlimit) e3:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_CANNOT_BE_TIMELEAP_MATERIAL) tc:RegisterEffect(e4) end end function s.matlimit(e,c) if not c then return false end return not c:IsSetCard(0x301) end function s.sfilter(c,tp) return c:IsFaceup() and c:IsSetCard(0x301) and c:IsSummonType(SUMMON_TYPE_SYNCHRO) and c:GetReasonPlayer()==tp end function s.condition1(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.sfilter,1,nil,tp) end function s.target1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)~=0 end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) end function s.operation1(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):RandomSelect(tp,1) Duel.SendtoGrave(g,REASON_EFFECT+REASON_DISCARD) end