name: Dr.
card_text: If this card is Normal or Special Summoned: You can pay 500 LP; look at the top card of your Deck, then place it on the bottom of your Deck, OR reveal it and add it to your hand, but skip your next Draw Phase if added to the hand. You can only use this effect of "Dr. Frankenderp" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--tohand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 500)
  	end
  	Duel.PayLPCost(tp, 500)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) > 0
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetDecktopGroup(tp, 1)
  	Duel.ConfirmCards(tp, g)
  	if not g:GetFirst():IsAbleToHand() or Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.MoveSequence(g:GetFirst(), SEQ_DECKBOTTOM)
  	else
  		Duel.DisableShuffleCheck()
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  		Duel.ShuffleHand(tp)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetTargetRange(1, 0)
  		e1:SetCode(EFFECT_SKIP_DP)
  		if Duel.GetTurnPlayer() == tp and Duel.GetCurrentPhase() == PHASE_DRAW then
  			e1:SetReset(RESET_PHASE + PHASE_DRAW + RESET_SELF_TURN, 2)
  		else
  			e1:SetReset(RESET_PHASE + PHASE_DRAW + RESET_SELF_TURN)
  		end
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  
  
source_text: Dr.
  If this card is Normal or Special Summoned: You can pay 500 LP; look at the top card of your Deck, then place it on the bottom of your Deck, OR reveal it and add it to your hand, but skip your next Draw Phase if added to the hand. You can only use this effect of "Dr. Frankenderp" once per turn.
target_text: -- Dr.
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--tohand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 500)
  	end
  	Duel.PayLPCost(tp, 500)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) > 0
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetDecktopGroup(tp, 1)
  	Duel.ConfirmCards(tp, g)
  	if not g:GetFirst():IsAbleToHand() or Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.MoveSequence(g:GetFirst(), SEQ_DECKBOTTOM)
  	else
  		Duel.DisableShuffleCheck()
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  		Duel.ShuffleHand(tp)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetTargetRange(1, 0)
  		e1:SetCode(EFFECT_SKIP_DP)
  		if Duel.GetTurnPlayer() == tp and Duel.GetCurrentPhase() == PHASE_DRAW then
  			e1:SetReset(RESET_PHASE + PHASE_DRAW + RESET_SELF_TURN, 2)
  		else
  			e1:SetReset(RESET_PHASE + PHASE_DRAW + RESET_SELF_TURN)
  		end
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  
  