--================================================================
-- 
-- 配置
-- 
--================================================================

-- 怪物
monsters = {
	{ config_id = 14, monster_id = 21010101, pos = { x = 171.4, y = -0.5, z = -124.0 }, rot = { x = 0.0, y = 278.5, z = 0.0 }, level = 0 },
	{ config_id = 15, monster_id = 21010101, pos = { x = 174.0, y = -0.5, z = -114.3 }, rot = { x = 0.0, y = 270.0, z = 0.0 }, level = 0 },
	{ config_id = 16, monster_id = 21010101, pos = { x = 169.3, y = -0.5, z = -106.6 }, rot = { x = 0.0, y = 270.0, z = 0.0 }, level = 0 },
	{ config_id = 17, monster_id = 21020201, pos = { x = 166.9, y = -0.5, z = -114.9 }, rot = { x = 0.0, y = 270.0, z = 0.0 }, level = 0 },
	{ config_id = 84, monster_id = 20011101, pos = { x = 166.8, y = -0.5, z = -119.6 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 85, monster_id = 20010901, pos = { x = 167.0, y = -0.5, z = -111.5 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 86, monster_id = 22010101, pos = { x = 165.6, y = -0.5, z = -115.1 }, rot = { x = 0.0, y = 270.0, z = 0.0 }, level = 0 },
	{ config_id = 87, monster_id = 20011201, pos = { x = 161.1, y = -0.5, z = -118.2 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 88, monster_id = 20011201, pos = { x = 164.4, y = -0.5, z = -120.4 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 89, monster_id = 20011201, pos = { x = 164.6, y = -0.5, z = -109.5 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 90, monster_id = 20011201, pos = { x = 160.8, y = -0.5, z = -111.1 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 91, monster_id = 20010601, pos = { x = 164.7, y = -0.5, z = -114.9 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 92, monster_id = 20010701, pos = { x = 169.9, y = -0.5, z = -111.9 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 93, monster_id = 20010501, pos = { x = 168.8, y = -0.5, z = -118.3 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 94, monster_id = 20010501, pos = { x = 161.9, y = -0.5, z = -118.1 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 95, monster_id = 20010501, pos = { x = 163.7, y = -0.5, z = -111.3 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 },
	{ config_id = 96, monster_id = 20010501, pos = { x = 166.9, y = -0.5, z = -109.6 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 0 }
}

-- NPC
npcs = {
}

-- 装置
gadgets = {
	{ config_id = 11, gadget_id = 70210032, pos = { x = 170.5, y = -0.5, z = -115.0 }, rot = { x = 0.0, y = 271.5, z = 0.0 }, level = 1, chest_drop_id = 1300102, state = GadgetState.ChestLocked }
}

-- 区域
regions = {
	{ config_id = 21, shape = RegionShape.SPHERE, radius = 5, pos = { x = 164.4, y = -0.5, z = -115.3 } },
	{ config_id = 28, shape = RegionShape.SPHERE, radius = 5, pos = { x = 164.5, y = -0.5, z = -115.2 } },
	{ config_id = 29, shape = RegionShape.SPHERE, radius = 5, pos = { x = 164.5, y = -0.5, z = -115.3 } },
	{ config_id = 30, shape = RegionShape.SPHERE, radius = 5, pos = { x = 163.9, y = -0.5, z = -114.5 } },
	{ config_id = 31, shape = RegionShape.SPHERE, radius = 5, pos = { x = 163.1, y = -0.5, z = -116.0 } },
	{ config_id = 32, shape = RegionShape.SPHERE, radius = 5, pos = { x = 162.1, y = -0.5, z = -117.3 } },
	{ config_id = 33, shape = RegionShape.SPHERE, radius = 5, pos = { x = 161.9, y = -0.5, z = -116.2 } }
}

-- 触发器
triggers = {
	{ name = "ANY_MONSTER_DIE_21", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_21", action = "action_EVENT_ANY_MONSTER_DIE_21" },
	{ name = "ANY_MONSTER_DIE_28", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_28", action = "action_EVENT_ANY_MONSTER_DIE_28" },
	{ name = "ANY_MONSTER_DIE_29", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_29", action = "action_EVENT_ANY_MONSTER_DIE_29" },
	{ name = "ANY_MONSTER_DIE_30", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_30", action = "action_EVENT_ANY_MONSTER_DIE_30" },
	{ name = "ANY_MONSTER_DIE_31", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_31", action = "action_EVENT_ANY_MONSTER_DIE_31" },
	{ name = "ANY_MONSTER_DIE_32", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_32", action = "action_EVENT_ANY_MONSTER_DIE_32" },
	{ name = "ANY_MONSTER_DIE_33", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_33", action = "action_EVENT_ANY_MONSTER_DIE_33" }
}

-- 变量
variables = {
}

--================================================================
-- 
-- 初始化配置
-- 
--================================================================

-- 初始化时创建
init_config = {
	suite = 1,
	rand_suite = true,
	npcs = { }
}

--================================================================
-- 
-- 小组配置
-- 
--================================================================

suites = {
	{
		-- suite_id = 0,
		-- description = ,
		monsters = { 14, 15, 16, 17 },
		gadgets = { 11 },
		regions = { 21, 28 },
		triggers = { "ANY_MONSTER_DIE_21", "ANY_MONSTER_DIE_28" },
		rand_weight = 100
	},
	{
		-- suite_id = 1,
		-- description = suite_2,
		monsters = { 84, 85 },
		gadgets = { 11 },
		regions = { 21, 29, 30 },
		triggers = { "ANY_MONSTER_DIE_21", "ANY_MONSTER_DIE_29", "ANY_MONSTER_DIE_30" },
		rand_weight = 100
	},
	{
		-- suite_id = 2,
		-- description = suite_3,
		monsters = { 86, 87, 88, 89, 90 },
		gadgets = { 11 },
		regions = { 21, 31 },
		triggers = { "ANY_MONSTER_DIE_21", "ANY_MONSTER_DIE_31" },
		rand_weight = 100
	},
	{
		-- suite_id = 3,
		-- description = suite_4,
		monsters = { 91, 92, 93, 94, 95, 96 },
		gadgets = { 11 },
		regions = { 21, 32, 33 },
		triggers = { "ANY_MONSTER_DIE_21", "ANY_MONSTER_DIE_32", "ANY_MONSTER_DIE_33" },
		rand_weight = 100
	}
}

--================================================================
-- 
-- 触发器
-- 
--================================================================

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_21(context, evt)
	-- 判断剩余怪物数量是否是0
	if ScriptLib.GetGroupMonsterCount(context) ~= 0 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_21(context, evt)
	-- 解锁目标11
	if 0 ~= ScriptLib.ChangeGroupGadget(context, { config_id = 11, state = GadgetState.Default }) then
		return -1
	end
	
	-- 调用提示id为 20010301 的提示UI，会显示在屏幕中央偏下位置，id索引自 ReminderData表格
	if 0 ~= ScriptLib.ShowReminder(context, 20010301) then
		return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_28(context, evt)
	--判断死亡怪物的configid是否为 17
	if evt.param1 ~= 17 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_28(context, evt)
	-- 杀死Group内所有monster
		if 0 ~= ScriptLib.KillGroupEntity(context, { group_id = 230001021, kill_policy = GroupKillPolicy.GROUP_KILL_MONSTER }) then
			return -1
		end
		
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_29(context, evt)
	--判断死亡怪物的configid是否为 84
	if evt.param1 ~= 84 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_29(context, evt)
	-- 杀死Group内所有monster
		if 0 ~= ScriptLib.KillGroupEntity(context, { group_id = 230001020, kill_policy = GroupKillPolicy.GROUP_KILL_MONSTER }) then
			return -1
		end
		
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_30(context, evt)
	--判断死亡怪物的configid是否为 85
	if evt.param1 ~= 85 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_30(context, evt)
	-- 杀死Group内所有monster
		if 0 ~= ScriptLib.KillGroupEntity(context, { group_id = 230001022, kill_policy = GroupKillPolicy.GROUP_KILL_MONSTER }) then
			return -1
		end
		
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_31(context, evt)
	--判断死亡怪物的configid是否为 86
	if evt.param1 ~= 86 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_31(context, evt)
	-- 杀死Group内所有monster
		if 0 ~= ScriptLib.KillGroupEntity(context, { group_id = 230001021, kill_policy = GroupKillPolicy.GROUP_KILL_MONSTER }) then
			return -1
		end
		
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_32(context, evt)
	--判断死亡怪物的configid是否为 91
	if evt.param1 ~= 91 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_32(context, evt)
	-- 杀死Group内所有monster
		if 0 ~= ScriptLib.KillGroupEntity(context, { group_id = 230001020, kill_policy = GroupKillPolicy.GROUP_KILL_MONSTER }) then
			return -1
		end
		
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_33(context, evt)
	--判断死亡怪物的configid是否为 92
	if evt.param1 ~= 92 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_33(context, evt)
	-- 杀死Group内所有monster
		if 0 ~= ScriptLib.KillGroupEntity(context, { group_id = 230001022, kill_policy = GroupKillPolicy.GROUP_KILL_MONSTER }) then
			return -1
		end
		
	
	return 0
end
