--The Invocation of DH --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) c:RegisterEffect(e1) --atk & def local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(cid.stattg) e2:SetValue(300) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --banish/spsummon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_FZONE) e4:SetCountLimit(1,id) e4:SetCost(cid.cost) e4:SetTarget(cid.target) e4:SetOperation(cid.operation) c:RegisterEffect(e4) --search local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e5:SetCode(EVENT_TO_GRAVE) e5:SetOperation(cid.regop) c:RegisterEffect(e5) local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(id,1)) e6:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e6:SetRange(LOCATION_GRAVE) e6:SetCode(EVENT_PHASE+PHASE_STANDBY) e6:SetCountLimit(1,id+100) e6:SetCondition(cid.thcon) e6:SetCost(cid.thcost) e6:SetTarget(cid.thtg) e6:SetOperation(cid.thop) c:RegisterEffect(e6) end --ATK/DEF function cid.stattg(e,c) return c:IsRace(RACE_ZOMBIE) and c:IsLevelAbove(5) end --BANISH/SPSUMMON function cid.rfilter(c) return c:IsType(TYPE_MONSTER) and c:IsRace(RACE_ZOMBIE) and c:IsAbleToRemoveAsCost() end function cid.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.rfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,cid.rfilter,tp,LOCATION_GRAVE,0,1,1,nil) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_COST) end end function cid.filter(c,e,tp) return c:IsAbleToRemove() or cid.sgfilter(c,e,tp) end function cid.sgfilter(c,e,tp) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsType(TYPE_MONSTER) and c:IsRace(RACE_ZOMBIE) and c:IsLevelAbove(5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_GRAVE) and cid.filter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(cid.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,aux.NecroValleyFilter(cid.filter),tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) local sg=g:Filter(cid.sgfilter,nil,e,tp) if #sg>0 then Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,1,0,0) end end function cid.operation(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 local op=0 if tc:IsAbleToRemove() and cid.sgfilter(tc,e,tp) then op=Duel.SelectOption(tp,aux.Stringid(id,2),aux.Stringid(id,3)) elseif tc:IsAbleToRemove() then op=Duel.SelectOption(tp,aux.Stringid(id,2)) elseif cid.sgfilter(tc,e,tp) then op=Duel.SelectOption(tp,aux.Stringid(id,3))+1 else return end if op==0 then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) else Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end end --SEARCH function cid.regop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) then return end e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,2) end function cid.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:GetTurnID()~=Duel.GetTurnCount() and c:GetFlagEffect(id)>0 end function cid.cfilter(c) return c:IsSetCard(0x5478) and c:IsAbleToRemoveAsCost() end function cid.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(cid.cfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,cid.cfilter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler()) g:AddCard(e:GetHandler()) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_COST) end end function cid.scfilter(c) return c:IsSetCard(0x5478) and c:IsAbleToHand() and not c:IsCode(id,id-3) end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.scfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) 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.scfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end