x020184_g_scriptId = 020184

x020184_g_BuffId = {8000, 8003} -- buffID 初始化怪 

x020184_g_BuffId_Frozen = 8000 -- 冰冻Buff  ID
x020184_g_BuffId_FrozenNum = 5  -- Buff 數量
x020184_g_BuffId_Frozen_DelayTime_First = 8 -- 延迟时间
x020184_g_BuffId_Frozen_DelayTime_Second = 15 -- 延迟时间
x020184_g_BuffId_Frozen_DelayTime_Third = 13 -- 延迟时间
x020184_g_BuffId_Frozen_DelayTime_Fourth = 17 -- 延迟时间
x020184_g_BuffId_Frozen_DelayTime_Fifth = 20 -- 延迟时间
x020184_g_BuffPos_Frozen = {}
x020184_g_BuffPos_Frozen[1] = {109.85, 85.62,0.87} --(位置，朝向)
x020184_g_BuffPos_Frozen[2] = {85.49, 111.82,0.87}
x020184_g_BuffPos_Frozen[3] = {79.67, 96.86,0.87}
x020184_g_BuffPos_Frozen[4] = {96.92, 79.33,0.87}
x020184_g_BuffPos_Frozen[5] = {94.4, 94.71,0.87}
x020184_g_BuffId_Frozen_MonsterTime = 5  -- 隐形怪 时间


x020184_g_BuffId_Rebleeding = 8001 -- 回血Buff  ID
x020184_g_BuffId_RebleedingNum = 1 -- Buff 數量
x020184_g_BuffId_Rebleeding_DelayTime = 30 -- 延迟时间
x020184_g_BuffPos_Rebleeding = {}
x020184_g_BuffPos_Rebleeding[1] = {94.25, 25.94,2.42} --(位置，朝向)


x020184_g_BuffId_Bomb = 8002 -- 炸弹Buff  ID
x020184_g_BuffId_BombNum = 20 -- Buff 數量
x020184_g_BuffId_Bomb_DelayTime = 1 -- 延迟时间
x020184_g_BuffPos_Bomb = {}
x020184_g_BuffPos_Bomb[1] = {{76.5,90.2,-3.85},	{60.9,70.7,-3.85},	{54.4,58,-3.85},	{70,48.2,-3.85},	{72.4,62.2,-3.85},	{77.7,75.5,-3.85},	{80.1,85.4,-3.85},	{109.7,73.1,-3.85},	{89.5,96.8,-3.85},	{106.4,110.7,-3.85},	{90.8,113.3,-3.85},	{73.4,111.6,-3.85},	{63.3,106.7,-3.85},	{54.1,112.5,-3.85},	{41.7,107.9,-3.85},	{29.7,110.6,-3.85},	{30.7,96.5,-3.85},	{39.8,97.8,-3.85},	{39.8,81,-3.85},	{49,66.9,-3.85},	{57.7,46.4,-3.85},	{23.8,58.2,-3.85},	{14.2,64.8,-3.85},	{11.1,74.9,-3.85},	{7.6,86.5,-3.85},	{8,107.4,-3.85},	{8.1,46.5,-3.85},	{13,36.8,-3.85},	{7.4,29.1,-3.85},	{22.2,31.7,-3.85},	{9.3,16.7,-3.85},	{11.9,8.4,-3.85},	{34.2,12,-3.85},	{41.9,8.9,-3.85},	{54.7,11.2,-3.85},	{64.5,10.3,-3.85},	{79.8,11.7,-3.85},	{90.7,22.7,-3.85},	{97.2,28.6,-3.85},	{108,38.8,-3.85},	{113.2,27.9,-3.85}} --(位置，朝向)



x020184_g_BuffId_Magma = 8003 -- 岩浆Buff  ID
x020184_g_BuffId_MagmaNum = 1 -- Buff 數量
x020184_g_BuffId_Magma_DelayTime = 15 -- 延迟时间
x020184_g_BuffPos_Magma = {}
x020184_g_BuffPos_Magma[1] = {26.14, 25.66,0.89} --(位置，朝向)
x020184_g_BuffId_Magma_MonsterTime = 5  -- 隐形怪 时间


