--XY&Z
function c80000384.initial_effect(c)
	--act limit
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
	e1:SetRange(LOCATION_SZONE)
	e1:SetTargetRange(1,0)
	e1:SetValue(c80000384.aclimit)
	c:RegisterEffect(e1)
	--special summon
	local e2=Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(80000384,0))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
	e2:SetType(EFFECT_TYPE_ACTIVATE)
	e2:SetCode(EVENT_FREE_CHAIN)
	e2:SetHintTiming(0,TIMING_END_PHASE)
	e2:SetCountLimit(1,80000384+EFFECT_COUNT_CODE_DUEL)
	e2:SetCost(c80000384.cost)
	e2:SetTarget(c80000384.target)
	e2:SetOperation(c80000384.operation)
	c:RegisterEffect(e2) 
	--
	local e3=Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_FIELD)
	e3:SetRange(LOCATION_SZONE)
	e3:SetCode(EFFECT_CANNOT_MSET)
	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e3:SetTargetRange(1,0)
	c:RegisterEffect(e3)
	local e4=e3:Clone()
	e4:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
	c:RegisterEffect(e4)
	local e5=e3:Clone()
	e5:SetCode(EFFECT_CANNOT_SUMMON)
	c:RegisterEffect(e5) 
end
function c80000384.aclimit(e,re,tp)
	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL+TYPE_TRAP)
end
function c80000384.rfilter(c,code)
	return c:IsCode(code) and c:IsAbleToRemoveAsCost()
end
function c80000384.cost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingMatchingCard(c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil,80000027)
		and Duel.IsExistingMatchingCard(c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil,80000059)
		and Duel.IsExistingMatchingCard(c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil,80000091)
		and Duel.IsExistingMatchingCard(c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil,80000135)
		and Duel.IsExistingMatchingCard(c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil,80000328)
		and Duel.IsExistingMatchingCard(c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil,80000329)
		and Duel.IsExistingMatchingCard(c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil,80000383)
	end
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g=Duel.SelectMatchingCard(tp,c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil,80000027)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g1=Duel.SelectMatchingCard(tp,c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil,80000059)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g2=Duel.SelectMatchingCard(tp,c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil,80000091)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g3=Duel.SelectMatchingCard(tp,c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil,80000135)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g4=Duel.SelectMatchingCard(tp,c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil,80000328)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g5=Duel.SelectMatchingCard(tp,c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil,80000329)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g6=Duel.SelectMatchingCard(tp,c80000384.rfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil,80000383)
	g:Merge(g1)
	g:Merge(g2)
	g:Merge(g3)
	g:Merge(g4)
	g:Merge(g5)
	g:Merge(g6)
	Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c80000384.filter(c,code,e,tp)
	return c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,true,true)
end
function c80000384.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
	if chkc then return false end
	if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133)
		and Duel.GetLocationCount(tp,LOCATION_MZONE)>=2
		and Duel.IsExistingTarget(c80000384.filter,tp,LOCATION_EXTRA,0,1,nil,80000468,e,tp)
		and Duel.IsExistingTarget(c80000384.filter,tp,LOCATION_EXTRA,0,1,nil,80000469,e,tp)
		and Duel.IsExistingTarget(c80000384.filter,tp,LOCATION_EXTRA,0,1,nil,80000474,e,tp)
	end
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
	local g1=Duel.SelectTarget(tp,c80000384.filter,tp,LOCATION_EXTRA,0,1,1,nil,80000468,e,tp)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
	local g2=Duel.SelectTarget(tp,c80000384.filter,tp,LOCATION_EXTRA,0,1,1,nil,80000469,e,tp)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
	local g3=Duel.SelectTarget(tp,c80000384.filter,tp,LOCATION_EXTRA,0,1,1,nil,80000474,e,tp)
	g1:Merge(g2)
	g1:Merge(g3)
	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g1,3,0,0)
end
function c80000384.operation(e,tp,eg,ep,ev,re,r,rp)
	if Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
	if Duel.GetLocationCount(tp,LOCATION_MZONE)<3 then return end
	local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
	if g:FilterCount(Card.IsRelateToEffect,nil,e)~=3 then return end
	Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP)
end