--经验环

--脚本号
x200012_g_scriptId = 200012
--环id
x200012_g_RoundId = 12

--环区间 1,2-3,4-9,10
x200012_g_MissionRoundRange={1,2,3,4,5,6,8,200} 

--任务权重[环区间][概率,任务id(类型)]
x200012_g_MissionWeight={}
x200012_g_MissionWeight[1]={{chanceSum=100,id=11201}}
x200012_g_MissionWeight[2]={{chanceSum=100,id=11202}}
x200012_g_MissionWeight[3]={{chanceSum=100,id=11203}}
x200012_g_MissionWeight[4]={{chanceSum=100,id=11204}}
x200012_g_MissionWeight[5]={{chanceSum=100,id=11201}}
x200012_g_MissionWeight[6]={{chanceSum=100,id=11202}}
x200012_g_MissionWeight[7]={{chanceSum=60,id=11201},{chanceSum=100,id=11202}}
x200012_g_MissionWeight[8]={{chanceSum=60,id=11203},{chanceSum=100,id=11204}}

--是否可以接环，通用逻辑已判断
function x200012_CheckRoundAccept( scene,selfId )
	-- body
	return true
end

--当前环的任务id
function x200012_GetRoundMissionId( scene,selfId )
	-- body

	local roundInSection=GetMissionRoundInSection(scene,selfId,x200012_g_RoundId)+1

	local missionRange=1
	for i=1,#x200012_g_MissionRoundRange-1 do
		if roundInSection>x200012_g_MissionRoundRange[i] and roundInSection<=x200012_g_MissionRoundRange[i+1] then
			missionRange=i+1
		end
	end
	print("----------",roundInSection,missionRange)
	local missionWeight=x200012_g_MissionWeight[missionRange];
	local random = math.random(100)
	local  missionId = missionWeight[1].id
	for i=1,#missionWeight do
		if missionWeight[i].chanceSum>=random then
			missionId= missionWeight[i].id
			break
		end	
	end
		print(missionId)
	return missionId 
end


function x200012_MissionRoundNext( scene,selfId,section,roundInSection,roundInCD )
			AcceptRoundMission(scene,selfId,x200012_g_RoundId)
end



--环奖励 round 本轮的环数 roundInCD 时间段内的环数（本日（周）的完成次数）
function x200012_OnRoundBouns( scene,selfId,section,round,roundInCD)
	-- body
	print("OnRoundBouns",round,roundInCD)
	round =round+1
	local  level = GetLevel(scene,selfId)	
	
	local money = math.ceil(level*12*10*200*(round+7)/21500)	
	local exp = math.ceil((level*120+240)*10*200*(round+7)/21500)
	local yuanshen = math.ceil((level*120+240)*10*200*(round+7)/21500)
	AddMoney(scene,selfId,money)
	GainExp(scene,selfId,exp)
	AddYuanShenExp(scene, yuanshen)
end


--轮数做完了
function x200012_OnRoundFinish( scene,selfId )
	-- body
	print("OnRound finish")
end