name: D.D.
card_text: When this card is Normal Summoned, give control of it to your opponent. During each player's End Phase, your opponent selects 1 card from the Graveyard of this card's controller and removes it from play.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--control
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_CONTROL)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetTarget(s.ctltg)
  	e1:SetOperation(s.ctlop)
  	c:RegisterEffect(e1)
  	--remove
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCategory(CATEGORY_REMOVE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_PHASE + PHASE_END)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.rmtg)
  	e2:SetOperation(s.rmop)
  	c:RegisterEffect(e2)
  end
  function s.ctltg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, e:GetHandler(), 1, 0, 0)
  end
  function s.ctlop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	Duel.GetControl(c, 1 - tp)
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToRemove(1 - tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsAbleToRemove, tp, LOCATION_GRAVE, 0, 1, nil, 1 - tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(1 - tp, Card.IsAbleToRemove, tp, LOCATION_GRAVE, 0, 1, 1, nil, 1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, tp, LOCATION_GRAVE)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  
  
source_text: D.D.
  When this card is Normal Summoned, give control of it to your opponent. During each player's End Phase, your opponent selects 1 card from the Graveyard of this card's controller and removes it from play.
target_text: -- D.D.
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--control
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_CONTROL)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetTarget(s.ctltg)
  	e1:SetOperation(s.ctlop)
  	c:RegisterEffect(e1)
  	--remove
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCategory(CATEGORY_REMOVE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_PHASE + PHASE_END)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.rmtg)
  	e2:SetOperation(s.rmop)
  	c:RegisterEffect(e2)
  end
  function s.ctltg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, e:GetHandler(), 1, 0, 0)
  end
  function s.ctlop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	Duel.GetControl(c, 1 - tp)
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToRemove(1 - tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsAbleToRemove, tp, LOCATION_GRAVE, 0, 1, nil, 1 - tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(1 - tp, Card.IsAbleToRemove, tp, LOCATION_GRAVE, 0, 1, 1, nil, 1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, tp, LOCATION_GRAVE)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  
  