Trojan
Activate only when an opponent's card effect shifts control of a monster from your side of the field to theirs. Destroy that 1 monster and inflict damage to your opponent equal to its ATK.
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e1:SetCode(EVENT_CONTROL_CHANGED)
	e1:SetTarget(s.target)
	e1:SetOperation(s.operation)
	c:RegisterEffect(e1)
end
function s.filter(c, e, tp)
	return c:IsControler(1 - tp) and c:IsCanBeEffectTarget(e)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return eg:IsContains(chkc) and s.filter(chkc, e, tp)
	end
	if chk == 0 then
		return r == REASON_EFFECT and rp == 1 - tp and eg:IsExists(s.filter, 1, nil, e, tp)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
	local g = eg:FilterSelect(tp, s.filter, 1, 1, nil, e, tp)
	Duel.SetTargetCard(g)
	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, g:GetFirst():GetAttack())
end
function s.operation(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if not tc:IsRelateToEffect(e) then
		return
	end
	local atk = tc:GetAttack()
	if atk < 0 or tc:IsFacedown() then
		atk = 0
	end
	if Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
		Duel.Damage(1 - tp, atk, REASON_EFFECT)
	end
end


Trojan
Activate only when an opponent's card effect shifts control of a monster from your side of the field to theirs. Destroy that 1 monster and inflict damage to your opponent equal to its ATK.
-- Trojan
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e1:SetCode(EVENT_CONTROL_CHANGED)
	e1:SetTarget(s.target)
	e1:SetOperation(s.operation)
	c:RegisterEffect(e1)
end
function s.filter(c, e, tp)
	return c:IsControler(1 - tp) and c:IsCanBeEffectTarget(e)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return eg:IsContains(chkc) and s.filter(chkc, e, tp)
	end
	if chk == 0 then
		return r == REASON_EFFECT and rp == 1 - tp and eg:IsExists(s.filter, 1, nil, e, tp)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
	local g = eg:FilterSelect(tp, s.filter, 1, 1, nil, e, tp)
	Duel.SetTargetCard(g)
	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, g:GetFirst():GetAttack())
end
function s.operation(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if not tc:IsRelateToEffect(e) then
		return
	end
	local atk = tc:GetAttack()
	if atk < 0 or tc:IsFacedown() then
		atk = 0
	end
	if Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
		Duel.Damage(1 - tp, atk, REASON_EFFECT)
	end
end

