name: Lord
card_text: You can Ritual Summon this card with "Red-Eyes Transmigration". Once per turn, when a card or effect is activated, except "Lord of the Red" (Quick Effect): You can target 1 monster on the field; destroy it. Once per turn, when a card or effect is activated, except "Lord of the Red" (Quick Effect): You can target 1 Spell/Trap on the field; destroy it.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--destroy monster
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.descon)
  	e1:SetTarget(s.destg1)
  	e1:SetOperation(s.desop1)
  	c:RegisterEffect(e1)
  	--destroy spell & trap
  	local e2 = e1:Clone()
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetTarget(s.destg2)
  	e2:SetOperation(s.desop2)
  	c:RegisterEffect(e2)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return not re:GetHandler():IsCode(id) and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED)
  end
  function s.destg1(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desfilter2(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.destg2(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and s.desfilter2(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter2, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter2, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop1(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsType(TYPE_MONSTER) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  function s.desop2(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  
  
source_text: Lord
  You can Ritual Summon this card with "Red-Eyes Transmigration". Once per turn, when a card or effect is activated, except "Lord of the Red" (Quick Effect): You can target 1 monster on the field; destroy it. Once per turn, when a card or effect is activated, except "Lord of the Red" (Quick Effect): You can target 1 Spell/Trap on the field; destroy it.
target_text: -- Lord
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--destroy monster
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.descon)
  	e1:SetTarget(s.destg1)
  	e1:SetOperation(s.desop1)
  	c:RegisterEffect(e1)
  	--destroy spell & trap
  	local e2 = e1:Clone()
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetTarget(s.destg2)
  	e2:SetOperation(s.desop2)
  	c:RegisterEffect(e2)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return not re:GetHandler():IsCode(id) and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED)
  end
  function s.destg1(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desfilter2(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.destg2(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and s.desfilter2(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter2, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter2, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop1(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsType(TYPE_MONSTER) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  function s.desop2(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  
  