name: 竜の渓谷
card_text: 1:1ターンに1度、手札を1枚捨て、以下の効果から1つを選択して発動できる。
  ●デッキからレベル4以下の「ドラグニティ」モンスター1体を手札に加える。
  ●デッキからドラゴン族モンスター1体を墓地へ送る。
external_ids: local SETCARD_ID_0 = 0x29 --ドラグニティ
  
lua: local SETCARD_ID_0 = 0x29 --ドラグニティ
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.target1)
  	e2:SetOperation(s.operation1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCategory(CATEGORY_TOGRAVE)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetTarget(s.target2)
  	e3:SetOperation(s.operation2)
  	c:RegisterEffect(e3)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  	Duel.DiscardHand(tp, Card.IsDiscardable, 1, 1, REASON_COST + REASON_DISCARD)
  end
  function s.filter1(c)
  	return c:IsLevelBelow(4) and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.filter2(c)
  	return c:IsRace(RACE_DRAGON) and c:IsAbleToGrave()
  end
  function s.target1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter1, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.target2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.operation1(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.filter1, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.operation2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  
  
source_text: 竜の渓谷
  1:1ターンに1度、手札を1枚捨て、以下の効果から1つを選択して発動できる。
  ●デッキからレベル4以下の「ドラグニティ」モンスター1体を手札に加える。
  ●デッキからドラゴン族モンスター1体を墓地へ送る。
target_text: -- 竜の渓谷
  local SETCARD_ID_0 = 0x29 --ドラグニティ
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.target1)
  	e2:SetOperation(s.operation1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCategory(CATEGORY_TOGRAVE)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetTarget(s.target2)
  	e3:SetOperation(s.operation2)
  	c:RegisterEffect(e3)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  	Duel.DiscardHand(tp, Card.IsDiscardable, 1, 1, REASON_COST + REASON_DISCARD)
  end
  function s.filter1(c)
  	return c:IsLevelBelow(4) and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.filter2(c)
  	return c:IsRace(RACE_DRAGON) and c:IsAbleToGrave()
  end
  function s.target1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter1, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.target2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.operation1(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.filter1, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.operation2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  
  