--任务副本3
--进入副本→刷第一波小怪→击杀第一波小怪→刷BOSS→击杀BOSS→副本完成→传出副本

x040003_g_scriptId = 040003

--副本参数
x040003_g_CSParamIdxCurStage = 0			  --大阶段	
x040003_g_CSParamIdxCurSubStage = 1           --小阶段
x040003_g_CSParamAnimationID = 9998           --mov动画ID

x040003_g_MonstorList={}
x040003_g_MonstorList[1]={120001, 120001, 120001, 120001, 120001}  --小怪
x040003_g_MonstorList[2]={124002}                                  --BOSS

x040003_g_MonstorPosList={}
x040003_g_MonstorPosList[1]={{67.41,58.99,1},{62.96,55.83,1},{56.11,56.36,1},{51.75,61.98,1},{52.20,66.75,1}} --小怪坐标
x040003_g_MonstorPosList[2]={{67.41,58.99,1}}

--死亡回调
function x040003_OnObjDie( scene,objId,rolebaseId,killerId )
	local nCurStage = GetCopySceneParam(scene,x040003_g_CSParamIdxCurStage)
	local MonCount = GetHostileMonsterCount(scene)
	if MonCount == 0 then
		SetCopySceneParam(scene,x040003_g_CSParamIdxCurStage,nCurStage+1)
		SetCopySceneParam(scene,x040003_g_CSParamIdxCurSubStage,0)
	end
end

--副本Tick
function x040003_OnCopySceneTick(scene,tickCount)
	local curStage = GetCopySceneParam(scene,x040003_g_CSParamIdxCurStage)
	local curSubStage = GetCopySceneParam(scene,x040003_g_CSParamIdxCurSubStage)
	SetCopySceneParam(scene, x040003_g_CSParamIdxCurSubStage, curSubStage+1)
	if curStage == 0 then  
		x040003_Stage_0(scene, curStage, curSubStage)
	elseif curStage == 1 then
		x040003_Stage_1(scene, curStage, curSubStage)
	elseif curStage == 2 then
		SetCopySceneSuccess(scene)
	end
end

--第0阶段 播放MOV 刷第一波小怪
function x040003_Stage_0(scene ,stage,substage)
	if substage == 2 then
		TellPlayerAutoCombat(scene)
		local count = #x040003_g_MonstorList[1]
		for i = 1, count do
			CreateMonster(scene, x040003_g_MonstorList[1][i], x040003_g_MonstorPosList[1][i][3], x040003_g_MonstorPosList[1][i][1], x040003_g_MonstorPosList[1][i][2])
		end
	end
end

--第1阶段 刷BOSS
function x040003_Stage_1(scene ,stage,substage)
	if substage == 2 then
		TellPlayerAutoCombat(scene)
		CreateMonster(scene, x040003_g_MonstorList[2][1], x040003_g_MonstorPosList[2][1][3], x040003_g_MonstorPosList[2][1][1], x040003_g_MonstorPosList[2][1][2])
	end
end
