--任务副本2
--进入副本→播放MOV→刷NOSS→击杀BOSS→副本完成→传出副本

x040002_g_scriptId = 040002

--副本参数
x040002_g_CSParamIdxCurStage = 0			  --大阶段	
x040002_g_CSParamIdxCurSubStage = 1           --小阶段
x040002_g_CSParamAnimationID = 5033           --mov动画ID

x040002_g_MonstorList={}
x040002_g_MonstorList[1]={124002}                                  --BOSS

x040002_g_MonstorPosList={}
x040002_g_MonstorPosList[1]={{67.41,58.99,1}}

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

--动画/对话回调
function x040002_OnStoryEventEnd(scene,nStoryId,nAnimationId)
	if nAnimationId == x040002_g_CSParamAnimationID then
		local nCurStage = GetCopySceneParam(scene,x040002_g_CSParamIdxCurStage)
		local MonCount = GetHostileMonsterCount(scene)
		SetCopySceneParam(scene,x040002_g_CSParamIdxCurStage,nCurStage+1)
		SetCopySceneParam(scene,x040002_g_CSParamIdxCurSubStage,0)
	end
end

--副本Tick
function x040002_OnCopySceneTick(scene,tickCount)
	local curStage = GetCopySceneParam(scene,x040002_g_CSParamIdxCurStage)
	local curSubStage = GetCopySceneParam(scene,x040002_g_CSParamIdxCurSubStage)
	SetCopySceneParam(scene, x040002_g_CSParamIdxCurSubStage, curSubStage+1)
	if curStage == 0 then  
		x040002_Stage_0(scene, curStage, curSubStage)
	elseif curStage == 1 then
		x040002_Stage_1(scene, curStage, curSubStage)
	elseif curStage == 2 then
		SetCopySceneSuccess(scene)
	end
end

--第0阶段 播放MOV
function x040002_Stage_0(scene ,stage,substage)
	if substage == 2 then
		StoryAnimation(scene, x040002_g_CSParamAnimationID)
	elseif substage == 10 then
		TellPlayerAutoCombat(scene)
		CreateMonster(scene, x040002_g_MonstorList[1][1], x040002_g_MonstorPosList[1][1][3], x040002_g_MonstorPosList[1][1][1], x040002_g_MonstorPosList[1][1][2])
	end
end

--第1阶段 刷NOSS→
function x040002_Stage_1(scene ,stage,substage)
	if substage == 1 then
		TellPlayerAutoCombat(scene)
		CreateMonster(scene, x040002_g_MonstorList[1][1], x040002_g_MonstorPosList[1][1][3], x040002_g_MonstorPosList[1][1][1], x040002_g_MonstorPosList[1][1][2])
	end
end
