--created by Swag, coded by Lyris local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddOrigPandemoniumType(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_SZONE) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetCondition(function() return c:GetFlagEffect(706)>0 end) e1:SetTarget(s.splimit) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_SZONE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetCondition(function() return c:GetFlagEffect(706)>0 end) e2:SetTarget(s.etarget) e2:SetValue(s.efilter) 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_DESTROY) e3:SetCondition(aux.PandActCheck) e3:SetCost(s.cost) e3:SetTarget(s.target) e3:SetOperation(s.activate) c:RegisterEffect(e3) aux.EnablePandemoniumAttribute(c,e3,true,TYPE_EFFECT+TYPE_FUSION) aux.AddFusionProcFun2(c,s.mfilter1,s.mfilter2,true) local e0=aux.AddContactFusionProcedure(c,Card.IsReleasable,LOCATION_MZONE,0,Duel.Release,REASON_COST+REASON_MATERIAL) e0:SetValue(SUMMON_TYPE_FUSION) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_SPSUMMON_SUCCESS) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetCondition(function(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION) end) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD) e5:SetCode(EFFECT_UPDATE_ATTACK) e5:SetRange(LOCATION_MZONE) e5:SetTargetRange(0,LOCATION_MZONE) e5:SetValue(function(e,c) return -Duel.GetMatchingGroupCount(aux.FilterBoolFunction(Card.IsRace,RACE_DINOSAUR),e:GetHandlerPlayer(),LOCATION_GRAVE,0,nil)*100 end) c:RegisterEffect(e5) local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_QUICK_O) e6:SetCode(EVENT_FREE_CHAIN) e6:SetRange(LOCATION_MZONE) e6:SetCountLimit(1) e6:SetCategory(CATEGORY_DAMAGE+CATEGORY_DESTROY) e6:SetTarget(s.tg) e6:SetOperation(s.operation) c:RegisterEffect(e6) local e7=Effect.CreateEffect(c) e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e7:SetCode(EVENT_DESTROYED) e7:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e7:SetTarget(s.pentg) e7:SetOperation(s.penop) c:RegisterEffect(e7) end function s.mfilter1(c) return c:IsLevelAbove(7) and c:IsSetCard(0x9b5) end function s.mfilter2(c) return c:IsLevelAbove(3) and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsRace(RACE_DINOSAUR) 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.etarget(e,c) return c:IsType(TYPE_FUSION) and c:IsRace(RACE_DINOSAUR) end function s.efilter(e,te) return te:IsActiveType(TYPE_SPELL+TYPE_TRAP) and te:GetOwnerPlayer()~=e:GetOwnerPlayer() end function s.cfilter(c) return c:IsAbleToGraveAsCost() and c:IsType(TYPE_PANDEMONIUM) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_DECK,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsType,tp,0,LOCATION_ONFIELD,nil,TYPE_SPELL+TYPE_TRAP) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) 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_DESTROY) local g=Duel.SelectMatchingCard(tp,Card.IsType,tp,0,LOCATION_ONFIELD,1,3,nil,TYPE_SPELL+TYPE_TRAP) if #g>0 then Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end function s.filter(c,e,tp) return c:IsType(TYPE_PANDEMONIUM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end function s.desfilter(c,atk) return c:IsFaceup() and c:IsAttackBelow(atk) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)*500 if chk==0 then return ct>0 end Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,ct) local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,ct) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE) local d=Duel.Damage(1-tp,ct*500,REASON_EFFECT) if d==0 then return end local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,d) Duel.Destroy(g,REASON_EFFECT) end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsPandemoniumSSetable() end end function s.penop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsPandemoniumSSetable() then Duel.PandSSet(c,e,tp,REASON_EFFECT) end end