name: Tackle
card_text: If this card is sent to the GY: You can activate 1 of these effects.
  ● Target 1 face-up monster your opponent controls; change that target to face-down Defense Position.
  ● Target 1 face-up Spell/Trap your opponent controls; return that target to the hand. This turn, your opponent cannot activate cards with the same name as the card returned to the hand by this effect.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_TO_GRAVE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter1(c)
  	return c:IsFaceup() and c:IsCanTurnSet()
  end
  function s.filter2(c)
  	return c:IsFaceup() and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local b1 = Duel.IsExistingTarget(s.filter1, tp, 0, LOCATION_MZONE, 1, nil)
  	local b2 = Duel.IsExistingTarget(s.filter2, tp, 0, LOCATION_ONFIELD, 1, nil)
  	if chk == 0 then
  		return b1 or b2
  	end
  	local op = 0
  	if b1 and b2 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 1), aux.Stringid(id, 2))
  	elseif b1 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 1))
  	else
  		op = Duel.SelectOption(tp, aux.Stringid(id, 2)) + 1
  	end
  	e:SetLabel(op)
  	if op == 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_POSCHANGE)
  		local g = Duel.SelectTarget(tp, s.filter1, tp, 0, LOCATION_MZONE, 1, 1, nil)
  		e:SetCategory(CATEGORY_POSITION)
  		Duel.SetOperationInfo(0, CATEGORY_POSITION, g, 1, 0, 0)
  	else
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  		local g = Duel.SelectTarget(tp, s.filter2, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  		e:SetCategory(CATEGORY_TOHAND)
  		Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if not tc:IsRelateToEffect(e) then
  		return
  	end
  	if e:GetLabel() == 0 then
  		Duel.ChangePosition(tc, POS_FACEDOWN_DEFENSE)
  	else
  		local code = tc:GetCode()
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  		e1:SetTargetRange(0, 1)
  		e1:SetValue(s.aclimit)
  		e1:SetLabel(code)
  		e1:SetReset(RESET_PHASE + PHASE_END)
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  function s.aclimit(e, re, tp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsCode(e:GetLabel())
  end
  
  
source_text: Tackle
  If this card is sent to the GY: You can activate 1 of these effects.
  ● Target 1 face-up monster your opponent controls; change that target to face-down Defense Position.
  ● Target 1 face-up Spell/Trap your opponent controls; return that target to the hand. This turn, your opponent cannot activate cards with the same name as the card returned to the hand by this effect.
target_text: -- Tackle
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_TO_GRAVE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter1(c)
  	return c:IsFaceup() and c:IsCanTurnSet()
  end
  function s.filter2(c)
  	return c:IsFaceup() and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local b1 = Duel.IsExistingTarget(s.filter1, tp, 0, LOCATION_MZONE, 1, nil)
  	local b2 = Duel.IsExistingTarget(s.filter2, tp, 0, LOCATION_ONFIELD, 1, nil)
  	if chk == 0 then
  		return b1 or b2
  	end
  	local op = 0
  	if b1 and b2 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 1), aux.Stringid(id, 2))
  	elseif b1 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 1))
  	else
  		op = Duel.SelectOption(tp, aux.Stringid(id, 2)) + 1
  	end
  	e:SetLabel(op)
  	if op == 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_POSCHANGE)
  		local g = Duel.SelectTarget(tp, s.filter1, tp, 0, LOCATION_MZONE, 1, 1, nil)
  		e:SetCategory(CATEGORY_POSITION)
  		Duel.SetOperationInfo(0, CATEGORY_POSITION, g, 1, 0, 0)
  	else
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  		local g = Duel.SelectTarget(tp, s.filter2, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  		e:SetCategory(CATEGORY_TOHAND)
  		Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if not tc:IsRelateToEffect(e) then
  		return
  	end
  	if e:GetLabel() == 0 then
  		Duel.ChangePosition(tc, POS_FACEDOWN_DEFENSE)
  	else
  		local code = tc:GetCode()
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  		e1:SetTargetRange(0, 1)
  		e1:SetValue(s.aclimit)
  		e1:SetLabel(code)
  		e1:SetReset(RESET_PHASE + PHASE_END)
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  function s.aclimit(e, re, tp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsCode(e:GetLabel())
  end
  
  