x020066_g_scriptId = 020066

x020066_g_SmallMonsterPos = {}
x020066_g_SmallMonsterPos[1] = {94.16,92.37,1.57}
x020066_g_SmallMonsterPos[2] = {79.7,92.28,1.57}
x020066_g_SmallMonsterPos[3] = {97.92,86.17,1.57}
x020066_g_SmallMonsterPos[4] = {86.95,85.02,1.57}
x020066_g_SmallMonsterPos[5] = {75.44,84.17,1.57}
x020066_g_SmallMonsterPos[6] = {97.88,79.59,1.57}
x020066_g_SmallMonsterPos[7] = {86.97,78.82,1.57}
x020066_g_SmallMonsterPos[8] = {75.9,79.28,1.57}
x020066_g_SmallMonsterPos[9] = {93.53,84.65,1.57}
x020066_g_SmallMonsterPos[10] = {80.55,84.55,1.57}

x020066_g_JingyingMonsterPos = {}
x020066_g_JingyingMonsterPos[1] = {86.73,69.57,1.57}
x020066_g_JingyingMonsterPos[2] = {102.72,81.44,1.57}
x020066_g_JingyingMonsterPos[3] = {71.1,81.49,1.57}


x020066_g_MonsterAIPtrolPath = {}
x020066_g_MonsterAIPtrolPath[1] = 210
x020066_g_MonsterAIPtrolPath[2] = 220
x020066_g_MonsterAIPtrolPath[3] = 230
x020066_g_Stage = 0
x020066_g_SmallMonsterId = 500000--小怪起始Id
x020066_g_JingYingMonsterId = {}--精英怪起始ID
x020066_g_JingYingMonsterId[1] = 500100
x020066_g_JingYingMonsterId[2] = 500100
x020066_g_JingYingMonsterId[3] = 500100
x020066_g_SmallMonsterNum = 10
x020066_g_JingYingMonsterNum = 3
x020066_g_JingyingMonsterPoint = 300
x020066_g_SmallMonsterPoint = 30
x020066_g_MaxPoint = 1500
x020066_g_Exp1 = 1
x020066_g_Exp2 = 2
x020066_g_Stage_2 = 3
function x020066_OnCopySceneOpen(scene)
	SetCopySceneParam(scene,x020066_g_Stage,0)
	SetCopySceneParam(scene,x020066_g_Stage_2,0)
	local nCurStage = GetCopySceneParam(scene,x020066_g_Stage)
	local x020066_g_nAdaptedLvl = math.floor(GetAdaptLvl(scene)/10)
	if x020066_g_nAdaptedLvl > 60 then
		x020066_g_nAdaptedLvl = 60
	end
	for i=1,x020066_g_SmallMonsterNum do
		local Random = RandomMon(1,#x020066_g_SmallMonsterPos)
		CreateMonster(scene,x020066_g_SmallMonsterId+x020066_g_nAdaptedLvl,x020066_g_SmallMonsterPos[Random][3],x020066_g_SmallMonsterPos[Random][1],x020066_g_SmallMonsterPos[Random][2],-1,-1,-1,true)
	end

	for i=1,x020066_g_JingYingMonsterNum do
		local MonsterObjId = CreateMonster(scene,x020066_g_JingYingMonsterId[i]+x020066_g_nAdaptedLvl,x020066_g_JingyingMonsterPos[i][3],x020066_g_JingyingMonsterPos[i][1],x020066_g_JingyingMonsterPos[i][2],-1,-1,-1,true)
		NpcStartPatrol(scene,MonsterObjId,x020066_g_MonsterAIPtrolPath[i])
	end
end
function x020066_OnObjEnter(scene,objId)
	AutoCombat(scene,objId,true)
end
function x020066_OnCopySceneTick(scene,tickCount)
	local Cur = GetCopySceneParam(scene,x020066_g_Stage_2)
	if Cur == 1 then
		local nUserCount = GetSceneUserCount(scene)
		local x020066_g_nAdaptedLvl = math.floor(GetAdaptLvl(scene)/10)
		if x020066_g_nAdaptedLvl > 60 then
			x020066_g_nAdaptedLvl = 60
		end
		XiLianFuBenEnd(scene,GetCopySceneParam(scene,x020066_g_Exp1),GetCopySceneParam(scene,x020066_g_Exp2),x020066_g_SmallMonsterId+x020066_g_nAdaptedLvl,x020066_g_JingYingMonsterId[1]+x020066_g_nAdaptedLvl)
		SetCopySceneSuccess(scene)
		for i=0,nUserCount-1 do
			local nUserObjId = GetUserObjIdByIdx(scene,i)
			AutoCombat(scene,nUserObjId,false)
		end
		SetCopySceneParam(scene,x020066_g_Stage_2,2)
	end
end
function x020066_OnObjDie(scene,objId,rolebaseId,killerId)
	local x020066_g_NowPoint = 0
	local x020066_g_nAdaptedLvl = math.floor(GetAdaptLvl(scene)/10)
	if x020066_g_nAdaptedLvl > 60 then
		x020066_g_nAdaptedLvl = 60
	end
	if rolebaseId == x020066_g_SmallMonsterId+x020066_g_nAdaptedLvl then
		x020066_g_NowPoint = GetCopySceneParam(scene,x020066_g_Stage)
		SetCopySceneParam(scene,x020066_g_Stage,x020066_g_SmallMonsterPoint+x020066_g_NowPoint)
			x020066_g_NowPoint = GetCopySceneParam(scene,x020066_g_Stage)
		local Random = RandomMon(1,#x020066_g_SmallMonsterPos)
		SetCopySceneParam(scene,x020066_g_Exp1, 1+GetCopySceneParam(scene,x020066_g_Exp1))
	end
		if rolebaseId == x020066_g_JingYingMonsterId[1]+x020066_g_nAdaptedLvl then
			x020066_g_NowPoint = GetCopySceneParam(scene,x020066_g_Stage)
			SetCopySceneParam(scene,x020066_g_Stage,x020066_g_JingyingMonsterPoint+x020066_g_NowPoint)
			SetCopySceneParam(scene,x020066_g_Exp2, 1+GetCopySceneParam(scene,x020066_g_Exp2))
				x020066_g_NowPoint = GetCopySceneParam(scene,x020066_g_Stage)
		end
	local nUserCount = GetSceneUserCount(scene)
	for i=0,nUserCount-1 do
		local nUserObjId = GetUserObjIdByIdx(scene,i)
		XiLianFuBenStage(scene,nUserObjId)
	end
	if(x020066_g_NowPoint >= x020066_g_MaxPoint) then
		for i=1,#x020066_g_JingYingMonsterId do
			ChangeMonsterDimension(scene,x020066_g_JingYingMonsterId[i]+x020066_g_nAdaptedLvl)
		end
		ChangeMonsterDimension(scene,x020066_g_SmallMonsterId+x020066_g_nAdaptedLvl)
		SetCopySceneParam(scene,x020066_g_Stage_2,1)

	end
end


