name: Animadorned
card_text: If this card is Normal or Special Summoned: You can destroy 1 Dinosaur monster in your hand or face-up field, except "Animadorned Archosaur", then add 1 Reptile, Sea Serpent, or Winged Beast monster with the same original Level as that destroyed monster, OR 1 "Evolution Pill" Spell, from your Deck to your hand. You can only use this effect of "Animadorned Archosaur" once per turn.
external_ids: local SETCARD_ID_0 = 0x10e --Evolution
  
lua: local SETCARD_ID_0 = 0x10e --Evolution
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  end
  function s.desfilter(c, tp, solve)
  	return c:IsRace(RACE_DINOSAUR)
  		and not c:IsCode(id)
  		and (c:IsFaceup() or c:IsLocation(LOCATION_HAND))
  		and (solve or Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil, c:GetOriginalLevel()))
  end
  function s.thfilter(c, lv)
  	return ((c:GetOriginalLevel() == lv and c:IsRace(RACE_REPTILE + RACE_SEASERPENT + RACE_WINDBEAST)) or (c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL))) and c:IsAbleToHand()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil, tp)
  	end
  	local g = Duel.GetMatchingGroup(s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, nil, tp)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil, tp)
  	if g:GetCount() == 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		g = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil, tp, true)
  	end
  	local tc = g:GetFirst()
  	if tc and Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
  		local lv = tc:GetOriginalLevel()
  		if Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil, lv) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  			local tg = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil, lv)
  			Duel.SendtoHand(tg, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tg)
  		end
  	end
  end
  
  
source_text: Animadorned
  If this card is Normal or Special Summoned: You can destroy 1 Dinosaur monster in your hand or face-up field, except "Animadorned Archosaur", then add 1 Reptile, Sea Serpent, or Winged Beast monster with the same original Level as that destroyed monster, OR 1 "Evolution Pill" Spell, from your Deck to your hand. You can only use this effect of "Animadorned Archosaur" once per turn.
target_text: -- Animadorned
  local SETCARD_ID_0 = 0x10e --Evolution
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  end
  function s.desfilter(c, tp, solve)
  	return c:IsRace(RACE_DINOSAUR)
  		and not c:IsCode(id)
  		and (c:IsFaceup() or c:IsLocation(LOCATION_HAND))
  		and (solve or Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil, c:GetOriginalLevel()))
  end
  function s.thfilter(c, lv)
  	return ((c:GetOriginalLevel() == lv and c:IsRace(RACE_REPTILE + RACE_SEASERPENT + RACE_WINDBEAST)) or (c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL))) and c:IsAbleToHand()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil, tp)
  	end
  	local g = Duel.GetMatchingGroup(s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, nil, tp)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil, tp)
  	if g:GetCount() == 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		g = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil, tp, true)
  	end
  	local tc = g:GetFirst()
  	if tc and Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
  		local lv = tc:GetOriginalLevel()
  		if Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil, lv) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  			local tg = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil, lv)
  			Duel.SendtoHand(tg, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tg)
  		end
  	end
  end
  
  