Starlight
When a card or effect is activated that would destroy 2 or more cards you control: Negate the effect, and if you do, destroy that card, then you can Special Summon 1 "Stardust Dragon" from your Extra Deck.
local CARD_ID_0 = 44508094 --Stardust Dragon

local CARD_ID_0 = 44508094 --Stardust Dragon
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_0)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_DISABLE + CATEGORY_DESTROY)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_CHAINING)
	e1:SetCondition(s.condition)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.filter(c, p)
	return c:GetControler() == p and c:IsOnField()
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	if not Duel.IsChainNegatable(ev) then
		return false
	end
	local ex, tg, tc = Duel.GetOperationInfo(ev, CATEGORY_DESTROY)
	return ex and tg ~= nil and tc + tg:FilterCount(s.filter, nil, tp) - tg:GetCount() > 1
end
function s.sfilter(c, e, tp)
	return c:IsCode(CARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetOperationInfo(0, CATEGORY_DISABLE, eg, 1, 0, 0)
	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
	end
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg, REASON_EFFECT) ~= 0 then
		local sc = Duel.GetFirstMatchingCard(s.sfilter, tp, LOCATION_EXTRA, 0, nil, e, tp)
		if sc and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
			Duel.BreakEffect()
			Duel.SpecialSummon(sc, 0, tp, tp, false, false, POS_FACEUP)
		end
	end
end


Starlight
When a card or effect is activated that would destroy 2 or more cards you control: Negate the effect, and if you do, destroy that card, then you can Special Summon 1 "Stardust Dragon" from your Extra Deck.
-- Starlight
local CARD_ID_0 = 44508094 --Stardust Dragon
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_0)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_DISABLE + CATEGORY_DESTROY)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_CHAINING)
	e1:SetCondition(s.condition)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.filter(c, p)
	return c:GetControler() == p and c:IsOnField()
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	if not Duel.IsChainNegatable(ev) then
		return false
	end
	local ex, tg, tc = Duel.GetOperationInfo(ev, CATEGORY_DESTROY)
	return ex and tg ~= nil and tc + tg:FilterCount(s.filter, nil, tp) - tg:GetCount() > 1
end
function s.sfilter(c, e, tp)
	return c:IsCode(CARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetOperationInfo(0, CATEGORY_DISABLE, eg, 1, 0, 0)
	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
	end
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg, REASON_EFFECT) ~= 0 then
		local sc = Duel.GetFirstMatchingCard(s.sfilter, tp, LOCATION_EXTRA, 0, nil, e, tp)
		if sc and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
			Duel.BreakEffect()
			Duel.SpecialSummon(sc, 0, tp, tp, false, false, POS_FACEUP)
		end
	end
end

