name: Noble
card_text: While you control another "Noble Knight" monster, your opponent cannot target your monsters with less than 1800 ATK, except this card, with card effects, and their monsters cannot target them with attacks. If a "Noble Arms" Equip Spell becomes equipped to this card: Target 1 face-up card on the field; destroy that target. You can only use this effect of "Noble Knight Drystan" once per turn.
external_ids: local SETCARD_ID_0 = 0x107a --Noble
  
lua: local SETCARD_ID_0 = 0x107a --Noble
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--cannot be battle target
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(0, LOCATION_MZONE)
  	e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e1:SetCondition(s.con)
  	e1:SetValue(s.atlimit)
  	c:RegisterEffect(e1)
  	--cannot be effect target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetCondition(s.con)
  	e2:SetTarget(s.tglimit)
  	e2:SetValue(aux.tgoval)
  	c:RegisterEffect(e2)
  	--destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_DESTROY)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCode(EVENT_EQUIP)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.descon)
  	e3:SetTarget(s.destg)
  	e3:SetOperation(s.desop)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.con(e)
  	return Duel.IsExistingMatchingCard(s.cfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, e:GetHandler())
  end
  function s.atlimit(e, c)
  	return c ~= e:GetHandler() and c:IsFaceup() and c:GetAttack() < 1800
  end
  function s.tglimit(e, c)
  	return c ~= e:GetHandler() and c:GetAttack() < 1800
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(Card.IsSetCard, 1, nil, 0x207a)
  end
  function s.desfilter(c)
  	return c:IsFaceup()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and s.desfilter(chkc)
  	end
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  
  
source_text: Noble
  While you control another "Noble Knight" monster, your opponent cannot target your monsters with less than 1800 ATK, except this card, with card effects, and their monsters cannot target them with attacks. If a "Noble Arms" Equip Spell becomes equipped to this card: Target 1 face-up card on the field; destroy that target. You can only use this effect of "Noble Knight Drystan" once per turn.
target_text: -- Noble
  local SETCARD_ID_0 = 0x107a --Noble
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--cannot be battle target
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(0, LOCATION_MZONE)
  	e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e1:SetCondition(s.con)
  	e1:SetValue(s.atlimit)
  	c:RegisterEffect(e1)
  	--cannot be effect target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetCondition(s.con)
  	e2:SetTarget(s.tglimit)
  	e2:SetValue(aux.tgoval)
  	c:RegisterEffect(e2)
  	--destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_DESTROY)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCode(EVENT_EQUIP)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.descon)
  	e3:SetTarget(s.destg)
  	e3:SetOperation(s.desop)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.con(e)
  	return Duel.IsExistingMatchingCard(s.cfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, e:GetHandler())
  end
  function s.atlimit(e, c)
  	return c ~= e:GetHandler() and c:IsFaceup() and c:GetAttack() < 1800
  end
  function s.tglimit(e, c)
  	return c ~= e:GetHandler() and c:GetAttack() < 1800
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(Card.IsSetCard, 1, nil, 0x207a)
  end
  function s.desfilter(c)
  	return c:IsFaceup()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and s.desfilter(chkc)
  	end
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  
  