name: Darklord
card_text: Send 1 "Darklord" monster from your hand or face-up field to the GY; destroy 1 card on the field. You can only activate 1 "Darklord Rebellion" per turn.
external_ids: local SETCARD_ID_0 = 0xef --Darklord
  
lua: local SETCARD_ID_0 = 0xef --Darklord
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c, ec)
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsType(TYPE_MONSTER)
  		and c:IsFaceupEx()
  		and c:IsAbleToGraveAsCost()
  		and Duel.IsExistingMatchingCard(nil, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, Group.FromCards(c, ec))
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil, c)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil, c)
  	Duel.SendtoGrave(g, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local exc = nil
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		exc = e:GetHandler()
  	end
  	local g = Duel.GetMatchingGroup(nil, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, exc)
  	if chk == 0 then
  		return g:GetCount() > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local exc = nil
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		exc = e:GetHandler()
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, nil, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, exc)
  	if g:GetCount() > 0 then
  		Duel.HintSelection(g)
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  
source_text: Darklord
  Send 1 "Darklord" monster from your hand or face-up field to the GY; destroy 1 card on the field. You can only activate 1 "Darklord Rebellion" per turn.
target_text: -- Darklord
  local SETCARD_ID_0 = 0xef --Darklord
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c, ec)
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsType(TYPE_MONSTER)
  		and c:IsFaceupEx()
  		and c:IsAbleToGraveAsCost()
  		and Duel.IsExistingMatchingCard(nil, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, Group.FromCards(c, ec))
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil, c)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil, c)
  	Duel.SendtoGrave(g, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local exc = nil
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		exc = e:GetHandler()
  	end
  	local g = Duel.GetMatchingGroup(nil, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, exc)
  	if chk == 0 then
  		return g:GetCount() > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local exc = nil
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		exc = e:GetHandler()
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, nil, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, exc)
  	if g:GetCount() > 0 then
  		Duel.HintSelection(g)
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  