name: Infernoble
card_text: While this card is an Equip Card, the equipped monster cannot be destroyed by card effects. You can only use each of the following effects of "Infernoble Knight Ogier" once per turn. If this card is Normal or Special Summoned: You can send 1 "Noble Arms" card, or 1 FIRE Warrior monster except "Infernoble Knight Ogier", from your Deck to the GY. If this card is in your GY: You can target 1 Warrior monster you control; equip this card to that monster you control.
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)
  	--tograve
  	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:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.tgtg)
  	e1:SetOperation(s.tgop)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--equip
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_EQUIP)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetCountLimit(1, id + 1)
  	e3:SetTarget(s.eqtg)
  	e3:SetOperation(s.eqop)
  	c:RegisterEffect(e3)
  	--indes
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_EQUIP)
  	e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e4:SetValue(1)
  	c:RegisterEffect(e4)
  end
  function s.tgfilter(c)
  	return ((c:IsRace(RACE_WARRIOR) and c:IsAttribute(ATTRIBUTE_FIRE)) or c:IsSetCard(SETCARD_ID_0)) and not c:IsCode(id) and c:IsAbleToGrave()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  function s.eqfilter(c)
  	return c:IsFaceup() and c:IsRace(RACE_WARRIOR)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.eqfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(s.eqfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.eqfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, e:GetHandler(), 1, 0, 0)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) and tc:IsRelateToEffect(e) then
  		if not Duel.Equip(tp, c, tc) then
  			return
  		end
  		--equip limit
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetLabelObject(tc)
  		e1:SetValue(s.eqlimit)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e1)
  	end
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  
  
source_text: Infernoble
  While this card is an Equip Card, the equipped monster cannot be destroyed by card effects. You can only use each of the following effects of "Infernoble Knight Ogier" once per turn. If this card is Normal or Special Summoned: You can send 1 "Noble Arms" card, or 1 FIRE Warrior monster except "Infernoble Knight Ogier", from your Deck to the GY. If this card is in your GY: You can target 1 Warrior monster you control; equip this card to that monster you control.
target_text: -- Infernoble
  local SETCARD_ID_0 = 0x207a --Noble
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--tograve
  	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:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.tgtg)
  	e1:SetOperation(s.tgop)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--equip
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_EQUIP)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetCountLimit(1, id + 1)
  	e3:SetTarget(s.eqtg)
  	e3:SetOperation(s.eqop)
  	c:RegisterEffect(e3)
  	--indes
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_EQUIP)
  	e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e4:SetValue(1)
  	c:RegisterEffect(e4)
  end
  function s.tgfilter(c)
  	return ((c:IsRace(RACE_WARRIOR) and c:IsAttribute(ATTRIBUTE_FIRE)) or c:IsSetCard(SETCARD_ID_0)) and not c:IsCode(id) and c:IsAbleToGrave()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  function s.eqfilter(c)
  	return c:IsFaceup() and c:IsRace(RACE_WARRIOR)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.eqfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(s.eqfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.eqfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, e:GetHandler(), 1, 0, 0)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) and tc:IsRelateToEffect(e) then
  		if not Duel.Equip(tp, c, tc) then
  			return
  		end
  		--equip limit
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetLabelObject(tc)
  		e1:SetValue(s.eqlimit)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e1)
  	end
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  
  