--created by ZEN, coded by TaxingCorn117 local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(math.floor(id/100),0)) e1:SetCategory(CATEGORY_DICE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(math.floor(id/100),2)) e3:SetCategory(CATEGORY_REMOVE) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,id+17) e3:SetCondition(s.rmcon) e3:SetCost(aux.bfgcost) e3:SetTarget(s.rmtg) e3:SetOperation(s.rmop) c:RegisterEffect(e3) if s.counter==nil then s.counter=true s[0]=0 s[1]=0 local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EVENT_PHASE_START+PHASE_DRAW) e2:SetOperation(s.resetcount) Duel.RegisterEffect(e2,0) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetCode(EVENT_DAMAGE) e3:SetOperation(s.addcount) Duel.RegisterEffect(e3,0) end end function s.resetcount(e,tp,eg,ep,ev,re,r,rp) s[0]=0 s[1]=0 end function s.addcount(e,tp,eg,ep,ev,re,r,rp) s[ep]=s[ep]+1 end function s.spfilter(c,e,tp,lv) return c:IsSetCard(0x52f) and c:IsLevel(lv) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,100) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_DECK+LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local dc=Duel.TossDice(tp,1) local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK+LOCATION_HAND,0,nil,e,tp,dc) if Duel.Damage(tp,dc*100,REASON_EFFECT)~=0 and Duel.GetLP(tp)>0 and #g>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return s[tp]>2 end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) local exc=nil if e:IsHasType(EFFECT_TYPE_ACTIVATE) then exc=e:GetHandler() end local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,exc) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local exc=nil if e:IsHasType(EFFECT_TYPE_ACTIVATE) then exc=e:GetHandler() end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,exc) if #g>0 then Duel.HintSelection(g) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end