x020021_g_scriptId=020021

x020021_g_CSParamIdxCurFloor=0
x020021_g_CSParamIdxCurSubStage=1
x020021_g_CopySceneId = -1
function x020021_OnCopySceneOpen(scene)
	local nObjId = GetUserObjIdByIdx(scene,0)
	if nObjId ~= -1 then
		local nTowerId = GetRequestCard(scene,nObjId)
		AddCSMission(scene,60000 + nTowerId)
	end	
end

function x020021_OnCopySceneTick(scene,tickCount)					--副本阶段
							
end

function x020021_OnObjEnter(scene,objId)
	if x020021_g_CopySceneId ~= -1 then
		SetCardChallengeId(scene,objId,x020021_g_CopySceneId)
	end
	if x020021_g_CopysceneId == -1 then
		x020021_g_CopysceneId = GetRequestCard(scene,nObjId)
	end
end


function x020021_OnObjDie( scene,objId,rolebaseId,killerId )					--战斗（）
	local MonCount = GetHostileMonsterCount(scene)
	if(GetObjType(scene, objId) == 0)  then
		if(IsTeamLeader(scene, objId))  then
			local nUserCount = GetSceneUserCount(scene)
			for i=0,nUserCount-1 do                                                                                        --  帮助奖励（当所有BOSS奖励触发后开始触发）
				local nUserObjId = GetUserObjIdByIdx(scene,i)
				CardResults(scene, nUserObjId, false)
			end
			SetCopySceneFail(scene)
		elseif not IsInTeam(scene, objId) then
			local nUserCount = GetSceneUserCount(scene)
			for i=0,nUserCount-1 do                                                                                        --  帮助奖励（当所有BOSS奖励触发后开始触发）
				local nUserObjId = GetUserObjIdByIdx(scene,i)
				CardResults(scene, nUserObjId, false)
			end
			SetCopySceneFail(scene)
		end
		SendAllPlayerServerTips(scene, "#{1501}*")
	end
	if(MonCount == 0) then
		local nUserCount = GetSceneUserCount(scene)
		for i=0,nUserCount-1 do                                                                                        --  帮助奖励（当所有BOSS奖励触发后开始触发）
			local nUserObjId = GetUserObjIdByIdx(scene,i)
			CardResults(scene, nUserObjId, true)
		end
		SetCopySceneSuccess(scene)
	end

end



