name: Armed
card_text: Target 1 "Armed Dragon" monster you control; take 1 monster with the same name from your Deck or GY, and either add it to your hand or Special Summon it, ignoring its Summoning conditions, but it cannot attack directly. You can only activate 1 "Armed Dragon Blitz" per turn. You cannot Special Summon monsters the turn you activate this card, except Dragon monsters.
external_ids: local SETCARD_ID_0 = 0x111 --Armed
  
lua: local SETCARD_ID_0 = 0x111 --Armed
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND + CATEGORY_SPECIAL_SUMMON + CATEGORY_DECKDES + CATEGORY_GRAVE_SPSUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return c:IsRace(RACE_DRAGON)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsRace(RACE_DRAGON)
  end
  function s.filter(c, e, tp)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.thfilter(c, e, tp, code)
  	if not (c:IsCode(code) and c:IsType(TYPE_MONSTER)) then
  		return false
  	end
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	return c:IsAbleToHand() or (ft > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, true, false))
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  		local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.thfilter), tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil, e, tp, tc:GetCode())
  		local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  		local sc = g:GetFirst()
  		if sc then
  			if sc:IsAbleToHand() and (not sc:IsCanBeSpecialSummoned(e, 0, tp, true, false) or ft <= 0 or Duel.SelectOption(tp, 1190, 1152) == 0) then
  				Duel.SendtoHand(sc, nil, REASON_EFFECT)
  				Duel.ConfirmCards(1 - tp, sc)
  			else
  				if Duel.SpecialSummonStep(sc, 0, tp, tp, true, false, POS_FACEUP) then
  					local e1 = Effect.CreateEffect(e:GetHandler())
  					e1:SetType(EFFECT_TYPE_SINGLE)
  					e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  					e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  					e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  					sc:RegisterEffect(e1)
  				end
  				Duel.SpecialSummonComplete()
  			end
  		end
  	end
  end
  
  
source_text: Armed
  Target 1 "Armed Dragon" monster you control; take 1 monster with the same name from your Deck or GY, and either add it to your hand or Special Summon it, ignoring its Summoning conditions, but it cannot attack directly. You can only activate 1 "Armed Dragon Blitz" per turn. You cannot Special Summon monsters the turn you activate this card, except Dragon monsters.
target_text: -- Armed
  local SETCARD_ID_0 = 0x111 --Armed
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND + CATEGORY_SPECIAL_SUMMON + CATEGORY_DECKDES + CATEGORY_GRAVE_SPSUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return c:IsRace(RACE_DRAGON)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsRace(RACE_DRAGON)
  end
  function s.filter(c, e, tp)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.thfilter(c, e, tp, code)
  	if not (c:IsCode(code) and c:IsType(TYPE_MONSTER)) then
  		return false
  	end
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	return c:IsAbleToHand() or (ft > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, true, false))
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  		local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.thfilter), tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil, e, tp, tc:GetCode())
  		local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  		local sc = g:GetFirst()
  		if sc then
  			if sc:IsAbleToHand() and (not sc:IsCanBeSpecialSummoned(e, 0, tp, true, false) or ft <= 0 or Duel.SelectOption(tp, 1190, 1152) == 0) then
  				Duel.SendtoHand(sc, nil, REASON_EFFECT)
  				Duel.ConfirmCards(1 - tp, sc)
  			else
  				if Duel.SpecialSummonStep(sc, 0, tp, tp, true, false, POS_FACEUP) then
  					local e1 = Effect.CreateEffect(e:GetHandler())
  					e1:SetType(EFFECT_TYPE_SINGLE)
  					e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  					e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  					e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  					sc:RegisterEffect(e1)
  				end
  				Duel.SpecialSummonComplete()
  			end
  		end
  	end
  end
  
  