name: Goblin
card_text: Once per turn, during your End Phase: Reveal the bottom card of your Deck, then place it on the top of the Deck or banish it face-down.
lua: 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)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PHASE + PHASE_END)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.cfcon)
  	e2:SetOperation(s.cfop)
  	c:RegisterEffect(e2)
  end
  function s.cfcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp and Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) ~= 0
  end
  function s.cfop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetFieldGroup(tp, LOCATION_DECK, 0)
  	if g:GetCount() == 0 then
  		return
  	end
  	local tc = g:GetMinGroup(Card.GetSequence):GetFirst()
  	Duel.MoveSequence(tc, SEQ_DECKTOP)
  	Duel.ConfirmDecktop(tp, 1)
  	if tc:IsAbleToRemove(tp, POS_FACEDOWN) and Duel.SelectYesNo(tp, aux.Stringid(id, 1)) then
  		Duel.DisableShuffleCheck()
  		Duel.Remove(tc, POS_FACEDOWN, REASON_EFFECT)
  	end
  end
  
  
source_text: Goblin
  Once per turn, during your End Phase: Reveal the bottom card of your Deck, then place it on the top of the Deck or banish it face-down.
target_text: -- Goblin
  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)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PHASE + PHASE_END)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.cfcon)
  	e2:SetOperation(s.cfop)
  	c:RegisterEffect(e2)
  end
  function s.cfcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp and Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) ~= 0
  end
  function s.cfop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetFieldGroup(tp, LOCATION_DECK, 0)
  	if g:GetCount() == 0 then
  		return
  	end
  	local tc = g:GetMinGroup(Card.GetSequence):GetFirst()
  	Duel.MoveSequence(tc, SEQ_DECKTOP)
  	Duel.ConfirmDecktop(tp, 1)
  	if tc:IsAbleToRemove(tp, POS_FACEDOWN) and Duel.SelectYesNo(tp, aux.Stringid(id, 1)) then
  		Duel.DisableShuffleCheck()
  		Duel.Remove(tc, POS_FACEDOWN, REASON_EFFECT)
  	end
  end
  
  