x020184_g_BuffId_Accelerate = 8004 -- 加速Buff  ID
x020184_g_BuffId_AccelerateNum = 2 -- Buff 數量
x020184_g_BuffId_Accelerate_DelayTimeOne = 1 -- 延迟时间
x020184_g_BuffId_Accelerate_DelayTimeTwo = 20 -- 延迟时间
x020184_g_BuffPos_Accelerate = {}
x020184_g_BuffPos_Accelerate[1] = {109.4, 59.8,0.89} --(位置，朝向)
x020184_g_BuffPos_Accelerate[2] = {12.3, 60.2,0.89}



x020184_g_BuffId_Defense = 8005 -- 防御Buff  ID
x020184_g_BuffId_DefenseNum = 1 -- Buff 數量
x020184_g_BuffId_Defense_DelayTime = 15 -- 延迟时间
x020184_g_BuffPos_Defense = {}
x020184_g_BuffPos_Defense[1] = {26.56, 93.72,2.42} --(位置，朝向)


x020184_g_BuffId_Call = 8006  -- 召唤Buff ID
x020184_g_BuffId_CallNum = 2 -- Buff 數量
x020184_g_BuffId_Call_DelayTime = 30 -- 延迟时间
x020184_g_BuffPos_Call = {}
x020184_g_BuffPos_Call[1] = {59.2, 98.7,0.89} --(位置，朝向)
x020184_g_BuffPos_Call[2] = {59.7, 23.8,0.89}



x020184_g_BuffId_Transformation = 8007  -- 能量变身Buff ID
x020184_g_BuffId_TransformationNum = 1 -- Buff 數量
x020184_g_BuffId_Transformation_DelayTime = 120 
x020184_g_BuffPos_Transformation = {}
x020184_g_BuffPos_Transformation[1] = {{14.4,105.9,-3.85},{105.5,105.7,-3.85},{105.9,13.7,-3.85},{14.3,13.9,-3.85},	{61,57.8,-3.85}} --(位置，朝向)


x020184_g_InitialCoordinates = {59.67, 10.13, 1.57} -- 进入场景的初始坐标

x020184_g_EagleCamp = {}
x020184_g_EagleCamp[1] = {{59.67, 10.13, 1.57},{59.67, 108.3, -1.57}} --鹰阵营坐标

x020184_g_ChickenCampPoint = {}  -- 鸡阵营 坐标
x020184_g_ChickenCampPoint[1] = {{59.97,73.92,-1.57},{49.91,70.27,-0.75},{45.96,59.87,0.01},{70.44,70.19,-2.42},{74.03,59.68,-3.14},{69.76,50.27,-3.92},{60.42,47.76,1.57},	{51.14,50.89,0.89}} --鸡


x020184_g_BaseEagleKillFraction = 3000     -- 鹰  基础分数
x020184_g_KillEagleCoefficientOne = 500  --  鹰  系数 1（每次杀鸡获得积分）

x020184_g_BaseChickenKillFraction = 2000  --鸡 基础分数
x020184_g_KillChickenCoefficientOne = 100 -- 鸡  系数 1（排名分数）
x020184_g_KillChickenCoefficientTwo = 5  -- 鸡  系数 2（时间分数） 
x020184_g_KillChickenCoefficientThree = 20  -- 鸡  系数 3（时间分数） 


x020184_g_ChickenBianShenId = 100  -- 小鸡 变身Id
x020184_g_ChickenFightBianShenId = 101 -- 战斗鸡 变身Id
x020184_g_EagleBianShenId = 102 -- 鹰 变身Id


x020184_g_MaxPeopleNum = 10 -- 房间开始人数
x020184_g_MaxWaitTime = 10 -- 人数足够 等待时间 
x020184_g_MaxOverTime = 61 -- 匹配失败时间
x020184_g_MaxEndTime = 300 -- 房间最大时间

x020184_g_EagleSkillIdOne = 2202002 -- 鹰 技能 1
x020184_g_EagleSkillIdTwo = 2202003 -- 鹰 技能 2
x020184_g_EagleSkillIdThree = 2202004 -- 鹰 技能 3

x020184_g_EagleSkillAddExp = 15 -- 每秒增加的 点数
x020184_g_EagleSkillKillExp = 50  -- 杀人增加的点数
x020184_g_EagleSkillLevelUpExpOne =  1000 --技能1 升级条件
x020184_g_EagleSkillLevelUpExpTwo = 2000  -- 技能2 升级条件
x020184_g_EagleSkillLevelUpExpThree = 3000 -- 技能3 升级条件

