name: Noble
card_text: When this card is Normal or Special Summoned: You can send 1 "Noble Arms" Equip Spell Card from your Deck to the Graveyard. During either player's turn: You can target 1 "Noble Arms" Equip Spell Card and 1 appropriate monster on the field; equip that Equip Spell Card to that appropriate monster. This effect can only be used once while this card is face-up on the field.
external_ids: local SETCARD_ID_0 = 0x207a --Noble
  
lua: local SETCARD_ID_0 = 0x207a --Noble
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--send to grave
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOGRAVE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--equip change
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_FREE_CHAIN)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetProperty(EFFECT_FLAG_NO_TURN_RESET + EFFECT_FLAG_CARD_TARGET)
  	e3:SetCountLimit(1)
  	e3:SetTarget(s.eqtg)
  	e3:SetOperation(s.eqop)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsType(TYPE_EQUIP) and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGrave()
  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)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  function s.eqfilter1(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetEquipTarget() and Duel.IsExistingTarget(s.eqfilter2, 0, LOCATION_MZONE, LOCATION_MZONE, 1, c:GetEquipTarget(), c)
  end
  function s.eqfilter2(c, ec)
  	return c:IsFaceup() and ec:CheckEquipTarget(c)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.eqfilter1, tp, LOCATION_SZONE, LOCATION_SZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	local g1 = Duel.SelectTarget(tp, s.eqfilter1, tp, LOCATION_SZONE, LOCATION_SZONE, 1, 1, nil)
  	local tc = g1:GetFirst()
  	e:SetLabelObject(tc)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g2 = Duel.SelectTarget(tp, s.eqfilter2, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, tc:GetEquipTarget(), tc)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local ec = e:GetLabelObject()
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local tc = g:GetFirst()
  	if tc == ec then
  		tc = g:GetNext()
  	end
  	if ec:IsFaceup() and ec:IsRelateToEffect(e) and ec:CheckEquipTarget(tc) and tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		Duel.Equip(tp, ec, tc)
  	end
  end
  
  
source_text: Noble
  When this card is Normal or Special Summoned: You can send 1 "Noble Arms" Equip Spell Card from your Deck to the Graveyard. During either player's turn: You can target 1 "Noble Arms" Equip Spell Card and 1 appropriate monster on the field; equip that Equip Spell Card to that appropriate monster. This effect can only be used once while this card is face-up on the field.
target_text: -- Noble
  local SETCARD_ID_0 = 0x207a --Noble
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--send to grave
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOGRAVE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--equip change
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_FREE_CHAIN)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetProperty(EFFECT_FLAG_NO_TURN_RESET + EFFECT_FLAG_CARD_TARGET)
  	e3:SetCountLimit(1)
  	e3:SetTarget(s.eqtg)
  	e3:SetOperation(s.eqop)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsType(TYPE_EQUIP) and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGrave()
  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)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  function s.eqfilter1(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetEquipTarget() and Duel.IsExistingTarget(s.eqfilter2, 0, LOCATION_MZONE, LOCATION_MZONE, 1, c:GetEquipTarget(), c)
  end
  function s.eqfilter2(c, ec)
  	return c:IsFaceup() and ec:CheckEquipTarget(c)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.eqfilter1, tp, LOCATION_SZONE, LOCATION_SZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	local g1 = Duel.SelectTarget(tp, s.eqfilter1, tp, LOCATION_SZONE, LOCATION_SZONE, 1, 1, nil)
  	local tc = g1:GetFirst()
  	e:SetLabelObject(tc)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g2 = Duel.SelectTarget(tp, s.eqfilter2, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, tc:GetEquipTarget(), tc)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local ec = e:GetLabelObject()
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local tc = g:GetFirst()
  	if tc == ec then
  		tc = g:GetNext()
  	end
  	if ec:IsFaceup() and ec:IsRelateToEffect(e) and ec:CheckEquipTarget(tc) and tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		Duel.Equip(tp, ec, tc)
  	end
  end
  
  