name: Dragon
card_text: Send 1 Dragon monster from your Deck to the GY, then, if that monster in your GY is a Dragon Normal Monster, you can send 1 more Dragon monster from your Deck to the GY. You can only activate 1 "Dragon Shrine" per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.tgfilter(c)
  	return c:IsRace(RACE_DRAGON) and c:IsAbleToGrave()
  end
  function s.target(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.activate(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)
  	local tc = g:GetFirst()
  	if
  		tc
  		and Duel.SendtoGrave(tc, REASON_EFFECT) > 0
  		and tc:IsLocation(LOCATION_GRAVE)
  		and tc:IsRace(RACE_DRAGON)
  		and tc:IsType(TYPE_NORMAL)
  		and Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil)
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 0))
  	then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local g1 = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  		Duel.SendtoGrave(g1, REASON_EFFECT)
  	end
  end
  
  
source_text: Dragon
  Send 1 Dragon monster from your Deck to the GY, then, if that monster in your GY is a Dragon Normal Monster, you can send 1 more Dragon monster from your Deck to the GY. You can only activate 1 "Dragon Shrine" per turn.
target_text: -- Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.tgfilter(c)
  	return c:IsRace(RACE_DRAGON) and c:IsAbleToGrave()
  end
  function s.target(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.activate(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)
  	local tc = g:GetFirst()
  	if
  		tc
  		and Duel.SendtoGrave(tc, REASON_EFFECT) > 0
  		and tc:IsLocation(LOCATION_GRAVE)
  		and tc:IsRace(RACE_DRAGON)
  		and tc:IsType(TYPE_NORMAL)
  		and Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil)
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 0))
  	then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local g1 = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  		Duel.SendtoGrave(g1, REASON_EFFECT)
  	end
  end
  
  