-- 定身Buff 用于控制玩家开场时间内无法移动
x020184_g_StunBuff=35500001

x020184_g_State = 0
x020184_g_WaitTime = 1
x020184_g_ChickenFightUserCount = 2
x020184_g_EndMark = 3
x020184_g_TransformationMark = 4
x020184_g_TransformationStartMark = 5
x020184_g_CopyScenceCampStatus = 6  -- 当前副本结算状态


function x020184_OnCopySceneOpen(scene)
	SetCopySceneParam(scene, x020184_g_State, 0)
	SetCopySceneParam(scene, x020184_g_WaitTime, 0)
	SetCopySceneParam(scene, x020184_g_ChickenFightUserCount, 0)
	SetCopySceneParam(scene, x020184_g_EndMark, 0)
	SetCopySceneParam(scene, x020184_g_TransformationMark, 0)
	SetCopySceneParam(scene, x020184_g_TransformationStartMark, 0)
	SetCopySceneParam(scene, x020184_g_CopyScenceCampStatus, 0)
end

function x020184_OnCopySceneTick(scene, tickCount)
	local nUserCount = GetSceneUserCount(scene)
	local waitTime = GetCopySceneParam(scene, x020184_g_WaitTime)
	local nChickenFightNum = GetCopySceneParam(scene, x020184_g_ChickenFightUserCount)
	local nEndMark = GetCopySceneParam(scene, x020184_g_EndMark)
	local nStartMark = GetCopySceneParam(scene, x020184_g_TransformationStartMark)
	local chickenNum = GetChickenNum(scene)
	local eagleNum = GetEagleNum(scene)
	if(nUserCount >= x020184_g_MaxPeopleNum) then
		if(waitTime == 0) then
			SetCopySceneParam(scene, x020184_g_WaitTime, tickCount)
			ChangeThisRoomStatus(scene)
		end
	end
	if(nStartMark == 1 and nEndMark == 0) then  -- 开始同步 数据
		x020184_InitCopyScene(scene, tickCount, waitTime)	
		AddChickenFightEageleExp(scene, x020184_g_EagleSkillAddExp, x020184_g_EagleSkillIdOne, x020184_g_EagleSkillIdTwo, x020184_g_EagleSkillIdThree, x020184_g_EagleSkillLevelUpExpOne, x020184_g_EagleSkillLevelUpExpTwo, x020184_g_EagleSkillLevelUpExpThree)	
	end
	if((tickCount - waitTime) == x020184_g_MaxWaitTime) and (nUserCount >= x020184_g_MaxPeopleNum) then
		x020184_RandomUserIdentity(scene) -- 有人进入场景检测 人数够不够
		NoticChickenFightOpen(scene)  -- 通知 开始	
		ExtendChickenFightTime(scene, waitTime + x020184_g_MaxWaitTime)  -- 延长副本时间
		ChickenFightDataSame(scene, x020184_g_BuffId_Transformation_DelayTime)  -- 同步初始数据与能量蘑菇时间
	end
	if nStartMark == 0 and tickCount % 3 == 0 then
		-- SetCopySceneParam(scene, x020184_g_ChickenFightUserCount, nUserCount)
		ChickLittleSynchronizationScene(scene, nUserCount, x020184_g_MaxPeopleNum) -- 用戶进入场景通知场景所有人
	end
	if((nUserCount < x020184_g_MaxPeopleNum) and tickCount >= x020184_g_MaxOverTime and nStartMark == 0) then  -- 匹配超时
		ChickenFightOverTime(scene)
		DelThisRoom(scene)
	end
	if((waitTime > 0 and eagleNum == 0 and nEndMark == 0 and nStartMark == 1) or (eagleNum > 0 and chickenNum == 0 and waitTime > 0 and nEndMark == 0 and nStartMark == 1)) then
		DeleChickenFightHostileMonster(scene)
		DeleHostileMonster(scene)
		SetCopySceneParam(scene, x020184_g_EndMark, 1)
		SetAllLeaveChickenFightScene(scene,  x020184_g_KillChickenCoefficientOne, x020184_g_KillChickenCoefficientTwo, x020184_g_KillChickenCoefficientThree, x020184_g_KillEagleCoefficientOne, x020184_g_BaseChickenKillFraction, x020184_g_BaseEagleKillFraction)
	end
	if(tickCount >= x020184_g_MaxEndTime + x020184_g_MaxWaitTime + waitTime and nEndMark == 0) then  -- 超时结束
		DeleChickenFightHostileMonster(scene)
		DeleHostileMonster(scene)
		SetCopySceneParam(scene, x020184_g_EndMark, 1)
		SetAllLeaveChickenFightScene(scene,  x020184_g_KillChickenCoefficientOne, x020184_g_KillChickenCoefficientTwo, x020184_g_KillChickenCoefficientThree, x020184_g_KillEagleCoefficientOne, x020184_g_BaseChickenKillFraction, x020184_g_BaseEagleKillFraction)
	end
	local state = GetCopySceneParam(scene, x020184_g_State)
	-- if state == 0 then
	-- 	if CheckKuaFuActivity(scene) then
	-- 		SetCopySceneFail(scene)
	-- 		SetCopySceneParam(scene, x020184_g_State, 1)
	-- 	end
	-- end
