name: Noble
card_text: This card is treated as a Normal Monster while face-up on the field. While equipped with a "Noble Arms" Equip Spell, this card becomes an Effect Monster with these effects.
  ● This card becomes DARK and its Level is increased by 1.
  ● During your Main Phase: You can reveal 3 "Noble Arms" cards from your Deck, have your opponent randomly add 1 of them to your hand, and send the rest to the GY. You can only use this effect of "Noble Knight Borz" once per turn.
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)
  	--Normal monster
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_ADD_TYPE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.eqcon1)
  	e1:SetValue(TYPE_NORMAL)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_REMOVE_TYPE)
  	e2:SetValue(TYPE_EFFECT)
  	c:RegisterEffect(e2)
  	--Attribute Dark
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.eqcon2)
  	e3:SetValue(ATTRIBUTE_DARK)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_UPDATE_LEVEL)
  	e4:SetValue(1)
  	c:RegisterEffect(e4)
  	--search
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 0))
  	e5:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCountLimit(1, id)
  	e5:SetCondition(s.thcon)
  	e5:SetTarget(s.thtg)
  	e5:SetOperation(s.thop)
  	c:RegisterEffect(e5)
  end
  function s.eqcon1(e)
  	return not e:GetHandler():GetEquipGroup():IsExists(Card.IsSetCard, 1, nil, 0x207a)
  end
  function s.eqcon2(e)
  	return e:GetHandler():GetEquipGroup():IsExists(Card.IsSetCard, 1, nil, 0x207a)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return s.eqcon2(e)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 3, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, 0, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsSetCard, tp, LOCATION_DECK, 0, nil, 0x207a)
  	if g:GetCount() >= 3 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local sg = g:Select(tp, 3, 3, nil)
  		Duel.ConfirmCards(1 - tp, sg)
  		Duel.ShuffleDeck(tp)
  		local tg = sg:RandomSelect(1 - tp, 1)
  		local tc = tg:GetFirst()
  		if tc:IsAbleToHand() then
  			tc:SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM, true)
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			sg:RemoveCard(tc)
  		end
  		Duel.SendtoGrave(sg, REASON_EFFECT)
  	end
  end
  
  
source_text: Noble
  This card is treated as a Normal Monster while face-up on the field. While equipped with a "Noble Arms" Equip Spell, this card becomes an Effect Monster with these effects.
  ● This card becomes DARK and its Level is increased by 1.
  ● During your Main Phase: You can reveal 3 "Noble Arms" cards from your Deck, have your opponent randomly add 1 of them to your hand, and send the rest to the GY. You can only use this effect of "Noble Knight Borz" once per turn.
target_text: -- Noble
  local SETCARD_ID_0 = 0x207a --Noble
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Normal monster
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_ADD_TYPE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.eqcon1)
  	e1:SetValue(TYPE_NORMAL)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_REMOVE_TYPE)
  	e2:SetValue(TYPE_EFFECT)
  	c:RegisterEffect(e2)
  	--Attribute Dark
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.eqcon2)
  	e3:SetValue(ATTRIBUTE_DARK)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_UPDATE_LEVEL)
  	e4:SetValue(1)
  	c:RegisterEffect(e4)
  	--search
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 0))
  	e5:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCountLimit(1, id)
  	e5:SetCondition(s.thcon)
  	e5:SetTarget(s.thtg)
  	e5:SetOperation(s.thop)
  	c:RegisterEffect(e5)
  end
  function s.eqcon1(e)
  	return not e:GetHandler():GetEquipGroup():IsExists(Card.IsSetCard, 1, nil, 0x207a)
  end
  function s.eqcon2(e)
  	return e:GetHandler():GetEquipGroup():IsExists(Card.IsSetCard, 1, nil, 0x207a)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return s.eqcon2(e)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 3, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, 0, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsSetCard, tp, LOCATION_DECK, 0, nil, 0x207a)
  	if g:GetCount() >= 3 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local sg = g:Select(tp, 3, 3, nil)
  		Duel.ConfirmCards(1 - tp, sg)
  		Duel.ShuffleDeck(tp)
  		local tg = sg:RandomSelect(1 - tp, 1)
  		local tc = tg:GetFirst()
  		if tc:IsAbleToHand() then
  			tc:SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM, true)
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			sg:RemoveCard(tc)
  		end
  		Duel.SendtoGrave(sg, REASON_EFFECT)
  	end
  end
  
  