name: Psychic
card_text: Send 1 monster your opponent controls that was Special Summoned from the Extra Deck to the GY, then your opponent gains LP equal to the original ATK or DEF of that monster (whichever is higher). You can only activate 1 "Psychic Eraser Laser" per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_RECOVER)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:GetSummonLocation() == LOCATION_EXTRA and c:IsAbleToGrave()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, 1 - tp, LOCATION_MZONE)
  	Duel.SetOperationInfo(0, CATEGORY_RECOVER, nil, 0, 1 - tp, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.HintSelection(g)
  		if Duel.SendtoGrave(tc, REASON_EFFECT) ~= 0 and tc:IsLocation(LOCATION_GRAVE) and tc:IsType(TYPE_MONSTER) then
  			local atk = tc:GetBaseAttack()
  			local def = tc:GetBaseDefense()
  			local rec = atk >= def and atk or def
  			if rec > 0 then
  				Duel.BreakEffect()
  				Duel.Recover(1 - tp, rec, REASON_EFFECT)
  			end
  		end
  	end
  end
  
  
source_text: Psychic
  Send 1 monster your opponent controls that was Special Summoned from the Extra Deck to the GY, then your opponent gains LP equal to the original ATK or DEF of that monster (whichever is higher). You can only activate 1 "Psychic Eraser Laser" per turn.
target_text: -- Psychic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_RECOVER)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:GetSummonLocation() == LOCATION_EXTRA and c:IsAbleToGrave()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, 1 - tp, LOCATION_MZONE)
  	Duel.SetOperationInfo(0, CATEGORY_RECOVER, nil, 0, 1 - tp, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.HintSelection(g)
  		if Duel.SendtoGrave(tc, REASON_EFFECT) ~= 0 and tc:IsLocation(LOCATION_GRAVE) and tc:IsType(TYPE_MONSTER) then
  			local atk = tc:GetBaseAttack()
  			local def = tc:GetBaseDefense()
  			local rec = atk >= def and atk or def
  			if rec > 0 then
  				Duel.BreakEffect()
  				Duel.Recover(1 - tp, rec, REASON_EFFECT)
  			end
  		end
  	end
  end
  
  