Box
If this card is destroyed and sent to the GY: You can Special Summon 2 Normal Monsters with 0 ATK or DEF and different names from your Deck in Defense Position, but they cannot be used as Synchro Material, also they are destroyed during your next End Phase. You can only use this effect of "Box of Friends" once per turn.
local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon

local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
local s, id, o = GetID()
function s.initial_effect(c)
	--special summon
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 0))
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
	e1:SetCode(EVENT_TO_GRAVE)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.spcon)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	c:RegisterEffect(e1)
end
function s.spcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsReason(REASON_DESTROY)
end
function s.filter1(c, e, tp)
	return c:IsType(TYPE_NORMAL) and (c:IsAttack(0) or c:IsDefense(0)) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_DEFENSE)
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
			return false
		end
		if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
			return false
		end
		local g = Duel.GetMatchingGroup(s.filter1, tp, LOCATION_DECK, 0, nil, e, tp)
		return g:GetClassCount(Card.GetCode) >= 2
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, tp, LOCATION_DECK)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
		return
	end
	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
		return
	end
	local g = Duel.GetMatchingGroup(s.filter1, tp, LOCATION_DECK, 0, nil, e, tp)
	if g:GetClassCount(Card.GetCode) >= 2 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
		local sg = g:SelectSubGroup(tp, aux.dncheck, false, 2, 2)
		local tc1 = sg:GetFirst()
		local tc2 = sg:GetNext()
		Duel.SpecialSummonStep(tc1, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
		Duel.SpecialSummonStep(tc2, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
		tc1:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
		tc2:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
		e1:SetValue(1)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
		tc1:RegisterEffect(e1)
		local e2 = e1:Clone()
		tc2:RegisterEffect(e2)
		Duel.SpecialSummonComplete()
		sg:KeepAlive()
		local de = Effect.CreateEffect(e:GetHandler())
		de:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
		de:SetCode(EVENT_PHASE + PHASE_END)
		de:SetCountLimit(1)
		de:SetLabelObject(sg)
		de:SetCondition(s.descon)
		de:SetOperation(s.desop)
		if Duel.GetTurnPlayer() == tp and Duel.GetCurrentPhase() == PHASE_END then
			de:SetLabel(Duel.GetTurnCount())
			de:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
		else
			de:SetLabel(0)
			de:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN)
		end
		Duel.RegisterEffect(de, tp)
	end
end
function s.descon(e, tp, eg, ep, ev, re, r, rp)
	local g = e:GetLabelObject()
	if not g:IsExists(s.desfilter, 1, nil) then
		g:DeleteGroup()
		e:Reset()
		return false
	end
	return Duel.GetTurnPlayer() == tp and Duel.GetTurnCount() ~= e:GetLabel()
end
function s.desfilter(c)
	return c:GetFlagEffect(id) > 0
end
function s.desop(e, tp, eg, ep, ev, re, r, rp)
	local g = e:GetLabelObject()
	local tg = g:Filter(s.desfilter, nil)
	g:DeleteGroup()
	Duel.Destroy(tg, REASON_EFFECT)
end


Box
If this card is destroyed and sent to the GY: You can Special Summon 2 Normal Monsters with 0 ATK or DEF and different names from your Deck in Defense Position, but they cannot be used as Synchro Material, also they are destroyed during your next End Phase. You can only use this effect of "Box of Friends" once per turn.
-- Box
local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
local s, id, o = GetID()
function s.initial_effect(c)
	--special summon
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 0))
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
	e1:SetCode(EVENT_TO_GRAVE)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.spcon)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	c:RegisterEffect(e1)
end
function s.spcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsReason(REASON_DESTROY)
end
function s.filter1(c, e, tp)
	return c:IsType(TYPE_NORMAL) and (c:IsAttack(0) or c:IsDefense(0)) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_DEFENSE)
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
			return false
		end
		if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
			return false
		end
		local g = Duel.GetMatchingGroup(s.filter1, tp, LOCATION_DECK, 0, nil, e, tp)
		return g:GetClassCount(Card.GetCode) >= 2
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, tp, LOCATION_DECK)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
		return
	end
	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
		return
	end
	local g = Duel.GetMatchingGroup(s.filter1, tp, LOCATION_DECK, 0, nil, e, tp)
	if g:GetClassCount(Card.GetCode) >= 2 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
		local sg = g:SelectSubGroup(tp, aux.dncheck, false, 2, 2)
		local tc1 = sg:GetFirst()
		local tc2 = sg:GetNext()
		Duel.SpecialSummonStep(tc1, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
		Duel.SpecialSummonStep(tc2, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
		tc1:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
		tc2:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
		e1:SetValue(1)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
		tc1:RegisterEffect(e1)
		local e2 = e1:Clone()
		tc2:RegisterEffect(e2)
		Duel.SpecialSummonComplete()
		sg:KeepAlive()
		local de = Effect.CreateEffect(e:GetHandler())
		de:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
		de:SetCode(EVENT_PHASE + PHASE_END)
		de:SetCountLimit(1)
		de:SetLabelObject(sg)
		de:SetCondition(s.descon)
		de:SetOperation(s.desop)
		if Duel.GetTurnPlayer() == tp and Duel.GetCurrentPhase() == PHASE_END then
			de:SetLabel(Duel.GetTurnCount())
			de:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
		else
			de:SetLabel(0)
			de:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN)
		end
		Duel.RegisterEffect(de, tp)
	end
end
function s.descon(e, tp, eg, ep, ev, re, r, rp)
	local g = e:GetLabelObject()
	if not g:IsExists(s.desfilter, 1, nil) then
		g:DeleteGroup()
		e:Reset()
		return false
	end
	return Duel.GetTurnPlayer() == tp and Duel.GetTurnCount() ~= e:GetLabel()
end
function s.desfilter(c)
	return c:GetFlagEffect(id) > 0
end
function s.desop(e, tp, eg, ep, ev, re, r, rp)
	local g = e:GetLabelObject()
	local tg = g:Filter(s.desfilter, nil)
	g:DeleteGroup()
	Duel.Destroy(tg, REASON_EFFECT)
end

