Trickstar
2 "Trickstar" monsters
Each time a monster(s) this card points to is destroyed by battle or card effect and sent to the GY, inflict 200 damage to your opponent. Each time your opponent takes damage by a "Trickstar" monster's effect: Face-up monsters they control lose 200 ATK for each monster this card points to, until the end of this turn.
local SETCARD_ID_0 = 0xfb --Trickstar

local SETCARD_ID_0 = 0xfb --Trickstar
local s, id, o = GetID()
function s.initial_effect(c)
	--link summon
	c:EnableReviveLimit()
	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkSetCard, SETCARD_ID_0), 2, 2)
	--damage
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_DAMAGE)
	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
	e2:SetCode(EVENT_TO_GRAVE)
	e2:SetRange(LOCATION_MZONE)
	e2:SetCondition(s.damcon)
	e2:SetOperation(s.damop)
	c:RegisterEffect(e2)
	--atkdown
	local e3 = Effect.CreateEffect(c)
	e3:SetCategory(CATEGORY_ATKCHANGE)
	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
	e3:SetCode(EVENT_DAMAGE)
	e3:SetRange(LOCATION_MZONE)
	e3:SetCondition(s.atkcon)
	e3:SetOperation(s.atkop)
	c:RegisterEffect(e3)
end
function s.cfilter(c, tp, zone)
	local seq = c:GetPreviousSequence()
	if c:IsPreviousControler(1 - tp) then
		seq = seq + 16
	end
	return c:IsReason(REASON_DESTROY) and c:IsReason(REASON_BATTLE + REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and bit.extract(zone, seq) ~= 0
end
function s.damcon(e, tp, eg, ep, ev, re, r, rp)
	return eg:IsExists(s.cfilter, 1, nil, tp, e:GetHandler():GetLinkedZone())
end
function s.damop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_CARD, 0, id)
	Duel.Damage(1 - tp, 200, REASON_EFFECT)
end
function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
	return ep ~= tp and bit.band(r, REASON_BATTLE) == 0 and re and re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsSetCard(SETCARD_ID_0)
end
function s.atkop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local ct = c:GetLinkedGroupCount()
	if ct <= 0 then
		return
	end
	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, 0, LOCATION_MZONE, nil)
	local tc = g:GetFirst()
	while tc do
		local e1 = Effect.CreateEffect(c)
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_UPDATE_ATTACK)
		e1:SetValue(-ct * 200)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e1)
		tc = g:GetNext()
	end
end


Trickstar
2 "Trickstar" monsters
Each time a monster(s) this card points to is destroyed by battle or card effect and sent to the GY, inflict 200 damage to your opponent. Each time your opponent takes damage by a "Trickstar" monster's effect: Face-up monsters they control lose 200 ATK for each monster this card points to, until the end of this turn.
-- Trickstar
local SETCARD_ID_0 = 0xfb --Trickstar
local s, id, o = GetID()
function s.initial_effect(c)
	--link summon
	c:EnableReviveLimit()
	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkSetCard, SETCARD_ID_0), 2, 2)
	--damage
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_DAMAGE)
	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
	e2:SetCode(EVENT_TO_GRAVE)
	e2:SetRange(LOCATION_MZONE)
	e2:SetCondition(s.damcon)
	e2:SetOperation(s.damop)
	c:RegisterEffect(e2)
	--atkdown
	local e3 = Effect.CreateEffect(c)
	e3:SetCategory(CATEGORY_ATKCHANGE)
	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
	e3:SetCode(EVENT_DAMAGE)
	e3:SetRange(LOCATION_MZONE)
	e3:SetCondition(s.atkcon)
	e3:SetOperation(s.atkop)
	c:RegisterEffect(e3)
end
function s.cfilter(c, tp, zone)
	local seq = c:GetPreviousSequence()
	if c:IsPreviousControler(1 - tp) then
		seq = seq + 16
	end
	return c:IsReason(REASON_DESTROY) and c:IsReason(REASON_BATTLE + REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and bit.extract(zone, seq) ~= 0
end
function s.damcon(e, tp, eg, ep, ev, re, r, rp)
	return eg:IsExists(s.cfilter, 1, nil, tp, e:GetHandler():GetLinkedZone())
end
function s.damop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_CARD, 0, id)
	Duel.Damage(1 - tp, 200, REASON_EFFECT)
end
function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
	return ep ~= tp and bit.band(r, REASON_BATTLE) == 0 and re and re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsSetCard(SETCARD_ID_0)
end
function s.atkop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local ct = c:GetLinkedGroupCount()
	if ct <= 0 then
		return
	end
	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, 0, LOCATION_MZONE, nil)
	local tc = g:GetFirst()
	while tc do
		local e1 = Effect.CreateEffect(c)
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_UPDATE_ATTACK)
		e1:SetValue(-ct * 200)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e1)
		tc = g:GetNext()
	end
end

