name: Psi-Curse
card_text: When a Psychic-Type monster you control is destroyed by battle with an opponent's attacking monster and sent to the Graveyard: Target the opponent's monster; destroy that target, and if you do, inflict damage to your opponent equal to the Level of your destroyed Psychic-Type monster x 300.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_BATTLE_DESTROYED)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local tc = eg:GetFirst()
  	local bc = tc:GetBattleTarget()
  	return tc:IsPreviousControler(tp)
  		and tc:IsLocation(LOCATION_GRAVE)
  		and tc:IsRace(RACE_PSYCHO)
  		and bit.band(tc:GetBattlePosition(), POS_FACEUP) ~= 0
  		and bc:IsRelateToBattle()
  		and bc:IsControler(1 - tp)
  		and bc == Duel.GetAttacker()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local tc = eg:GetFirst()
  	local bc = Duel.GetAttacker()
  	if chk == 0 then
  		return bc:IsCanBeEffectTarget(e)
  	end
  	local lv = tc:GetLevel()
  	e:SetLabel(lv)
  	Duel.SetTargetCard(bc)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, bc, 1, 0, 0)
  	if lv ~= 0 then
  		Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, lv * 300)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
  		Duel.Damage(1 - tp, e:GetLabel() * 300, REASON_EFFECT)
  	end
  end
  
  
source_text: Psi-Curse
  When a Psychic-Type monster you control is destroyed by battle with an opponent's attacking monster and sent to the Graveyard: Target the opponent's monster; destroy that target, and if you do, inflict damage to your opponent equal to the Level of your destroyed Psychic-Type monster x 300.
target_text: -- Psi-Curse
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_BATTLE_DESTROYED)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local tc = eg:GetFirst()
  	local bc = tc:GetBattleTarget()
  	return tc:IsPreviousControler(tp)
  		and tc:IsLocation(LOCATION_GRAVE)
  		and tc:IsRace(RACE_PSYCHO)
  		and bit.band(tc:GetBattlePosition(), POS_FACEUP) ~= 0
  		and bc:IsRelateToBattle()
  		and bc:IsControler(1 - tp)
  		and bc == Duel.GetAttacker()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local tc = eg:GetFirst()
  	local bc = Duel.GetAttacker()
  	if chk == 0 then
  		return bc:IsCanBeEffectTarget(e)
  	end
  	local lv = tc:GetLevel()
  	e:SetLabel(lv)
  	Duel.SetTargetCard(bc)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, bc, 1, 0, 0)
  	if lv ~= 0 then
  		Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, lv * 300)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
  		Duel.Damage(1 - tp, e:GetLabel() * 300, REASON_EFFECT)
  	end
  end
  
  