name: Vampire
card_text: If you have no card in your Field Zone and all face-up monsters you control are Zombie monsters (min. 1): Activate 1 "Vampire Kingdom" directly from your Deck, then, you can Special Summon 1 DARK "Vampire" monster from your GY in Defense Position. You can only activate 1 "Vampire Takeover" per turn.
external_ids: local CARD_ID_0 = 4179255 --Ancient Pixie Dragon
  local CARD_ID_1 = 62188962 --Vampire Kingdom
  local SETCARD_ID_0 = 0x8e --Vampire
  
lua: local CARD_ID_0 = 4179255 --Ancient Pixie Dragon
  local CARD_ID_1 = 62188962 --Vampire Kingdom
  local SETCARD_ID_0 = 0x8e --Vampire
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldCard(tp, LOCATION_FZONE, 0) ~= nil then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, 0, nil)
  	return g:GetCount() > 0 and g:FilterCount(Card.IsRace, nil, RACE_ZOMBIE) == g:GetCount()
  end
  function s.filter(c, tp)
  	return c:IsCode(CARD_ID_1) and c:GetActivateEffect():IsActivatable(tp, true, true)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_DEFENSE)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstMatchingCard(s.filter, tp, LOCATION_DECK, 0, nil, tp)
  	if tc then
  		Duel.MoveToField(tc, tp, tp, LOCATION_FZONE, POS_FACEUP, true)
  		local te = tc:GetActivateEffect()
  		te:UseCountLimit(tp, 1, true)
  		local tep = tc:GetControler()
  		local cost = te:GetCost()
  		if cost then
  			cost(te, tep, eg, ep, ev, re, r, rp, 1)
  		end
  		Duel.RaiseEvent(tc, CARD_ID_0, te, 0, tp, tp, Duel.GetCurrentChain())
  		if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  			return
  		end
  		local sg = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter), tp, LOCATION_GRAVE, 0, nil, e, tp)
  		if sg:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  			local g = sg:Select(tp, 1, 1, nil)
  			Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  		end
  	end
  end
  
  
source_text: Vampire
  If you have no card in your Field Zone and all face-up monsters you control are Zombie monsters (min. 1): Activate 1 "Vampire Kingdom" directly from your Deck, then, you can Special Summon 1 DARK "Vampire" monster from your GY in Defense Position. You can only activate 1 "Vampire Takeover" per turn.
target_text: -- Vampire
  local CARD_ID_0 = 4179255 --Ancient Pixie Dragon
  local CARD_ID_1 = 62188962 --Vampire Kingdom
  local SETCARD_ID_0 = 0x8e --Vampire
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldCard(tp, LOCATION_FZONE, 0) ~= nil then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, 0, nil)
  	return g:GetCount() > 0 and g:FilterCount(Card.IsRace, nil, RACE_ZOMBIE) == g:GetCount()
  end
  function s.filter(c, tp)
  	return c:IsCode(CARD_ID_1) and c:GetActivateEffect():IsActivatable(tp, true, true)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_DEFENSE)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstMatchingCard(s.filter, tp, LOCATION_DECK, 0, nil, tp)
  	if tc then
  		Duel.MoveToField(tc, tp, tp, LOCATION_FZONE, POS_FACEUP, true)
  		local te = tc:GetActivateEffect()
  		te:UseCountLimit(tp, 1, true)
  		local tep = tc:GetControler()
  		local cost = te:GetCost()
  		if cost then
  			cost(te, tep, eg, ep, ev, re, r, rp, 1)
  		end
  		Duel.RaiseEvent(tc, CARD_ID_0, te, 0, tp, tp, Duel.GetCurrentChain())
  		if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  			return
  		end
  		local sg = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter), tp, LOCATION_GRAVE, 0, nil, e, tp)
  		if sg:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  			local g = sg:Select(tp, 1, 1, nil)
  			Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  		end
  	end
  end
  
  