--Nucleon Markshall --Scripted by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --pandemonium aux.AddOrigPandemoniumType(c) --activate local p1=Effect.CreateEffect(c) p1:GLString(0) p1:SetCategory(CATEGORY_DESTROY+CATEGORY_DISABLE) p1:SetType(EFFECT_TYPE_QUICK_O) p1:SetCode(EVENT_FREE_CHAIN) p1:SetRange(LOCATION_SZONE) p1:SetCountLimit(1,id) p1:SetCondition(cid.actcon) p1:SetTarget(cid.acttg) p1:SetOperation(cid.actop) c:RegisterEffect(p1) aux.EnablePandemoniumAttribute(c,p1) --spsummon local p2=Effect.CreateEffect(c) p2:SetDescription(aux.Stringid(id,1)) p2:SetCategory(CATEGORY_SPECIAL_SUMMON) p2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) p2:SetProperty(EFFECT_FLAG_DELAY) p2:SetRange(LOCATION_SZONE) p2:SetCode(EVENT_SPSUMMON_SUCCESS) p2:SetCountLimit(1,id+100) p2:SetCondition(cid.spcon) p2:SetTarget(cid.sptg) p2:SetOperation(cid.spop) c:RegisterEffect(p2) --MONSTER EFFECTS --direct attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetCategory(CATEGORY_DISABLE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id+200) e1:SetCondition(cid.spcon0) e1:SetCost(cid.spcost0) e1:SetTarget(cid.sptg0) e1:SetOperation(cid.spop0) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,3)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetCountLimit(1,id+300) e2:SetCondition(cid.thcon) e2:SetTarget(cid.thtg) e2:SetOperation(cid.thop) c:RegisterEffect(e2) if not cid.global_check then cid.global_check=true cid[0]={} local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_ATTACK_ANNOUNCE) ge1:SetOperation(cid.check) Duel.RegisterEffect(ge1,0) local ge2=Effect.CreateEffect(c) ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge2:SetCode(EVENT_ATTACK_DISABLED) ge2:SetOperation(cid.check2) Duel.RegisterEffect(ge2,0) local ge3=Effect.CreateEffect(c) ge3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge3:SetCode(EVENT_PHASE_START+PHASE_DRAW) ge3:SetOperation(cid.clear) Duel.RegisterEffect(ge3,0) end end function cid.check(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() if Duel.GetAttackTarget()==nil then Duel.GetAttacker():RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1) table.insert(cid[0],Duel.GetAttacker()) end end function cid.check2(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() if tc:GetFlagEffect(id)~=0 and Duel.GetAttackTarget()~=nil then for i=1,#cid[0] do if cid[0][i]==Duel.GetAttacker() then table.remove(cid[0],i) end end end end function cid.clear(e,tp,eg,ep,ev,re,r,rp) cid[0]={} end --ACTIVATE function cid.cfilter(c) return c:IsFacedown() or (not c:IsType(TYPE_PENDULUM+TYPE_PANDEMONIUM) and not c:IsSetCard(0x7a4)) end function cid.actcon(e,tp,eg,ep,ev,re,r,rp) return e:IsHasType(EFFECT_TYPE_ACTIVATE) and aux.PandActCheck(e) and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)>0 and not Duel.IsExistingMatchingCard(cid.cfilter,tp,LOCATION_MZONE,0,1,nil) end function cid.dryfilter(c,tp) return c:IsFaceup() and c:IsSetCard(0x7a4) and Duel.IsExistingMatchingCard(cid.disfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c) end function cid.disfilter(c) return c:IsFaceup() and not c:IsDisabled() and c:IsType(TYPE_EFFECT) and c:IsAttackBelow(2800) end function cid.acttg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.dryfilter,tp,LOCATION_ONFIELD,0,1,e:GetHandler(),tp) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_ONFIELD) Duel.SetOperationInfo(0,CATEGORY_DISABLE,nil,1,PLAYER_ALL,LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function cid.actop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g1=Duel.SelectMatchingCard(tp,cid.dryfilter,tp,LOCATION_ONFIELD,0,1,1,c,tp) if g1:GetCount()>0 then Duel.HintSelection(g1) if Duel.Destroy(g1,REASON_EFFECT)~=0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local tc=Duel.SelectMatchingCard(tp,cid.disfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil):GetFirst() if tc and ((tc:IsFaceup() and not tc:IsDisabled()) or tc:IsType(TYPE_TRAPMONSTER)) then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e2) if tc:IsType(TYPE_TRAPMONSTER) then local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EFFECT_DISABLE_TRAPMONSTER) e3:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e3) end end end end end --SPSUMMON function cid.egfilter(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0x7a4) end function cid.lvfilter(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0x7a4) and c:GetLevel()~=7 end function cid.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(cid.egfilter,1,nil) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0x7a4,TYPE_MONSTER+TYPE_EFFECT+TYPE_PANDEMONIUM,2800,1000,7,RACE_MACHINE,ATTRIBUTE_WIND) 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) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if not c:IsCanBeSpecialSummoned(e,0,tp,true,false) or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,0x7a4,TYPE_MONSTER+TYPE_EFFECT+TYPE_PANDEMONIUM,2800,1000,7,RACE_MACHINE,ATTRIBUTE_WIND) then return end c:AddMonsterAttribute(TYPE_EFFECT+TYPE_PANDEMONIUM) if Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)~=0 and eg:IsExists(cid.lvfilter,1,nil) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LVRANK) local tc=eg:FilterSelect(tp,cid.lvfilter,1,1,nil):GetFirst() if tc then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(7) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) end end end --DIRECT ATTACK function cid.spcon0(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttacker() return Duel.GetAttackTarget()==nil end function cid.tdfilter(c) return c:IsSetCard(0x7a4) and (not c:IsLocation(LOCATION_EXTRA) or c:IsFaceup()) and c:IsAbleToRemoveAsCost() end function cid.spcost0(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.tdfilter,tp,LOCATION_GRAVE+LOCATION_EXTRA,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,cid.tdfilter,tp,LOCATION_GRAVE+LOCATION_EXTRA,0,1,1,nil) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_COST) end end function cid.disfilter2(c) if c:GetFlagEffect(id)>0 and #cid[0]>0 then for i=1,#cid[0] do if cid[0][i]==c then return false end end end return c:IsFaceup() and not c:IsDisabled() and c:IsType(TYPE_EFFECT) end function cid.sptg0(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.disfilter2,tp,0,LOCATION_MZONE,1,nil) and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.SetOperationInfo(0,CATEGORY_DISABLE,nil,1,1-tp,LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function cid.spop0(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local tc=Duel.SelectMatchingCard(tp,cid.disfilter2,tp,0,LOCATION_MZONE,1,1,nil):GetFirst() if tc and ((tc:IsFaceup() and not tc:IsDisabled()) or tc:IsType(TYPE_TRAPMONSTER)) then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e2) if tc:IsType(TYPE_TRAPMONSTER) then local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EFFECT_DISABLE_TRAPMONSTER) e3:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e3) end if c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.BreakEffect() Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end end --TOHAND function cid.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) and re and (re:GetHandler():IsSetCard(0x7a4) or re:IsActiveType(TYPE_SPELL+TYPE_TRAP)) end function cid.thfilter(c) return c:IsFaceup() and c:IsSetCard(0x7a4) and c:IsType(TYPE_PENDULUM+TYPE_PANDEMONIUM) and c:IsAbleToHand() end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.thfilter,tp,LOCATION_EXTRA,0,1,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA) end function cid.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,cid.thfilter,tp,LOCATION_EXTRA,0,1,2,e:GetHandler()) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end