end

function x020184_OnPrepareLeaveCopyScene(scene)
	local nEndMark = GetCopySceneParam(scene, x020184_g_EndMark)
	local nStartMark = GetCopySceneParam(scene, x020184_g_TransformationStartMark)
	if(nEndMark == 0 and nStartMark == 1) then
		SetAllLeaveChickenFightScene(scene,  x020184_g_KillChickenCoefficientOne, x020184_g_KillChickenCoefficientTwo, x020184_g_KillChickenCoefficientThree, x020184_g_KillEagleCoefficientOne, x020184_g_BaseChickenKillFraction, x020184_g_BaseEagleKillFraction)
	end	
	SetCopySceneParam(scene, x020184_g_EndMark, 1)
end

function x020184_OnObjDie(scene, objId, rolebaseId, killerId)
	UpIsDieStatus(scene, objId) -- 更新死亡状态
	AddChickenFightKillNum(scene, killerId, x020184_g_EagleSkillKillExp, killerId)  -- 增加击杀数量
	ChickLittleDataToAllPlayer(scene, objId, killerId)  -- 同步死亡数据
	local nShenFen = GetChickenFightIdentity(scene, objId) 
	local chickenNum = GetChickenNum(scene)
	local eagleNum = GetEagleNum(scene)
	if(nShenFen == x020184_g_ChickenBianShenId or nShenFen == x020184_g_ChickenFightBianShenId) then
		ChickLittleRadiobroadcast(scene, 1)
	end
	if(nShenFen == x020184_g_EagleBianShenId) then
		ChickLittleRadiobroadcast(scene, 2)  -- 广播通知
	end	
	if(eagleNum ~= 0 and chickenNum ~= 0) then
		LeaveChickenFightScene(scene, objId, x020184_g_KillChickenCoefficientOne, x020184_g_KillChickenCoefficientTwo, x020184_g_KillChickenCoefficientThree, x020184_g_KillEagleCoefficientOne, x020184_g_BaseChickenKillFraction, x020184_g_BaseEagleKillFraction, false)  -- 只弹板
	end
end

function x020184_OnObjEnter(scene, objId)
	local nUserCount = GetSceneUserCount(scene)
	AutoCombat(scene,objId,false)
	SendImpactToUnit(scene,objId,x020184_g_StunBuff)
	SendUserScenePos(scene, objId, x020184_g_InitialCoordinates[1], x020184_g_InitialCoordinates[2], x020184_g_InitialCoordinates[3])
	-- SendKuaFuActivityData(scene, objId)
	-- CleanUpPassiveSkill(scene, objId)
end

function x020184_OnObjReconnect(scene, objId)
	SendKuaFuActivityData(scene, objId, false)
	-- ChickenFightReconnect(scene, objId) -- 重连变身
end

function x020184_OnObjLeave(scene, objId)
	-- body
	LeaveChickenFightScene(scene, objId, x020184_g_KillChickenCoefficientOne, x020184_g_KillChickenCoefficientTwo, x020184_g_KillChickenCoefficientThree, x020184_g_KillEagleCoefficientOne, x020184_g_BaseChickenKillFraction, x020184_g_BaseEagleKillFraction, true)
	SetBianShenEnd(scene, objId)
	ResetPassiveSkill(scene, objId)
end


