--created by Swag, coded by Lyris local s,id=GetID() function s.initial_effect(c) aux.AddOrigPandemoniumType(c) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,0) e2:SetTarget(s.splimit) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetCondition(aux.PandActCheck) e3:SetTarget(s.target) e3:SetOperation(s.activate) c:RegisterEffect(e3) aux.EnablePandemoniumAttribute(c,e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e4:SetCode(EVENT_TO_GRAVE) e4:SetCountLimit(1,id) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e4:SetCategory(CATEGORY_DAMAGE+CATEGORY_SPECIAL_SUMMON) e4:SetTarget(s.tg) e4:SetOperation(s.op) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_GRAVE) e5:SetCountLimit(1,id+EFFECT_COUNT_CODE_DUEL) e5:SetCategory(CATEGORY_DESTROY) e5:SetCost(s.cost) e5:SetTarget(s.destg) e5:SetOperation(s.operation) c:RegisterEffect(e5) end function s.splimit(e,c,sump,sumtype,sumpos,targetp) if c:IsRace(RACE_DINOSAUR) then return false end return bit.band(sumtype,SUMMON_TYPE_PANDEMONIUM)==SUMMON_TYPE_PANDEMONIUM end function s.tgfilter(c) return c:IsSetCard(0x9b5) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() and not c:IsCode(id) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.filter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsSetCard(0x9b5) and not c:IsCode(id) end function s.tg(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_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,200) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.op(e,tp,eg,ep,ev,re,r,rp) if Duel.Damage(1-tp,200,REASON_EFFECT)==0 or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.BreakEffect() Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.cfilter(c) return c:IsCode(id) and c:IsAbleToRemoveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,2,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,2,2,e:GetHandler()) Duel.Remove(g+e:GetHandler(),POS_FACEUP,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end local sg=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil) Duel.Destroy(sg,REASON_EFFECT) end