name: Major
card_text: If a monster(s) you control returns to your hand by an opponent's card effect: Return as many monsters on the field to the hand as possible, then each player Special Summons monsters from their hand, in face-down Defense Position, equal to the number of Monster Cards that were returned to their hand.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_TO_HAND)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.confilter(c, tp)
  	return c:IsControler(tp) and c:IsPreviousLocation(LOCATION_MZONE)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return rp == 1 - tp and eg:IsExists(s.confilter, 1, nil, tp)
  end
  function s.thfilter(c, tp)
  	return c:IsLocation(LOCATION_HAND) and c:IsControler(tp)
  end
  function s.spfilter(c, e, tp)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEDOWN_DEFENSE)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsAbleToHand, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(Card.IsAbleToHand, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, g:GetCount(), 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToHand, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if g:GetCount() == 0 then
  		return
  	end
  	Duel.SendtoHand(g, nil, REASON_EFFECT)
  	Duel.BreakEffect()
  	local og = Duel.GetOperatedGroup()
  	local ct1 = og:FilterCount(s.thfilter, nil, tp)
  	local ct2 = og:FilterCount(s.thfilter, nil, 1 - tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_HAND, 0, ct1, ct1, nil, e, tp)
  	if g1:GetCount() > 0 then
  		local tc = g1:GetFirst()
  		local cg1 = Group.CreateGroup()
  		while tc do
  			if tc:IsPublic() then
  				cg1:AddCard(tc)
  			end
  			Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEDOWN_DEFENSE)
  			tc = g1:GetNext()
  		end
  		if cg1:GetCount() > 0 then
  			Duel.ConfirmCards(1 - tp, cg1)
  		end
  	end
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_SPSUMMON)
  	local g2 = Duel.SelectMatchingCard(1 - tp, s.spfilter, 1 - tp, LOCATION_HAND, 0, ct2, ct2, nil, e, 1 - tp)
  	if g2:GetCount() > 0 then
  		local tc = g2:GetFirst()
  		local cg2 = Group.CreateGroup()
  		while tc do
  			if tc:IsPublic() then
  				cg2:AddCard(tc)
  			end
  			Duel.SpecialSummonStep(tc, 0, 1 - tp, 1 - tp, false, false, POS_FACEDOWN_DEFENSE)
  			tc = g2:GetNext()
  		end
  		if cg2:GetCount() > 0 then
  			Duel.ConfirmCards(tp, cg2)
  		end
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Major
  If a monster(s) you control returns to your hand by an opponent's card effect: Return as many monsters on the field to the hand as possible, then each player Special Summons monsters from their hand, in face-down Defense Position, equal to the number of Monster Cards that were returned to their hand.
target_text: -- Major
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_TO_HAND)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.confilter(c, tp)
  	return c:IsControler(tp) and c:IsPreviousLocation(LOCATION_MZONE)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return rp == 1 - tp and eg:IsExists(s.confilter, 1, nil, tp)
  end
  function s.thfilter(c, tp)
  	return c:IsLocation(LOCATION_HAND) and c:IsControler(tp)
  end
  function s.spfilter(c, e, tp)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEDOWN_DEFENSE)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsAbleToHand, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(Card.IsAbleToHand, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, g:GetCount(), 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToHand, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if g:GetCount() == 0 then
  		return
  	end
  	Duel.SendtoHand(g, nil, REASON_EFFECT)
  	Duel.BreakEffect()
  	local og = Duel.GetOperatedGroup()
  	local ct1 = og:FilterCount(s.thfilter, nil, tp)
  	local ct2 = og:FilterCount(s.thfilter, nil, 1 - tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_HAND, 0, ct1, ct1, nil, e, tp)
  	if g1:GetCount() > 0 then
  		local tc = g1:GetFirst()
  		local cg1 = Group.CreateGroup()
  		while tc do
  			if tc:IsPublic() then
  				cg1:AddCard(tc)
  			end
  			Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEDOWN_DEFENSE)
  			tc = g1:GetNext()
  		end
  		if cg1:GetCount() > 0 then
  			Duel.ConfirmCards(1 - tp, cg1)
  		end
  	end
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_SPSUMMON)
  	local g2 = Duel.SelectMatchingCard(1 - tp, s.spfilter, 1 - tp, LOCATION_HAND, 0, ct2, ct2, nil, e, 1 - tp)
  	if g2:GetCount() > 0 then
  		local tc = g2:GetFirst()
  		local cg2 = Group.CreateGroup()
  		while tc do
  			if tc:IsPublic() then
  				cg2:AddCard(tc)
  			end
  			Duel.SpecialSummonStep(tc, 0, 1 - tp, 1 - tp, false, false, POS_FACEDOWN_DEFENSE)
  			tc = g2:GetNext()
  		end
  		if cg2:GetCount() > 0 then
  			Duel.ConfirmCards(tp, cg2)
  		end
  	end
  	Duel.SpecialSummonComplete()
  end
  
  