--苦渋の選択
function c114514038.initial_effect(c)
	--Activate
	local e1=Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCountLimit(1,114514038+EFFECT_COUNT_CODE_OATH)
	e1:SetTarget(c114514038.target)
	e1:SetOperation(c114514038.activate)
	c:RegisterEffect(e1)
end
function c114514038.target(e,tp,eg,ep,ev,re,r,rp,chk)
	local g=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,LOCATION_DECK,0,nil,tp)
	if chk==0 then return g:GetClassCount(Card.GetCode)>=7 end
	Duel.SetOperationInfo(0,CATEGORY_TOHAND+CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK)
end
function c114514038.activate(e,tp,eg,ep,ev,re,r,rp)
	local g=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,LOCATION_DECK,0,nil,tp)
	if g:GetClassCount(Card.GetCode)<7 then return end
	local sg=Group.CreateGroup()
	while #sg<7 and #g>0 do
		Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(114514038,0))
		local sg2=g:Select(tp,1,1,nil)
		g:Remove(Card.IsCode,nil,sg2:GetFirst():GetCode())
		sg:Merge(sg2)
	end
	Duel.ConfirmCards(1-tp,sg)
	Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(114514038,1))
	local ssg=sg:Select(1-tp,1,1,nil)
	ssg:GetFirst():SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM,true)
	Duel.SendtoHand(ssg,nil,REASON_EFFECT)
	sg:Sub(ssg)
	Duel.Remove(sg,POS_FACEDOWN,REASON_EFFECT)
end
