name: An
card_text: FLIP: Select 1 Field Spell Card from your Deck and place it on top of your Deck. If "Necrovalley" is on the field, you can add the selected Field Spell Card to your hand instead.
external_ids: local CARD_ID_0 = 47355498 --Necrovalley
  
lua: local CARD_ID_0 = 47355498 --Necrovalley
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--flip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_FLIP)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 1))
  	local g = Duel.SelectMatchingCard(tp, Card.IsType, tp, LOCATION_DECK, 0, 1, 1, nil, TYPE_FIELD)
  	local tc = g:GetFirst()
  	if tc then
  		if Duel.IsEnvironment(CARD_ID_0) and tc:IsAbleToHand() and Duel.SelectOption(tp, 1190, aux.Stringid(id, 0)) == 0 then
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tc)
  		else
  			Duel.ShuffleDeck(tp)
  			Duel.MoveSequence(tc, SEQ_DECKTOP)
  			Duel.ConfirmDecktop(tp, 1)
  		end
  	end
  end
  
  
source_text: An
  FLIP: Select 1 Field Spell Card from your Deck and place it on top of your Deck. If "Necrovalley" is on the field, you can add the selected Field Spell Card to your hand instead.
target_text: -- An
  local CARD_ID_0 = 47355498 --Necrovalley
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--flip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_FLIP)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 1))
  	local g = Duel.SelectMatchingCard(tp, Card.IsType, tp, LOCATION_DECK, 0, 1, 1, nil, TYPE_FIELD)
  	local tc = g:GetFirst()
  	if tc then
  		if Duel.IsEnvironment(CARD_ID_0) and tc:IsAbleToHand() and Duel.SelectOption(tp, 1190, aux.Stringid(id, 0)) == 0 then
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tc)
  		else
  			Duel.ShuffleDeck(tp)
  			Duel.MoveSequence(tc, SEQ_DECKTOP)
  			Duel.ConfirmDecktop(tp, 1)
  		end
  	end
  end
  
  