name: Dimension
card_text: Pay 2000 LP; each player Special Summons as many of their banished monsters as possible.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.tg)
  	e1:SetOperation(s.op)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp)
  	return c:IsFaceup() and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 2000)
  	end
  	Duel.PayLPCost(tp, 2000)
  end
  function s.tg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_REMOVED, 0, 1, nil, e, tp))
  			or (Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, 0, LOCATION_REMOVED, 1, nil, e, 1 - tp))
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 2, LOCATION_REMOVED)
  end
  function s.op(e, tp, eg, ep, ev, re, r, rp)
  	local ft1 = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft1 > 0 then
  		if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  			ft1 = 1
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_REMOVED, 0, ft1, ft1, nil, e, tp)
  		if g:GetCount() > 0 then
  			local tc = g:GetFirst()
  			while tc do
  				Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP)
  				tc = g:GetNext()
  			end
  		end
  	end
  	local ft2 = Duel.GetLocationCount(1 - tp, LOCATION_MZONE)
  	if ft2 > 0 then
  		if Duel.IsPlayerAffectedByEffect(1 - tp, CARD_ID_0) then
  			ft2 = 1
  		end
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_SPSUMMON)
  		local g = Duel.SelectMatchingCard(1 - tp, s.filter, tp, 0, LOCATION_REMOVED, ft2, ft2, nil, e, 1 - tp)
  		if g:GetCount() > 0 then
  			local tc = g:GetFirst()
  			while tc do
  				Duel.SpecialSummonStep(tc, 0, 1 - tp, 1 - tp, false, false, POS_FACEUP)
  				tc = g:GetNext()
  			end
  		end
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Dimension
  Pay 2000 LP; each player Special Summons as many of their banished monsters as possible.
target_text: -- Dimension
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.tg)
  	e1:SetOperation(s.op)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp)
  	return c:IsFaceup() and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 2000)
  	end
  	Duel.PayLPCost(tp, 2000)
  end
  function s.tg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_REMOVED, 0, 1, nil, e, tp))
  			or (Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, 0, LOCATION_REMOVED, 1, nil, e, 1 - tp))
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 2, LOCATION_REMOVED)
  end
  function s.op(e, tp, eg, ep, ev, re, r, rp)
  	local ft1 = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft1 > 0 then
  		if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  			ft1 = 1
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_REMOVED, 0, ft1, ft1, nil, e, tp)
  		if g:GetCount() > 0 then
  			local tc = g:GetFirst()
  			while tc do
  				Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP)
  				tc = g:GetNext()
  			end
  		end
  	end
  	local ft2 = Duel.GetLocationCount(1 - tp, LOCATION_MZONE)
  	if ft2 > 0 then
  		if Duel.IsPlayerAffectedByEffect(1 - tp, CARD_ID_0) then
  			ft2 = 1
  		end
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_SPSUMMON)
  		local g = Duel.SelectMatchingCard(1 - tp, s.filter, tp, 0, LOCATION_REMOVED, ft2, ft2, nil, e, 1 - tp)
  		if g:GetCount() > 0 then
  			local tc = g:GetFirst()
  			while tc do
  				Duel.SpecialSummonStep(tc, 0, 1 - tp, 1 - tp, false, false, POS_FACEUP)
  				tc = g:GetNext()
  			end
  		end
  	end
  	Duel.SpecialSummonComplete()
  end
  
  