--Nobless Behelitage --Scripted by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP) c:RegisterEffect(e1) --atk local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e2:SetRange(LOCATION_SZONE) e2:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP) e2:SetCountLimit(1,id) e2:SetCondition(cid.atkcon) e2:SetTarget(cid.atktg) e2:SetOperation(cid.atkop) c:RegisterEffect(e2) --shuffle local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_DECK) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,id+100) e3:SetCondition(cid.tdcon) e3:SetTarget(cid.tdtg) e3:SetOperation(cid.tdop) c:RegisterEffect(e3) end --ATK function cid.atkcon(e,tp,eg,ep,ev,re,r,rp) local ph=Duel.GetCurrentPhase() return ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE end function cid.filter(c) return c:IsType(TYPE_MONSTER) and c:IsFaceup() and c:GetAttack()>0 end function cid.atkfilter(c) return c:IsType(TYPE_MONSTER) and c:IsFaceup() and c:GetLevel()>0 and c:IsRace(RACE_ZOMBIE) end function cid.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and cid.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(cid.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) and Duel.IsExistingMatchingCard(cid.atkfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g1=Duel.SelectTarget(tp,cid.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) local g2=Duel.GetMatchingGroup(cid.atkfilter,tp,LOCATION_MZONE,0,nil) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g1,1,tp,g2:GetSum(Card.GetLevel)*300) end function cid.spfilter(c,e,tp) return c:IsType(TYPE_MONSTER) and c:IsRace(RACE_ZOMBIE) and (c:GetBaseAttack()==0 or c:GetBaseDefense()==0) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function cid.atkop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:GetAttack()>0 then local g2=Duel.GetMatchingGroup(cid.atkfilter,tp,LOCATION_MZONE,0,nil) if #g2<=0 then return end local val=g2:GetSum(Card.GetLevel)*300 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-val) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) if tc:GetAttack()==0 and Duel.IsExistingMatchingCard(cid.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,cid.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP) end end end end --SHUFFLE function cid.egfilter(c) return c:IsType(TYPE_MONSTER) and bit.band(c:GetPreviousLocation(),LOCATION_GRAVE)~=0 and c:IsLocation(LOCATION_DECK+LOCATION_EXTRA) and c:IsReason(REASON_EFFECT) and c:GetReasonCard() and c:GetReasonCard():IsType(TYPE_MONSTER) and c:GetReasonCard():IsAttribute(ATTRIBUTE_DARK) and c:GetReasonCard():IsRace(RACE_ZOMBIE) end function cid.tdcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()==1-tp and eg:IsExists(cid.egfilter,1,nil) end function cid.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and chkc:IsAbleToDeck() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g1=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,1,0,0) end function cid.tdop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,2,REASON_EFFECT) end end