function x020184_InitCopyScene(scene, tickCount, waitTime)  -- 刷新 buff
	-- body
	if (tickCount - waitTime) == x020184_g_BuffId_Frozen_DelayTime_First then -- 冰冻	
		x020184_CreateGroupPoint(scene, x020184_g_BuffId_Frozen, x020184_g_BuffPos_Frozen[1][1], x020184_g_BuffPos_Frozen[1][2], x020184_g_BuffPos_Frozen[1][3])
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Frozen_DelayTime_Second then -- 冰冻
		x020184_CreateGroupPoint(scene, x020184_g_BuffId_Frozen, x020184_g_BuffPos_Frozen[2][1], x020184_g_BuffPos_Frozen[2][2], x020184_g_BuffPos_Frozen[2][3])
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Frozen_DelayTime_Third then -- 冰冻
		x020184_CreateGroupPoint(scene, x020184_g_BuffId_Frozen, x020184_g_BuffPos_Frozen[3][1], x020184_g_BuffPos_Frozen[3][2], x020184_g_BuffPos_Frozen[3][3])
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Frozen_DelayTime_Fourth then -- 冰冻
		x020184_CreateGroupPoint(scene, x020184_g_BuffId_Frozen, x020184_g_BuffPos_Frozen[4][1], x020184_g_BuffPos_Frozen[4][2], x020184_g_BuffPos_Frozen[4][3])
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Frozen_DelayTime_Fifth then -- 冰冻
		x020184_CreateGroupPoint(scene, x020184_g_BuffId_Frozen, x020184_g_BuffPos_Frozen[5][1], x020184_g_BuffPos_Frozen[5][2], x020184_g_BuffPos_Frozen[5][3])
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Rebleeding_DelayTime then  -- 回血
		for i=1, x020184_g_BuffId_RebleedingNum do
			x020184_CreateGroupPoint(scene, x020184_g_BuffId_Rebleeding, x020184_g_BuffPos_Rebleeding[i][1], x020184_g_BuffPos_Rebleeding[i][2], x020184_g_BuffPos_Rebleeding[i][3])
		end
	end
	local BombCount = GetBuffCount(scene, x020184_g_BuffId_Bomb) -- 检测炸弹
	if(BombCount < x020184_g_BuffId_BombNum) then
		local high = math_randomEx(1, #x020184_g_BuffPos_Bomb[1], x020184_g_BuffId_BombNum - BombCount)
		for i=1, x020184_g_BuffId_BombNum - BombCount  do 
			x020184_CreateGroupPoint(scene, x020184_g_BuffId_Bomb, x020184_g_BuffPos_Bomb[1][high[i]][1],x020184_g_BuffPos_Bomb[1][high[i]][2], x020184_g_BuffPos_Bomb[1][high[i]][3])
		end		
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Magma_DelayTime then  -- 岩浆	
		x020184_CreateGroupPoint(scene, x020184_g_BuffId_Magma, x020184_g_BuffPos_Magma[1][1], x020184_g_BuffPos_Magma[1][2],  x020184_g_BuffPos_Magma[1][3])
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Accelerate_DelayTimeOne then  -- 加速	
		x020184_CreateGroupPoint(scene, x020184_g_BuffId_Accelerate, x020184_g_BuffPos_Accelerate[1][1], x020184_g_BuffPos_Accelerate[1][2], x020184_g_BuffPos_Accelerate[1][3])
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Accelerate_DelayTimeTwo then  -- 加速	
		x020184_CreateGroupPoint(scene, x020184_g_BuffId_Accelerate, x020184_g_BuffPos_Accelerate[2][1], x020184_g_BuffPos_Accelerate[2][2], x020184_g_BuffPos_Accelerate[2][3])
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Defense_DelayTime then  -- 防御
		for i=1, x020184_g_BuffId_DefenseNum do
			x020184_CreateGroupPoint(scene, x020184_g_BuffId_Defense, x020184_g_BuffPos_Defense[i][1], x020184_g_BuffPos_Defense[i][2], x020184_g_BuffPos_Defense[i][3])
		end
	end
	if (tickCount - waitTime) == x020184_g_BuffId_Call_DelayTime then  -- 召唤
		for i=1, x020184_g_BuffId_CallNum do
			x020184_CreateGroupPoint(scene, x020184_g_BuffId_Call, x020184_g_BuffPos_Call[i][1], x020184_g_BuffPos_Call[i][2], x020184_g_BuffPos_Call[i][3])
		end
	end	
	if (tickCount - waitTime) == x020184_g_BuffId_Transformation_DelayTime + x020184_g_MaxWaitTime then  -- 能量变身
		for i=1, x020184_g_BuffId_TransformationNum do
			local bian = RandomMon(1, #x020184_g_BuffPos_Transformation[1])
			x020184_CreateGroupPoint(scene, x020184_g_BuffId_Transformation, x020184_g_BuffPos_Transformation[1][bian][1], x020184_g_BuffPos_Transformation[1][bian][2], x020184_g_BuffPos_Transformation[1][bian][3])
		end
	end
	local TransCount = GetBuffCount(scene, x020184_g_BuffId_Transformation) -- 检测变身
	local nTransformationMark = GetCopySceneParam(scene, x020184_g_TransformationMark)
	if(TransCount == 0 and nTransformationMark == 1 and waitTime > 0) then 
		SetCopySceneParam(scene, x020184_g_TransformationMark, 0)
		ChickLittleRadiobroadcast(scene, 3)  -- 广播通知 蘑菇倒计时
	end
	if(TransCount == 1 and nTransformationMark == 0) then
		SetCopySceneParam(scene, x020184_g_TransformationMark, 1)
		ChickLittleRadiobroadcast(scene, 3)  -- 广播通知 刷新出蘑菇
	end
	
	if((tickCount - waitTime) % x020184_g_BuffId_Frozen_MonsterTime == 0) then
		SendImpactToUnitChickenFight(scene, x020184_g_BuffId_Frozen)
	end
	if((tickCount - waitTime) % x020184_g_BuffId_Magma_MonsterTime == 0) then
		SendImpactToUnitChickenFight(scene, x020184_g_BuffId_Magma)
	end
end

-- function x020184_OnPickGroupPiont(scene,GroupId)
-- 	if(GroupId == x020184_g_BuffId_Transformation) then
-- 		ChickLittleRadiobroadcast(scene, 3)  -- 广播通知 刷新出蘑菇
-- 	end
-- end


function x020184_CreateGroupPoint(scene, groupPointId, PosX, PosZ, FaceDir)  -- 设置buff 与隐形怪
	-- SetSceneBuff(scene, groupPointId, PosX, PosZ, FaceDir)
	SetChickFightSceneBuff(scene, groupPointId, PosX, PosZ, FaceDir) 
end

function x020184_RandomUserIdentity(scene)  -- 设置身份
	local nUserCount = GetSceneUserCount(scene)
	local SetChickenNum =  1
	local SetEagleNum = 1
	local nStartMark = GetCopySceneParam(scene, x020184_g_TransformationStartMark)
	if(nUserCount >= x020184_g_MaxPeopleNum) and nStartMark == 0 then
		SendUserIdentity(scene)
		SetCopySceneParam(scene, x020184_g_TransformationStartMark, 1)
		for i=0,nUserCount-1 do
			local nUserObjId = GetUserObjIdByIdx(scene,i)
			RemoveImpact(scene,nUserObjId,x020184_g_StunBuff)	
			local nShenFen = GetChickenFightIdentity(scene,nUserObjId)
			if(nShenFen == x020184_g_EagleBianShenId) then
				SendUserScenePos(scene, nUserObjId, x020184_g_EagleCamp[1][SetEagleNum][1], x020184_g_EagleCamp[1][SetEagleNum][2], x020184_g_EagleCamp[1][SetEagleNum][3])				
				SetEagleNum = SetEagleNum + 1
			else
				SendUserScenePos(scene, nUserObjId, x020184_g_ChickenCampPoint[1][SetChickenNum][1], x020184_g_ChickenCampPoint[1][SetChickenNum][2], x020184_g_ChickenCampPoint[1][SetChickenNum][3])				
				SetChickenNum = SetChickenNum + 1
			end
		end
	end
end

function table_fillNum(m,n)
    local j,k
    if n then
       j=m
       k=n
    else
        j=1
        k=m
    end
    local t={}
    for i=j,k do
        table.insert(t,i)
    end
    return t
end

function math_randomEx(m,n,cnt) 
    local tmp=table_fillNum(m,n)
    if cnt>n-m+1 then
        return tmp
    end
    local x=0
    local t={}math.randomseed(os.time())
    while  cnt>0 do
       x=math.random(1,n-m+1) 
       table.insert(t,tmp[x])
       table.remove(tmp,x)
       cnt=cnt-1
       m=m+1
      
    end
    return t
end

