name: Ehren,
card_text: If this card attacks a Defense Position monster, before damage calculation: Shuffle that monster into the Deck. Once per turn, during your End Phase: Send the top 3 cards of your Deck to the Graveyard.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--to deck
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TODECK)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_BATTLE_CONFIRM)
  	e1:SetTarget(s.targ)
  	e1:SetOperation(s.op)
  	c:RegisterEffect(e1)
  	--discard deck
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCategory(CATEGORY_DECKDES)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCode(EVENT_PHASE + PHASE_END)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.discon)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  end
  function s.targ(e, tp, eg, ep, ev, re, r, rp, chk)
  	local t = Duel.GetAttackTarget()
  	if chk == 0 then
  		return Duel.GetAttacker() == e:GetHandler() and t ~= nil and not t:IsAttackPos() and t:IsAbleToDeck()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, t, 1, 0, 0)
  end
  function s.op(e, tp, eg, ep, ev, re, r, rp)
  	local t = Duel.GetAttackTarget()
  	if t ~= nil and t:IsRelateToBattle() and not t:IsAttackPos() then
  		Duel.SendtoDeck(t, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
  	end
  end
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return tp == Duel.GetTurnPlayer()
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, nil, 0, tp, 3)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.DiscardDeck(tp, 3, REASON_EFFECT)
  end
  
  
source_text: Ehren,
  If this card attacks a Defense Position monster, before damage calculation: Shuffle that monster into the Deck. Once per turn, during your End Phase: Send the top 3 cards of your Deck to the Graveyard.
target_text: -- Ehren,
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--to deck
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TODECK)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_BATTLE_CONFIRM)
  	e1:SetTarget(s.targ)
  	e1:SetOperation(s.op)
  	c:RegisterEffect(e1)
  	--discard deck
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCategory(CATEGORY_DECKDES)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCode(EVENT_PHASE + PHASE_END)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.discon)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  end
  function s.targ(e, tp, eg, ep, ev, re, r, rp, chk)
  	local t = Duel.GetAttackTarget()
  	if chk == 0 then
  		return Duel.GetAttacker() == e:GetHandler() and t ~= nil and not t:IsAttackPos() and t:IsAbleToDeck()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, t, 1, 0, 0)
  end
  function s.op(e, tp, eg, ep, ev, re, r, rp)
  	local t = Duel.GetAttackTarget()
  	if t ~= nil and t:IsRelateToBattle() and not t:IsAttackPos() then
  		Duel.SendtoDeck(t, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
  	end
  end
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return tp == Duel.GetTurnPlayer()
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, nil, 0, tp, 3)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.DiscardDeck(tp, 3, REASON_EFFECT)
  end
  
  