mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-17 02:42:28 +08:00
更新配置表
This commit is contained in:
185
gdconf/game_data_config/lua/common/V3_3/BrickBreaker.lua
Normal file
185
gdconf/game_data_config/lua/common/V3_3/BrickBreaker.lua
Normal file
@@ -0,0 +1,185 @@
|
||||
---
|
||||
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
||||
--- Created by binghong.shen.
|
||||
--- DateTime: 2022/8/8 16:33
|
||||
---
|
||||
--[[======================================
|
||||
|| filename: BrickBreaker
|
||||
|| owner: binghong.shen
|
||||
|| description: 3.3打砖块活动
|
||||
|| LogName: BrickBreaker
|
||||
|| Protection: [Protection]
|
||||
=======================================]]
|
||||
|
||||
|
||||
|
||||
-- 测试gadget 70290608
|
||||
|
||||
--miscs配置内容
|
||||
--[[
|
||||
|
||||
--传送触发器物件
|
||||
defs.gadget_teleport = 10001
|
||||
--砖块玩法物件
|
||||
defs.gadget_bricks = 10002
|
||||
--空气墙
|
||||
defs.gadget_airWall = 10003
|
||||
--是否是地城
|
||||
defs.isDungeon = 0
|
||||
--地城氛围物件
|
||||
defs.gadget_envLamp = 10004
|
||||
|
||||
defs.envWeather =
|
||||
{
|
||||
[1]=10169,
|
||||
[2]=10170,
|
||||
[3]=10171,
|
||||
}
|
||||
|
||||
|
||||
--地城对应的天气配置
|
||||
local DungeonWeather = {
|
||||
10039,10040,10041,10042
|
||||
}
|
||||
|
||||
local defs = {
|
||||
group_id = 235801002,
|
||||
worktop_id = 123, --操作台对应的操作数
|
||||
air_wall = 2005, --场内空气墙对应的ConfigID
|
||||
minion_fever = 5, --普通怪物死亡增加的热度值
|
||||
game_time = 360, --挑战时间
|
||||
min_monster_count = 5, --场上最少怪物数量
|
||||
max_monster_count = 5, --场上最多怪物数量
|
||||
environment_suite = 4, --环境灯光所在的Suite
|
||||
noswitch_punishment_interval = 30, --不换人开始有惩罚的最小时间间隔
|
||||
num_killed_per_tide = {20, 20, 20, 20, 0} --每组怪物潮对应需要的杀怪数量
|
||||
}
|
||||
|
||||
]]
|
||||
|
||||
|
||||
local local_defs = {
|
||||
worktop_option = 30110,
|
||||
progress_key = 1,
|
||||
team_global_value = "FEVER_LEVEL",
|
||||
team_noswitch_pubishment = "NOSWITCH_PUNISHMENT",
|
||||
team_has_switch = "HAS_SWITCHED_TEAM",
|
||||
burn_effect_level = 2,
|
||||
environment_change_level = 1,
|
||||
base_upgrade_reminder = 358010102,
|
||||
team_noswitch_pubishment_reminder = 144,
|
||||
punish_inAdvance_reminder = 201
|
||||
}
|
||||
|
||||
local Tri = {
|
||||
[1] = { name = "group_load", config_id = 8000001, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0},
|
||||
[2] = { name = "gadget_talk_done", config_id = 8000002, event = EventType.EVENT_GADGETTALK_DONE, source = "", condition = "", action = "action_gadget_talk_done", trigger_count = 0},
|
||||
[3] = { name = "gallery_pre_start", config_id = 8000003, event = EventType.EVENT_GALLERY_PRE_START, source = "", condition = "", action = "action_gallery_pre_start", trigger_count = 0},
|
||||
[4] = { name = "dungeon_settle", config_id = 8000004, event = EventType.EVENT_DUNGEON_SETTLE, source = "", condition = "", action = "action_dungeon_settle", trigger_count = 0},
|
||||
[5] = { name = "gallery_stop", config_id = 8000005, event = EventType.EVENT_GALLERY_STOP, source = "", condition = "", action = "action_gallery_stop", trigger_count = 0},
|
||||
|
||||
--[2] = { name = "select_option", config_id = 8000002, event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_select_option", trigger_count = 0},
|
||||
--[3] = { name = "time_axis_pass", config_id = 8000003, event = EventType.EVENT_TIME_AXIS_PASS, source = "", condition = "", action = "action_time_axis_pass", trigger_count = 0},
|
||||
--[4] = { name = "gallery_progress_pass", config_id = 8000004, event = EventType.EVENT_GALLERY_PROGRESS_PASS, source = "", condition = "", action = "action_gallery_progress_pass", trigger_count = 0},
|
||||
--[6] = { name = "sumo_switch_team", config_id = 8000008, event = EventType.EVENT_SUMO_SWITCH_TEAM_EVENT, source = "", condition = "", action = "action_sumo_switch_team", trigger_count = 0},
|
||||
--[7] = { name = "dungeon_all_avatar_die", config_id = 8000009, event = EventType.EVENT_DUNGEON_ALL_AVATAR_DIE, source = "", condition = "", action = "action_dungeon_all_avatar_die", trigger_count = 0},
|
||||
--[8] = { name = "enter_start_region", config_id = 8000011, event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_enter_start_region", trigger_count = 0},
|
||||
|
||||
}
|
||||
|
||||
function Initialize()
|
||||
for k,v in pairs(Tri) do
|
||||
table.insert(triggers, v)
|
||||
table.insert(suites[1].triggers, v.name)
|
||||
end
|
||||
|
||||
table.insert(variables,{ config_id=50000003,name = "fever_ratio", value = 1})
|
||||
--用于记录是否已经创建空气墙,防止玩家卡在空气墙外
|
||||
table.insert(variables,{ config_id=50000006,name = "is_air_wall_created", value = 0})
|
||||
end
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
function action_group_load(context,evt)
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker groupLoad")
|
||||
SLC_SetEnvLevel(context,1)
|
||||
return 0
|
||||
end
|
||||
function action_gadget_talk_done(context,evt)
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker action_gadget_talk_done")
|
||||
|
||||
local talkName = evt.source_name
|
||||
local talkID = evt.param2
|
||||
if talkID == 6800419 or talkName == 6800419 then
|
||||
ScriptLib.CreateGadget(context, { config_id = defs.gadget_teleport })
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_gallery_pre_start(context,evt)
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker action_gallery_pre_start")
|
||||
|
||||
local curGallery = evt.param1
|
||||
ScriptLib.SetGroupTempValue(context, "curGallery", curGallery, {})
|
||||
|
||||
if defs then
|
||||
if defs.gadget_bricks then
|
||||
ScriptLib.CreateGadget(context, { config_id = defs.gadget_bricks })
|
||||
end
|
||||
if defs.gadget_airWall then
|
||||
ScriptLib.CreateGadget(context, { config_id = defs.gadget_airWall })
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_dungeon_settle(context,evt)
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker action_dungeon_settle")
|
||||
|
||||
local curGallery = ScriptLib.GetGroupTempValue(context, "curGallery", {})
|
||||
ScriptLib.StopGallery(context, curGallery, true)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_gallery_stop(context,evt)
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker action_gallery_stop")
|
||||
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.GADGET, defs.gadget_bricks)
|
||||
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.GADGET, defs.gadget_airWall)
|
||||
SLC_SetEnvLevel(context,1)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function SLC_SetEnvLevel(context,value)
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker SLC_SetEnvLevel In")
|
||||
|
||||
if value and defs.gadget_envLamp then
|
||||
if value == 1 then
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker SLC_SetEnvLevel 1")
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_envLamp, 0)
|
||||
end
|
||||
if value == 2 then
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker SLC_SetEnvLevel 2")
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_envLamp, 201)
|
||||
end
|
||||
if value == 3 then
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker SLC_SetEnvLevel 3")
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_envLamp, 202)
|
||||
end
|
||||
end
|
||||
|
||||
if value and defs.envWeather and defs.envWeather[value] then
|
||||
for _,v in pairs(defs.envWeather) do
|
||||
ScriptLib.SetWeatherAreaState(context, v, 0)
|
||||
end
|
||||
ScriptLib.PrintContextLog(context,"BrickBreaker ChangeWeather "..tostring(defs.envWeather[value]))
|
||||
|
||||
ScriptLib.SetWeatherAreaState(context, defs.envWeather[value], 1)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
------------------------------------------------------------------
|
||||
Initialize()
|
||||
|
||||
680
gdconf/game_data_config/lua/common/V3_3/CoinCollect.lua
Normal file
680
gdconf/game_data_config/lua/common/V3_3/CoinCollect.lua
Normal file
@@ -0,0 +1,680 @@
|
||||
--[[======================================
|
||||
|| filename: CoinCollect
|
||||
|| owner: shuyi.chang
|
||||
|| description: 3.3短距寻物
|
||||
|| LogName: ## TD_CoinCollect:
|
||||
|| Protection:
|
||||
=======================================]]
|
||||
|
||||
--[[
|
||||
local defs =
|
||||
{
|
||||
-- 还剩多少秒的时候出现金币提示光柱
|
||||
hintTime = 30,
|
||||
|
||||
-- 限时金币出现的时长
|
||||
coinTime = 10,
|
||||
|
||||
-- 挑战总时长【不配的话就默认是120】
|
||||
totalTime = 120,
|
||||
|
||||
-- 技能持续时长【不配的话默认是10】
|
||||
skillDuration = 10,
|
||||
|
||||
-- 对应的gallery id
|
||||
galleryId = 99,
|
||||
}
|
||||
|
||||
local defs_miscs =
|
||||
{
|
||||
-- 特殊金币和它们关联的普通金币们,有几个特殊金币就应该有几项
|
||||
specialCoinTable = {
|
||||
-- 每项格式如下
|
||||
[specialCoin_configId] = {coin_configId_01, coin_configId_02, coin_configId_03, ...},
|
||||
},
|
||||
|
||||
}
|
||||
--]]
|
||||
|
||||
-- 注意这个动态group卸载会先于gallery结束,所以不能用event_gallery_stop,保底在group will unload里
|
||||
local extraTriggers =
|
||||
{
|
||||
{ config_id = 50000001, name = "GROUP_LOAD", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_EVENT_GROUP_LOAD", trigger_count = 0 },
|
||||
{ config_id = 50000002, name = "TIME_AXIS_PASS", event = EventType.EVENT_TIME_AXIS_PASS, source = "", condition = "", action = "action_EVENT_TIME_AXIS_PASS", trigger_count = 0 },
|
||||
-- { config_id = 50000003, name = "GADGET_STATE_CHANGE", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_EVENT_GADGET_STATE_CHANGE", trigger_count = 0 },
|
||||
{ config_id = 50000004, name = "ENTER_REGION", event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_EVENT_ENTER_REGION", forbid_guest = false, trigger_count = 0 },
|
||||
-- { config_id = 50000005, name = "VARIABLE_CHANGE_COUNT", event = EventType.EVENT_VARIABLE_CHANGE, source = "collectedCoins", condition = "condition_EVENT_VARIABLE_CHANGE_COUNT", action = "action_EVENT_VARIABLE_CHANGE_COUNT", trigger_count = 0, tag = "99" },
|
||||
-- { config_id = 50000006, name = "SELECT_OPTION", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_EVENT_SELECT_OPTION", trigger_count = 0, },
|
||||
{ config_id = 50000009, name = "VARIABLE_CHANGE", event = EventType.EVENT_VARIABLE_CHANGE, source = "", condition = "", action = "action_EVENT_VARIABLE_CHANGE", trigger_count = 0, },
|
||||
{ config_id = 50000010, name = "GALLERY_START", event = EventType.EVENT_GALLERY_START, source = "", condition = "", action = "action_EVENT_GALLERY_START", trigger_count = 0, },
|
||||
{ config_id = 50000011, name = "LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_EVENT_LEAVE_REGION", trigger_count = 0 },
|
||||
{ config_id = 50000012, name = "GROUP_WILL_UNLOAD", event = EventType.EVENT_GROUP_WILL_UNLOAD, source = "", condition = "", action = "action_EVENT_GROUP_WILL_UNLOAD", trigger_count = 0 },
|
||||
{ config_id = 50000013, name = "MP_ALL_PLAYER_DIE", event = EventType.EVENT_SCENE_MP_PLAY_ALL_AVATAR_DIE, source = "", condition = "", action = "action_EVENT_MP_ALL_PLAYER_DIE", trigger_count = 0 },
|
||||
|
||||
}
|
||||
|
||||
local extraVariables =
|
||||
{
|
||||
{ config_id = 50000101, name = "final", value = 0, no_refresh = false },
|
||||
{ config_id = 50000102, name = "collectedCoins", value = 0, no_refresh = false },
|
||||
{ config_id = 50000103, name = "levelStart", value = 0, no_refresh = false },
|
||||
}
|
||||
|
||||
local coin_gadgetId = 70220131
|
||||
local specialCoin_gadgetId = 70220132
|
||||
|
||||
-- 所有不跟特殊金币挂钩的普通金币
|
||||
local indieCoins = {}
|
||||
|
||||
-- 所有跟特殊金币挂钩的普通金币
|
||||
local tempCoins = {}
|
||||
|
||||
local abilityGroup = "ActivityAbility_CoinCollect_AbilityGroup"
|
||||
|
||||
local totalCoinCount = 0
|
||||
|
||||
local totalTime = 120
|
||||
|
||||
local skillTable =
|
||||
{
|
||||
["coin"] = {name = "coin", duration = 10},
|
||||
["charge"] = {name = "charge", duration = 10},
|
||||
}
|
||||
|
||||
local skillDuration = 10
|
||||
|
||||
local coinState = {
|
||||
["default"] = 0,
|
||||
["show"] = 201,
|
||||
["highlight"] = 901,
|
||||
["special"] = 902,
|
||||
["dead"] = 202,
|
||||
}
|
||||
--================================================================
|
||||
-- Local Functions
|
||||
--================================================================
|
||||
function LF_Initialize_Group(triggers, suites, variables, gadgets, regions)
|
||||
|
||||
-- insert triggers
|
||||
for i = 1, #extraTriggers do
|
||||
table.insert(triggers, extraTriggers[i])
|
||||
end
|
||||
|
||||
-- add triggers to suite
|
||||
for i = 1, #extraTriggers do
|
||||
-- 都放到初始suite 1中
|
||||
table.insert(suites[1].triggers,extraTriggers[i].name)
|
||||
end
|
||||
|
||||
-- insert variables
|
||||
for i = 1, #extraVariables do
|
||||
table.insert(variables, extraVariables[i])
|
||||
end
|
||||
|
||||
local temp = 0
|
||||
for i, v in pairs(defs_miscs.specialCoinTable) do
|
||||
for j = 1, #v do
|
||||
-- 每个限时金币记一下自己属于哪个特殊金币
|
||||
gadgets[v[j]]["specialCoin"] = i
|
||||
|
||||
-- add all temp coins to table
|
||||
table.insert(tempCoins, v[j])
|
||||
end
|
||||
|
||||
-- 每个特殊金币一个group var记录自己的限时金币被吃掉了多少个
|
||||
temp = temp + 1
|
||||
local coinVar = { config_id = 60000000 + temp, name = tostring(i), value = 0, no_refresh = true }
|
||||
table.insert(variables, coinVar)
|
||||
end
|
||||
|
||||
-- add all independent coins to table
|
||||
for i, v in pairs(gadgets) do
|
||||
if v.gadget_id == coin_gadgetId then
|
||||
-- 不能是跟特殊金币关联的普通金币
|
||||
for j = 1, #tempCoins do
|
||||
if v.config_id == tempCoins[j] then
|
||||
break
|
||||
end
|
||||
|
||||
if j == #tempCoins then
|
||||
-- 最后一项还没break,就是它了
|
||||
table.insert(indieCoins, v.config_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- add ability group
|
||||
-- regions[defs.maxRegion].team_ability_group_list = {abilityGroup}
|
||||
|
||||
totalCoinCount = #indieCoins + #tempCoins
|
||||
|
||||
-- 处理下挑战时长
|
||||
if defs.totalTime ~= nil then
|
||||
totalTime = defs.totalTime
|
||||
end
|
||||
|
||||
-- 处理下技能时长
|
||||
if defs.skillDuration ~= nil then
|
||||
skillDuration = defs.skillDuration
|
||||
end
|
||||
end
|
||||
|
||||
function LF_PrintList(context, name, list)
|
||||
local emptyStr = ""
|
||||
for k, v in pairs(list) do
|
||||
emptyStr = emptyStr..v..", "
|
||||
end
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: list name = "..name..", list content = "..emptyStr)
|
||||
end
|
||||
|
||||
-- 从所有201金币中随机1个金币(特殊金币+不和特殊金币关联的普通金币)
|
||||
function LF_RandomCoin(context)
|
||||
local tempTable = {}
|
||||
-- 特殊金币
|
||||
for i, v in pairs(defs_miscs.specialCoinTable) do
|
||||
if ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, i) == coinState.show then
|
||||
table.insert(tempTable, i)
|
||||
end
|
||||
end
|
||||
|
||||
-- 不和特殊金币关联的普通金币
|
||||
for i = 1, #indieCoins do
|
||||
if ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, indieCoins[i]) == coinState.show then
|
||||
table.insert(tempTable, indieCoins[i])
|
||||
end
|
||||
end
|
||||
|
||||
LF_PrintList(context, "randomCoins", tempTable)
|
||||
|
||||
if #tempTable == 0 then
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: no 201 coins")
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
math.randomseed(tostring(ScriptLib.GetServerTime(context)):reverse():sub(1, 6))
|
||||
local coinId = tempTable[math.random(#tempTable)]
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: LF_RandomCoin is called, coin id = "..coinId)
|
||||
|
||||
return coinId
|
||||
end
|
||||
|
||||
function LF_ThreeRandomCoins(context)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: LF_ThreeRandomCoins is called")
|
||||
|
||||
local tempTable = {}
|
||||
-- 特殊金币
|
||||
for i, v in pairs(defs_miscs.specialCoinTable) do
|
||||
if ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, i) == coinState.show then
|
||||
table.insert(tempTable, i)
|
||||
end
|
||||
end
|
||||
|
||||
-- 不和特殊金币关联的普通金币
|
||||
for i = 1, #indieCoins do
|
||||
if ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, indieCoins[i]) == coinState.show then
|
||||
table.insert(tempTable, indieCoins[i])
|
||||
end
|
||||
end
|
||||
|
||||
LF_PrintList(context, "201Coins", tempTable)
|
||||
|
||||
-- 要是不足三个金币在201,有几个用几个
|
||||
if #tempTable <= 3 then
|
||||
return tempTable
|
||||
end
|
||||
|
||||
-- 多余三个
|
||||
math.randomseed(tostring(ScriptLib.GetServerTime(context)):reverse():sub(1, 6))
|
||||
local middle = math.random(#tempTable)
|
||||
if middle <= 1 then
|
||||
-- 随到了1,取2
|
||||
middle = 2
|
||||
elseif middle == #tempTable then
|
||||
-- 随到了最后一项,取倒数第二项
|
||||
middle = #tempTable - 1
|
||||
end
|
||||
local middleId = tempTable[middle]
|
||||
|
||||
local top = math.random(middle - 1)
|
||||
local topId = tempTable[top]
|
||||
|
||||
local bottom = math.random(middle + 1, #tempTable)
|
||||
local bottomId = tempTable[bottom]
|
||||
|
||||
local returnTable = {}
|
||||
if topId ~= 0 then
|
||||
table.insert(returnTable, topId)
|
||||
end
|
||||
if middleId ~= 0 then
|
||||
table.insert(returnTable, middleId)
|
||||
end
|
||||
if bottomId ~= 0 then
|
||||
table.insert(returnTable, bottomId)
|
||||
end
|
||||
LF_PrintList(context, "hintCoins", returnTable)
|
||||
return returnTable
|
||||
end
|
||||
|
||||
function LF_ResetGroup(context, start)
|
||||
|
||||
for i, v in pairs(defs_miscs.specialCoinTable) do
|
||||
ScriptLib.SetGroupVariableValue(context, tostring(i), 0)
|
||||
end
|
||||
|
||||
if start == false then
|
||||
-- 结束的时候不设置任何状态
|
||||
return
|
||||
end
|
||||
|
||||
-- 重置所有金币
|
||||
-- 保底把所有temp coins设置为【显示】状态
|
||||
for i = 1, #tempCoins do
|
||||
ScriptLib.SetGadgetStateByConfigId(context, tempCoins[i], coinState.show)
|
||||
end
|
||||
|
||||
-- 保底把所有indie coins设置为显示状态
|
||||
for i = 1, #indieCoins do
|
||||
ScriptLib.SetGadgetStateByConfigId(context, indieCoins[i], coinState.show)
|
||||
end
|
||||
|
||||
-- 把特殊金币设置为显示状态
|
||||
for k, v in pairs(defs_miscs.specialCoinTable) do
|
||||
ScriptLib.SetGadgetStateByConfigId(context, k, coinState.show)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function LF_ResetVariables(context, start)
|
||||
-- 各种变量都归零
|
||||
ScriptLib.SetGroupVariableValue(context, "final", 0)
|
||||
ScriptLib.SetGroupVariableValue(context, "collectedCoins", 0)
|
||||
ScriptLib.SetGroupVariableValue(context, "levelStart", 0)
|
||||
|
||||
ScriptLib.SetGroupTempValue(context, "lastCoin", 0, {})
|
||||
|
||||
-- 所有人的各种sgv都归零
|
||||
local value = 0
|
||||
if start == true then
|
||||
value = 0
|
||||
elseif start == false then
|
||||
value = -3
|
||||
end
|
||||
|
||||
local uidList = ScriptLib.GetSceneUidList(context)
|
||||
for i = 1, #uidList do
|
||||
-- 保底,value是负数的话能量一定不会随时间增长
|
||||
ScriptLib.SetTeamServerGlobalValue(context, uidList[i], "SGV_CoinCollect_Skill_Charge", value)
|
||||
ScriptLib.SetTeamServerGlobalValue(context, uidList[i], "SGV_CoinCollect_Skill_Coin", 0)
|
||||
ScriptLib.SetTeamServerGlobalValue(context, uidList[i], "SGV_CoinCollect_Widget_SkillEnabled", 0)
|
||||
|
||||
-- 小道具初始给100能量,结束的时候能量清空(上限是200,-200肯定能清空)
|
||||
local ret = ScriptLib.AddTeamEntityGlobalFloatValue(context, {uidList[i]}, "GV_CoinCollect_Widget_Energy", 100 * (value + 1))
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: GV_CoinCollect_Widget_Energy is set to "..100 * (value + 1)..", uid = "..uidList[i]..", ret = "..ret)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function LF_LevelStart(context, start)
|
||||
|
||||
LF_ResetVariables(context, start)
|
||||
LF_ResetGroup(context, start)
|
||||
|
||||
if start == true then
|
||||
-- 设置vision type
|
||||
local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
ScriptLib.SetPlayerGroupVisionType(context, uid_list, {0})
|
||||
|
||||
elseif start == false then
|
||||
-- vision type恢复正常
|
||||
local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
ScriptLib.SetPlayerGroupVisionType(context, uid_list, {1})
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function LF_CheckSkill(context, uid)
|
||||
local list = ScriptLib.GetCoinCollectGalleryPlayerSkillInfo(context, uid, defs.galleryId)
|
||||
LF_PrintList(context, "skillList"..uid, list)
|
||||
|
||||
if #list == 0 then
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: WARNING!! no player skill data")
|
||||
return 0
|
||||
end
|
||||
|
||||
ScriptLib.SetGroupTempValue(context, "skill_"..uid, list[1], {})
|
||||
ScriptLib.SetGroupTempValue(context, "charge_"..uid, list[2], {})
|
||||
ScriptLib.SetGroupTempValue(context, "coin_"..uid, list[3], {})
|
||||
ScriptLib.SetGroupTempValue(context, "times_"..uid, 0, {})
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: LF_CheckSkill is called, uid = "..uid..", skill_id = "..list[1]..", charge = "..list[2]..", coin = "..list[3])
|
||||
|
||||
end
|
||||
|
||||
|
||||
function LF_GetTableLength(t)
|
||||
local count = 0
|
||||
for _ in pairs(t) do count = count + 1 end
|
||||
return count
|
||||
end
|
||||
|
||||
--================================================================
|
||||
-- Triggers
|
||||
--================================================================
|
||||
function action_EVENT_GROUP_LOAD(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: group is loaded")
|
||||
-- 打印一下各种变量
|
||||
LF_PrintList(context, "tempCoins", tempCoins)
|
||||
LF_PrintList(context, "indieCoins", indieCoins)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: total coins = "..totalCoinCount)
|
||||
|
||||
-- 每个玩家记三个temp var给小道具技能
|
||||
local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
for i = 1, #uid_list do
|
||||
ScriptLib.SetGroupTempValue(context, "skill_"..uid_list[i], 0, {})
|
||||
ScriptLib.SetGroupTempValue(context, "charge_"..uid_list[i], 0, {})
|
||||
ScriptLib.SetGroupTempValue(context, "coin_"..uid_list[i], 0, {})
|
||||
|
||||
end
|
||||
|
||||
-- 初始化其他group temp var
|
||||
ScriptLib.SetGroupTempValue(context, "galleryStart", 0, {})
|
||||
|
||||
-- 气球默认0不出现,这个时候就要设置气球状态了!
|
||||
LF_ResetGroup(context, true)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_EVENT_GROUP_WILL_UNLOAD(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: group will unload")
|
||||
-- 埋点:每个玩家用了多少次技能
|
||||
local transaction = ScriptLib.GetGalleryTransaction(context, defs.galleryId)
|
||||
local uidList = ScriptLib.GetSceneUidList(context)
|
||||
for i = 1, #uidList do
|
||||
local skill_id = ScriptLib.GetGroupTempValue(context, "skill_"..uidList[i], {})
|
||||
local times = ScriptLib.GetGroupTempValue(context, "times_"..uidList[i], {})
|
||||
ScriptLib.PrintContextLog(context,"## TD_CoinCollect: transaction = "..transaction..
|
||||
", skill_id = "..skill_id..", times = "..times..", gallery_id = "..defs.galleryId)
|
||||
ScriptLib.MarkGroupLuaAction(context, "CoinCollect_1", transaction,
|
||||
{["gallery_id"] = defs.galleryId, ["skill_id"] = skill_id, ["times"]= times})
|
||||
end
|
||||
|
||||
-- 保底
|
||||
LF_LevelStart(context, false)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
function action_EVENT_ENTER_REGION(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: player enters region")
|
||||
-- 玩家加载时间过长,可能会导致gallery开启后才enter scene(大世界均可传送),如果enter scene的时候gallery已经开了,再统计一次技能
|
||||
if ScriptLib.GetGroupTempValue(context, "galleryStart", {}) == 1 then
|
||||
LF_CheckSkill(context, context.uid)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_EVENT_LEAVE_REGION(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: player leaves region")
|
||||
|
||||
LF_LevelStart(context, false)
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_EVENT_TIME_AXIS_PASS(context, evt)
|
||||
local timeProcess = evt.param1
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: time axis "..evt.source_name..", stage "..timeProcess.. " is finished")
|
||||
|
||||
if evt.source_name == "levelCountDown" then
|
||||
-- 随机若干普通金币和特殊金币光柱提示
|
||||
ScriptLib.SetGroupVariableValue(context, "final", 1)
|
||||
ScriptLib.ShowReminder(context, 400902)
|
||||
local randomCoins = LF_ThreeRandomCoins(context)
|
||||
for i = 1, #randomCoins do
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, base_info.group_id, randomCoins[i], coinState.highlight)
|
||||
|
||||
-- 在对应位置生成一个雷达显示专用物件
|
||||
if gadgets[randomCoins[i]] ~= nil then
|
||||
local pos = gadgets[randomCoins[i]].pos
|
||||
local rot = gadgets[randomCoins[i]].rot
|
||||
ScriptLib.CreateGadgetByParamTable(context, {config_id = bait, pos = pos, rot = rot})
|
||||
end
|
||||
end
|
||||
|
||||
elseif string.sub(evt.source_name, 1, 12) == "specialCoin_" then
|
||||
-- 所有201限时金币都消失回到0,特殊金币重新出现
|
||||
local configId = tonumber(string.sub(evt.source_name, 13))
|
||||
local tempCoins = defs_miscs.specialCoinTable[configId]
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, base_info.group_id, configId, coinState.show)
|
||||
for i = 1, #tempCoins do
|
||||
-- 还在902的金币消失
|
||||
if ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, tempCoins[i]) == coinState.special then
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, base_info.group_id, tempCoins[i], 0)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- 技能结束
|
||||
local uid = tonumber(evt.source_name)
|
||||
if uid == nil then
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: WARNING!!! no valid uid when widget skill is supposed to end")
|
||||
return 0
|
||||
end
|
||||
|
||||
-- 不在乎这个技能有没有金币和充能,都可以归零
|
||||
ScriptLib.SetTeamServerGlobalValue(context, uid, "SGV_CoinCollect_Skill_Charge", 0)
|
||||
ScriptLib.SetTeamServerGlobalValue(context, uid, "SGV_CoinCollect_Skill_Coin", 0)
|
||||
ScriptLib.SetTeamServerGlobalValue(context, uid, "SGV_CoinCollect_Widget_SkillEnabled", 0)
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: uid = "..uid..", skill end")
|
||||
-- elseif string.sub(evt.source_name, 1, 4) == "coin" then
|
||||
-- -- 金币技能结束
|
||||
-- local uid = tonumber(string.gsub(evt.source_name, "coin_", ""))
|
||||
|
||||
-- if uid == nil then
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_CoinCollect: WARNING!!! no valid uid when coin skill is supposed to end")
|
||||
-- return 0
|
||||
-- end
|
||||
|
||||
-- ScriptLib.SetTeamServerGlobalValue(context, uid, "SGV_CoinCollect_Skill_Coin", 0)
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_CoinCollect: uid = "..uid..", skill = coin, end")
|
||||
|
||||
-- elseif string.sub(evt.source_name, 1, 6) == "charge" then
|
||||
-- -- 充能技能结束
|
||||
-- local uid = tonumber(string.gsub(evt.source_name, "charge_", ""))
|
||||
|
||||
-- if uid == nil then
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_CoinCollect: WARNING!!! no valid uid when charge skill is supposed to end")
|
||||
-- return 0
|
||||
-- end
|
||||
|
||||
-- ScriptLib.SetTeamServerGlobalValue(context, uid, "SGV_CoinCollect_Skill_Charge", 0)
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_CoinCollect: uid = "..uid..", skill = charge, end")
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
-- function condition_EVENT_VARIABLE_CHANGE_COUNT(context, evt)
|
||||
-- if evt.param2 ~= evt.param1 then return true end
|
||||
-- return false
|
||||
-- end
|
||||
|
||||
-- function action_EVENT_VARIABLE_CHANGE_COUNT(context, evt)
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_CoinCollect: "..evt.source_name.." changes from "..evt.param2.." to ".. evt.param1)
|
||||
|
||||
-- return 0
|
||||
-- end
|
||||
|
||||
function action_EVENT_VARIABLE_CHANGE(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: "..evt.source_name.." changes from "..evt.param2.." to ".. evt.param1)
|
||||
|
||||
if evt.param1 == evt.param2 then
|
||||
return 0
|
||||
end
|
||||
|
||||
if evt.param1 == 1 and evt.source_name == "levelStart" then
|
||||
|
||||
-- todo 应该服务器开启gallery,暂时先lua这里手动开
|
||||
local ret = ScriptLib.StartGallery(context, defs.galleryId)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: start gallery = "..defs.galleryId..", ret = "..ret)
|
||||
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_EVENT_GALLERY_START(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: gallery = "..evt.param1.." starts")
|
||||
|
||||
ScriptLib.SetGroupTempValue(context, "galleryStart", 1, {})
|
||||
|
||||
-- 重置变量,小道具初始给100,所有金币都显示
|
||||
LF_LevelStart(context, true)
|
||||
|
||||
-- gallery开启后开始时间轴计时
|
||||
ScriptLib.InitTimeAxis(context, "levelCountDown", {totalTime - defs.hintTime, totalTime}, false)
|
||||
|
||||
-- 把所有temp coins设置为【隐藏】状态
|
||||
for i = 1, #tempCoins do
|
||||
ScriptLib.SetGadgetStateByConfigId(context, tempCoins[i], coinState.default)
|
||||
end
|
||||
|
||||
-- -- todo 应该gallery自带左侧进度显示,客户端还没接,先用挑战代替
|
||||
-- ScriptLib.StartChallenge(context, defs.challengeId, defs.challengeId, {totalTime, 3, 99, totalCoinCount})
|
||||
|
||||
-- 判断此局使用的技能
|
||||
local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
for i = 1, #uid_list do
|
||||
LF_CheckSkill(context, uid_list[i])
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_EVENT_MP_ALL_PLAYER_DIE(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: all players die in mp mode")
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
--================================================================
|
||||
-- SLCs
|
||||
--================================================================
|
||||
function SLC_Player_Approach_Coin(context, param1, param2)
|
||||
-- param1是金币的类型,param2
|
||||
local configId = ScriptLib.GetGadgetConfigId(context, { gadget_eid = context.target_entity_id })
|
||||
local gadgetState = ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, configId)
|
||||
if configId == 0 then
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: SLC_Player_Approach_Coin is called, configId = "..configId..", empty config id, return immediately")
|
||||
return 0
|
||||
end
|
||||
|
||||
if gadgets[configId] == nil or ScriptLib.CheckIsInGroup(context, 0, configId) == false then
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: SLC_Player_Approach_Coin is called, configId = "..configId..", cannot find entity in group, return immediately")
|
||||
return 0
|
||||
end
|
||||
|
||||
if gadgets[configId].gadget_id ~= coin_gadgetId and gadgets[configId].gadget_id ~= specialCoin_gadgetId then
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: SLC_Player_Approach_Coin is called, configId = "..configId..", illegal gadget id, return immediately")
|
||||
return 0
|
||||
end
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: SLC_Player_Approach_Coin is called, configId = "..configId)
|
||||
|
||||
-- 1普通金币,2特殊金币
|
||||
if param1 == 1 then
|
||||
-- ScriptLib.SetGroupGadgetStateByConfigId(context, base_info.group_id, configId, 202)
|
||||
ScriptLib.KillEntityByConfigId(context, { config_id = configId })
|
||||
|
||||
|
||||
-- todo 通知gallery修改计分,暂时先用挑战做了
|
||||
ScriptLib.ChangeGroupVariableValue(context, "collectedCoins", 1)
|
||||
local collectedCoins = ScriptLib.GetGroupVariableValue(context, "collectedCoins")
|
||||
|
||||
-- param2是消耗了多少时间
|
||||
-- local timePassed = totalTime - param2/1000
|
||||
local timePassed = param2/1000
|
||||
ScriptLib.UpdatePlayerGalleryScore(context, defs.galleryId, {["coin_collect_num"] = collectedCoins, ["last_collect_coin_left_time"] = timePassed})
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: a coin is picked up, gallery score: coin_collect_num = "..collectedCoins..", last_collect_coin_left_time = "..timePassed)
|
||||
|
||||
-- 如果是特殊金币关联的限时金币
|
||||
local specialCoin_configId = gadgets[configId].specialCoin
|
||||
if specialCoin_configId ~= nil then
|
||||
-- if evt.param3 == 902 then
|
||||
ScriptLib.ChangeGroupVariableValue(context, tostring(specialCoin_configId), 1)
|
||||
|
||||
-- 如果某一个特殊金币周围的限时金币都被拾取了,关联的特殊金币消失,时间轴取消(不能把关联的限时金币重置回来了)
|
||||
if ScriptLib.GetGroupVariableValue(context, tostring(specialCoin_configId)) == #defs_miscs.specialCoinTable[specialCoin_configId] then
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, base_info.group_id, specialCoin_configId, coinState.dead)
|
||||
ScriptLib.EndTimeAxis(context, "specialCoin_"..specialCoin_configId)
|
||||
end
|
||||
end
|
||||
|
||||
-- 如果已经吃完所有金币,直接触发gallery成功结算
|
||||
if collectedCoins >= totalCoinCount then
|
||||
-- true是fail
|
||||
ScriptLib.StopGallery(context, defs.galleryId, false)
|
||||
end
|
||||
elseif param1 == 2 then
|
||||
-- 2特殊金币,特殊金币消失,通知这个特殊金币关联的限时普通金币出现
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, base_info.group_id, configId, coinState.special)
|
||||
|
||||
local tempCoins = defs_miscs.specialCoinTable[configId]
|
||||
for i = 1, #tempCoins do
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, base_info.group_id, tempCoins[i], coinState.special)
|
||||
ScriptLib.InitTimeAxis(context, "specialCoin_"..configId, {defs.coinTime}, false)
|
||||
end
|
||||
end
|
||||
|
||||
-- 如果是最后高亮提示时刻,吃掉一个高亮金币就得再随机一个出来
|
||||
if gadgetState == coinState.highlight and ScriptLib.GetGroupVariableValue(context, "final") == 1 then
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, base_info.group_id, LF_RandomCoin(context), coinState.highlight)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function SLC_CoinCollect_WidgetUsed(context)
|
||||
|
||||
-- 使用了一次小道具,需要判断是否需要修改小道具tick速度和金币拾取范围(别的技能的开关是SGV_CoinCollect_Widget_SkillEnabled)
|
||||
local coin = ScriptLib.GetGroupTempValue(context, "coin_"..context.uid,{})
|
||||
local charge = ScriptLib.GetGroupTempValue(context, "charge_"..context.uid,{})
|
||||
ScriptLib.PrintContextLog(context, "## TD_CoinCollect: SLC_CoinCollect_WidgetUsed is called, uid = "..context.uid..", coin = "..coin..", charge = "..charge)
|
||||
|
||||
local times = ScriptLib.GetGroupTempValue(context, "times_"..context.uid, {})
|
||||
ScriptLib.SetGroupTempValue(context, "times_"..context.uid, times + 1, {})
|
||||
|
||||
if coin == 1 then
|
||||
-- 能扩大金币范围
|
||||
ScriptLib.SetTeamServerGlobalValue(context, context.uid, "SGV_CoinCollect_Skill_Coin", 1)
|
||||
-- ScriptLib.InitTimeAxis(context, "coin_"..context.uid, {skillTable.coin.duration}, false)
|
||||
end
|
||||
|
||||
if charge == 1 then
|
||||
-- 充能加速
|
||||
ScriptLib.SetTeamServerGlobalValue(context, context.uid, "SGV_CoinCollect_Skill_Charge", 1)
|
||||
-- ScriptLib.InitTimeAxis(context, "charge_"..context.uid, {skillTable.coin.duration}, false)
|
||||
end
|
||||
|
||||
-- 其他战斗负责的技能,只听这个sgv控制
|
||||
local ret = ScriptLib.SetTeamServerGlobalValue(context, context.uid, "SGV_CoinCollect_Widget_SkillEnabled", 1)
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_CoinCollect: SGV_CoinCollect_Widget_SkillEnabled is set to 1, ret = "..ret)
|
||||
|
||||
-- 据说所有技能持续时长是一致的,只起一个时间轴统一管了
|
||||
ScriptLib.InitTimeAxis(context, tostring(context.uid), {skillDuration}, false)
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
--================================================================
|
||||
-- Initialization
|
||||
--================================================================
|
||||
LF_Initialize_Group(triggers, suites, variables, gadgets, regions)
|
||||
@@ -0,0 +1,840 @@
|
||||
--[[======================================
|
||||
|| filename: HideAndSeek_Gallery_V3
|
||||
|| owner: shuyi.chang
|
||||
|| description: 风行迷踪三期
|
||||
|| LogName: ## HideAndSeek_V3
|
||||
|| Protection: [Protection]
|
||||
=======================================]]
|
||||
|
||||
--[[
|
||||
|
||||
local defs =
|
||||
{
|
||||
gadget_prison = gadget_id,
|
||||
duration = 240,
|
||||
rampage_time = 40,
|
||||
|
||||
-- 用于固定lod 1的region,千万不能填错,填错了一定会炸服务器
|
||||
eye_point = region_id,
|
||||
}
|
||||
|
||||
local energy_info =
|
||||
{
|
||||
[1] = { time = 80, step = {-30,30}, points = {1,2,3,4,5,6}},
|
||||
[2] = { time = 160, step = {-30,30}, points = {1,2,3,4,5,6}}
|
||||
}
|
||||
|
||||
-- 这个group对应的图用哪些,这里就填哪些
|
||||
local disguiseList = {1, 2, 3}
|
||||
|
||||
--]]
|
||||
|
||||
--初始化给的state,V2开始全部由SGV实现
|
||||
local HS_State = {
|
||||
["Play"] = { name = "SGV_HideAndSeek_PlayerState_Play", value = 3 },
|
||||
["Visible"] = { name = "SGV_HideAndSeek_PlayerState_Visible", value = 0 },
|
||||
["OnMap"] = { name = "SGV_HideAndSeek_PlayerState_OnMap", value = 0 },
|
||||
["Moveable"] = { name = "SGV_HideAndSeek_PlayerState_Moveable", value = 0 },
|
||||
["Transfer"] = { name = "SGV_HideAndSeek_PlayerState_Transfer", value = 0 },
|
||||
["TransferCache"] = { name = "SGV_HideAndSeek_PlayerState_TransferCache", value = 0},
|
||||
["UltraMark"] = { name = "SGV_Is_In_UltraMark", value = 0 },
|
||||
["GlobalSight"] = { name = "SGV_Is_In_GlobalSight", value = 0 },
|
||||
["SuperPrison"] = { name = "SGV_Is_In_SuperPrison", value = 0 },
|
||||
["Rampage"] = { name = "SGV_Is_In_Rampage", value = 0 },
|
||||
["Dead"] = { name = "SGV_HideAndSeek_PlayerState_Dead", value = 0},
|
||||
["Is_Detected"] = { name = "SGV_HideAndSeek_PlayerState_Is_Detected", value = 0},
|
||||
-- ===========================【三期新增】隐身诱饵造成的隐身状态==========================
|
||||
["Visible_Bait"] = { name = "SGV_HideAndSeek_PlayerState_Visible_Bait", value = 0},
|
||||
["Visible_Mark"] = { name = "SGV_HideSeek_Real_Invisible_Mark", value = 0},
|
||||
}
|
||||
|
||||
local skill_info = {
|
||||
["HideAndSeek_Skill_CatchPrey"] = { radius = 4 },
|
||||
["HideAndSeek_Skill_Guide"] = { radius = 500 },
|
||||
["HideAndSeek_Skill_Detect_F"] = { radius = 10 },
|
||||
["HideAndSeek_Skill_UltraMark"] = { radius = 500, duration = 60 },
|
||||
["HideAndSeek_Skill_GlobalSight"] = { radius = 500, duration = 20 },
|
||||
["HideAndSeek_Skill_SuperPrison"] = { radius = 500, duration = 40 },
|
||||
-- ===========================【三期新增】隐身诱饵==========================
|
||||
["HideAndSeek_Skill_InvisibleBait_Check"] = { radius = 6, duration = 40 },
|
||||
-- ===========================【三期新增】四方八方之网==========================
|
||||
["HideAndSeek_Skill_HunterNet"] = { radius = 12 },
|
||||
}
|
||||
|
||||
local hunter_win_by_EX = 30
|
||||
local hunter_win_in_time = 120
|
||||
local hunter_catch_by_guide = 10
|
||||
local final_time = 180 --抓捕阶段第180秒后为决胜时间,猎手在该时间内抓两人,记录翻牌
|
||||
|
||||
local map_info = {
|
||||
--一期
|
||||
[1001003] = { name = "QingCe", list = {1,2,3} },
|
||||
[1001022] = { name = "QingQuan", list = {4,5} },
|
||||
[1001004] = { name = "WuWang", list = {4,8} },
|
||||
[1001002] = { name = "JiuZhuang", list = {7,8} },
|
||||
[1001023] = { name = "XueShan", list = {4,8} },
|
||||
--二期地图
|
||||
[1001006] = { name = "test_1", list = {1,2,3} },--轻策庄二期
|
||||
[1001007] = { name = "test_2", list = {4,8} },
|
||||
[1001008] = { name = "test_3", list = {4,8} },
|
||||
[1001009] = { name = "test_4", list = {19,17,18,20} },--离岛
|
||||
[1001010] = { name = "test_5", list = {4,8} },
|
||||
[1001011] = { name = "test_6", list = {11,12,13} },--神里
|
||||
[1001012] = { name = "test_7", list = {14,11,15} },--绯木
|
||||
[1001013] = { name = "test_8", list = {16,17,18} },--九条
|
||||
[1001014] = { name = "test_9", list = {4,8} },
|
||||
[1001015] = { name = "test_10", list = {4,8} },
|
||||
[1001015] = { name = "test_11", list = {4,21} },--初始林地
|
||||
[1001016] = { name = "test_12", list = {4,8} },
|
||||
[1001017] = { name = "test_13", list = {4,8} },
|
||||
[1001018] = { name = "test_14", list = {4,8} },
|
||||
[1001019] = { name = "test_15", list = {4,21,22} },--璃月遗迹
|
||||
[1001020] = { name = "test_16", list = {4,8} },
|
||||
[1001021] = { name = "test_17", list = {4,8} },
|
||||
[1001026] = { name = "test_18", list = {7,8,23} },--酒庄
|
||||
--【三期新增】三期地图
|
||||
[1001027] = { name = "CengYan", list = {21,18,13} },--层岩
|
||||
[1001028] = { name = "HaiYueChi", list = {21,18,13} },--海月池
|
||||
[1001029] = { name = "ShanHuGong", list = {21,18,13} },--珊瑚宫
|
||||
[1001030] = { name = "GanTian", list = {20,11,15} },--绀田村
|
||||
[1001031] = { name = "QingCeZhuang", list = {21,18,2} },--轻策庄
|
||||
[1001032] = { name = "AuMoSi", list = {21,18,13} },--奥摩斯港
|
||||
[1001033] = { name = "ChanNaYuan", list = {21,18,13} },--禅那园
|
||||
[1001034] = { name = "KaSaZhaLai", list = {21,18,13} },--卡萨扎莱
|
||||
[1001035] = { name = "WeiMoZhuang", list = {21,18,13} },--维摩庄
|
||||
[1001036] = { name = "DaBaZha", list = {21,18,13} },--大巴扎
|
||||
|
||||
}
|
||||
|
||||
-- 上面那些变身物件的对应关系
|
||||
-- 1稻草人蓝,2稻草人红,3枯木,4丘丘人木箱,5草垛,6鬼火,7小路灯,8木桶,9火仙灵,10龙血矿石,
|
||||
-- 11木盆,12水桶,13纸灯,14咸菜缸,15泡菜缸,16稻草靶子,17经典木桶,18经典木箱,19米袋子,20小板凳,21qq人木桶,22璃月石灯,23凳子
|
||||
-- 24层岩巨渊木箱,25竖木桶,26横木桶,27石块,28枯木,29珊瑚,30灯柱,31稻妻陶罐,32大酒坛,33璃月木箱,34须弥木箱,35竹筐,36须弥路灯,37营地竖木桶,38营地横木桶,39营地罐子
|
||||
|
||||
--玩法中开启的天气
|
||||
local weather_id_list = {3151}
|
||||
|
||||
local Tri = {
|
||||
[1]={ name = "gallery_stop", config_id = 8000001, event = EventType.EVENT_GALLERY_STOP, source = "", condition = "", action = "action_gallery_stop", trigger_count = 0},
|
||||
[2]={ name = "challenge_success", config_id = 8000003, event = EventType.EVENT_CHALLENGE_SUCCESS, source = "", condition = "", action = "action_challenge_success", trigger_count = 0},
|
||||
[3]={ name = "challenge_fail", config_id = 8000004, event = EventType.EVENT_CHALLENGE_FAIL, source = "", condition = "", action = "action_challenge_fail", trigger_count = 0},
|
||||
[4]={ name = "variable_change", config_id = 8000005, event = EventType.EVENT_VARIABLE_CHANGE, source = "catch_sum", condition = "", action = "action_variable_change", trigger_count = 0, tag = "9012"},
|
||||
[5]={ name = "time_axis_pass", config_id = 8000006, event = EventType.EVENT_TIME_AXIS_PASS, source = "", condition = "", action = "action_time_axis_pass", trigger_count = 0},
|
||||
[6]={ name = "enter_region", config_id = 8000007, event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_enter_region", trigger_count = 0, forbid_guest = false},
|
||||
[7]={ name = "GM_Debug", config_id = 8000008, event = EventType.EVENT_VARIABLE_CHANGE, source = "", condition = "", action = "action_GM_Debug", trigger_count = 0 },
|
||||
[8]={ name = "multistage_end", config_id = 8000009, event = EventType.EVENT_SCENE_MULTISTAGE_PLAY_STAGE_END, source = "", condition = "", action = "action_multistage_end", trigger_count = 0 },
|
||||
[9]={ name = "group_load", config_id = 8000010, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
|
||||
[10]={name = "avatar_die", config_id = 8000011, event = EventType.EVENT_AVATAR_DIE, source = "", condition = "", action = "action_avatar_die", trigger_count = 0 },
|
||||
[11]={name = "player_quit", config_id = 8000012, event = EventType.EVENT_HIDE_AND_SEEK_PLAYER_QUIT, source = "", condition = "", action = "action_player_quit", trigger_count = 0 },
|
||||
[12]={name = "leave_region", config_id = 8000013, event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_leave_region", trigger_count = 0, forbid_guest = false},
|
||||
[13]={name = "group_will_unload", config_id = 8000014, event = EventType.EVENT_GROUP_WILL_UNLOAD, source = "", condition = "", action = "action_group_will_unload", trigger_count = 0 },
|
||||
}
|
||||
|
||||
local Var = {
|
||||
{ config_id=50000001,name = "catch_sum", value = 0, no_refresh = false},
|
||||
{ config_id=50000002,name = "GM_stage", value = 0, no_refresh = false},
|
||||
}
|
||||
|
||||
-- 【三期新增】有些ability specials gadget是lua自行创建的,但是需要一个config id,直接在lua里写死,就不用在关卡编辑器里配了
|
||||
-- 但是对pos和area id有一些限制,所以找个地方存一下一定合法的值,方便后面调用
|
||||
local regionDefaultValues = {
|
||||
pos = regions[defs.eye_point].pos,
|
||||
area_id = regions[defs.eye_point].area_id,
|
||||
radius = regions[defs.eye_point].radius,
|
||||
}
|
||||
|
||||
local extraGadgets = {
|
||||
|
||||
-- 隐身诱饵,一人一个
|
||||
-- 不太確定為什麼level = 10,不過二期都是10,所以三期先照抄
|
||||
[30000001] = { config_id = 30000001, gadget_id = 44000457, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
[30000002] = { config_id = 30000002, gadget_id = 44000457, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
[30000003] = { config_id = 30000003, gadget_id = 44000457, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
|
||||
-- 普通诱饵,一人三个
|
||||
[30000004] = { config_id = 30000004, gadget_id = 44000107, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
[30000005] = { config_id = 30000005, gadget_id = 44000107, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
[30000006] = { config_id = 30000006, gadget_id = 44000107, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
|
||||
[30000007] = { config_id = 30000007, gadget_id = 44000107, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
[30000008] = { config_id = 30000008, gadget_id = 44000107, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
[30000009] = { config_id = 30000009, gadget_id = 44000107, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
|
||||
[30000010] = { config_id = 30000010, gadget_id = 44000107, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
[30000011] = { config_id = 30000011, gadget_id = 44000107, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
[30000012] = { config_id = 30000012, gadget_id = 44000107, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
|
||||
-- 能量球,config id把不太吉利的数字跳过去
|
||||
[30000015] = { config_id = 30000015, gadget_id = 44000105, pos = regionDefaultValues.pos, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 10, area_id = regionDefaultValues.area_id },
|
||||
|
||||
}
|
||||
|
||||
local gadget_energy = 30000015
|
||||
|
||||
local invisible_bait_list = { 30000001, 30000002, 30000003 }
|
||||
|
||||
local bait_list = {
|
||||
[1] = {30000004, 30000005, 30000006},
|
||||
[2] = {30000007, 30000008, 30000009},
|
||||
[3] = {30000010, 30000011, 300000012},
|
||||
}
|
||||
|
||||
local extraRegions = {
|
||||
[40000001] = { config_id = 40000001, shape = RegionShape.SPHERE, radius = regionDefaultValues.radius + 5, pos = regionDefaultValues.pos, area_id = regionDefaultValues.area_id }
|
||||
}
|
||||
|
||||
local eyepoint_large_region = 40000001
|
||||
|
||||
local challengeTable = {
|
||||
fatherId = 9011,
|
||||
hunterId = 9012,
|
||||
hiderId = 9013,
|
||||
ghostId = 2013001,
|
||||
}
|
||||
|
||||
function Initialize_Base()
|
||||
for i,v in ipairs(Tri) do
|
||||
table.insert(triggers, v)
|
||||
table.insert(suites[1].triggers, v.name)
|
||||
end
|
||||
for i,v in ipairs(Var) do
|
||||
table.insert(variables, v)
|
||||
end
|
||||
for i,v in pairs(extraGadgets) do
|
||||
table.insert(gadgets, v)
|
||||
end
|
||||
|
||||
for i,v in pairs(extraRegions) do
|
||||
table.insert(regions, v)
|
||||
end
|
||||
|
||||
-- 【三期新增】gadget_prison看起来只会用到一个,三期就不用list了,但是保底一下如果哪里的配置没改成新的
|
||||
if defs.gadget_prison == nil and defs.gadget_prison_list ~= nil then
|
||||
defs.gadget_prison = defs.gadget_prison_list[1]
|
||||
end
|
||||
end
|
||||
---------------------------------------
|
||||
function action_group_load(context, evt)
|
||||
--根据LD铺设随机生成障碍物
|
||||
LF_Bake_Random_Scene(context)
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_gallery_stop(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : Gallery Stop")
|
||||
--实际gameplay仍在进行时玩法停止,则走意外终止流程
|
||||
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
|
||||
LF_Stop_Hide_And_Seek(context, 3)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_multistage_end(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : Multistage End : "..evt.param2.." | is_succ : "..evt.param3)
|
||||
if evt.param3 == 0 then
|
||||
--异常终结玩法
|
||||
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
|
||||
LF_Stop_Hide_And_Seek(context, 3)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
if evt.param2 == 2 then
|
||||
--LF_Bake_Random_Scene(context)
|
||||
elseif evt.param2 == 3 then
|
||||
--进入逃跑阶段
|
||||
ScriptLib.SetGroupTempValue(context, "in_escape", 1, {})
|
||||
LF_Assign_Character_Card(context)
|
||||
elseif evt.param2 == 4 then
|
||||
--进入抓捕阶段
|
||||
ScriptLib.SetGroupTempValue(context, "in_escape", 0, {})
|
||||
LF_Start_Hide_And_Seek(context)
|
||||
|
||||
-- 【三期新增】这个时候通知一下在场的所有诱饵,根据本地gv值决定是否删除effect(感觉不太需要?猎人三期在逃跑阶段是4了,可以跟游侠区分开)
|
||||
-- LF_NotifyInvisibleBaits(context)
|
||||
elseif evt.param2 == 5 then
|
||||
--由于关卡流终止时说明游侠未全灭,判胜
|
||||
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
|
||||
LF_Stop_Hide_And_Seek(context, 2)
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_challenge_success(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_Log : challenge_success -> "..evt.param1)
|
||||
--猎手完成了抓人的挑战,判胜
|
||||
if evt.source_name == "9012" then
|
||||
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
|
||||
LF_Stop_Hide_And_Seek(context, 1)
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_challenge_fail(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_Log : challenge_fail -> "..evt.param1)
|
||||
--猎手未能完成抓人的挑战,判负
|
||||
if evt.source_name == "9011" then
|
||||
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
|
||||
LF_Stop_Hide_And_Seek(context, 2)
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_variable_change(context, evt)
|
||||
-- 只管catch_sum变化
|
||||
if evt.param1 == evt.param2 + 1 then
|
||||
-- 这段有用的,一个玩家在逃跑阶段死亡退出改变catch sum、并导致catch sum等于prey总数,从这里直接判猎人成功
|
||||
if 1 == ScriptLib.GetGroupTempValue(context, "in_escape", {}) then
|
||||
if evt.param1 == ScriptLib.GetGroupTempValue(context, "prey_sum", {}) then
|
||||
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
|
||||
ScriptLib.EndSceneMultiStagePlayStage(context, _index, "null", true)
|
||||
end
|
||||
end
|
||||
--]]
|
||||
return 0
|
||||
else
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
function action_enter_region(context, evt)
|
||||
if evt.param1 ~= defs.eye_point then
|
||||
return -1
|
||||
end
|
||||
--开启视野锚点优化
|
||||
ScriptLib.SetPlayerEyePointStream(context, evt.param1, evt.param1, false)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG SetPlayerEyePointStream")
|
||||
|
||||
-- -- 【三期新增】
|
||||
-- -- 开启锁lod1
|
||||
-- local ret = ScriptLib.SetPlayerEyePointLOD(context, defs.eye_point, eyepoint_large_region, 1)
|
||||
-- ScriptLib.PrintContextLog(context, "## HideAndSeek_V3 lod level is set to 1, succeed = "..ret)
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_leave_region(context, evt)
|
||||
if evt.param1 ~= defs.eye_point then
|
||||
return -1
|
||||
end
|
||||
--关闭视野锚点优化
|
||||
ScriptLib.ClearPlayerEyePoint(context, evt.param1)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG ClearPlayerEyePoint")
|
||||
|
||||
|
||||
-- -- 【三期新增】
|
||||
-- -- 关闭锁lod1
|
||||
-- local ret = ScriptLib.ClearPlayerEyePoint(context, defs.eye_point)
|
||||
-- ScriptLib.PrintContextLog(context, "## HideAndSeek_V3 player eye point is cleared, succeed = "..ret)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_group_will_unload(context, evt)
|
||||
--提前关闭性能圈保证关闭视野锚点优化
|
||||
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.REGION, defs.eye_point)
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_time_axis_pass(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : time_axis "..evt.source_name.." -> "..evt.param1)
|
||||
if evt.source_name == "rampage" then
|
||||
--触发猎手暴走阶段
|
||||
HideAndSeek_Hunter_Rampage(context)
|
||||
elseif evt.source_name == "energy" then
|
||||
--刷新一个能量球
|
||||
ScriptLib.KillEntityByConfigId(context, {config_id = gadget_energy, entity_type = EntityType.GADGET})
|
||||
--随机选择位置创建能量球
|
||||
local p_list = energy_info[evt.param1].points
|
||||
math.randomseed(ScriptLib.GetServerTime(context))
|
||||
local ret = p_list[math.random(#p_list)]
|
||||
local p_pos = {}
|
||||
local p_rot = {}
|
||||
for k,v in ipairs(points) do
|
||||
if v.config_id == ret then
|
||||
p_pos = v.pos
|
||||
p_rot = v.rot
|
||||
break
|
||||
end
|
||||
end
|
||||
ScriptLib.CreateGadgetByConfigIdByPos(context, gadget_energy, p_pos, p_rot)
|
||||
local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
--通知全体掉能量球
|
||||
ScriptLib.AssignPlayerUidOpNotify(context, {param_index = 12,param_list={},param_uid_list={},duration=3,target_uid_list=uid_list})
|
||||
elseif evt.source_name == "hunter_win_by_EX" or evt.source_name == "hunter_win_in_time" or evt.source_name == "hunter_catch_by_guide" then
|
||||
--相关陈列室统计
|
||||
ScriptLib.SetGroupTempValue(context, evt.source_name, 0, {})
|
||||
elseif evt.source_name == "final_time" then
|
||||
--抓捕阶段第180秒后为决胜时间,猎手在该时间内抓两人,记录翻牌
|
||||
ScriptLib.SetGroupTempValue(context,"is_in_final_time",1,{})
|
||||
else
|
||||
--终止游侠被捕阶段并转为真死亡
|
||||
for i=1,3 do
|
||||
local _uid = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
|
||||
if evt.source_name == tostring(_uid) then
|
||||
ScriptLib.PrintContextLog(context,"## HideAndSeek_V3_LOG realDie = "..tostring(_uid))
|
||||
|
||||
-- ScriptLib.AssignPlayerShowTemplateReminder(context, 138, {param_vec={},param_uid_vec={},uid_vec={_uid}})
|
||||
|
||||
-- 【三期新增】换了一个UI弹窗,要读表,改成下面了
|
||||
local _gallery = ScriptLib.GetGroupTempValue(context, "gallery_id", {})
|
||||
ScriptLib.UpdatePlayerGalleryScore(context, _gallery, {["update_type"]="updateGhostUid", ["ghost_uid"]= _uid})
|
||||
|
||||
LF_Set_Player_State_Value(context, _uid, HS_State.Dead.name, 1)
|
||||
|
||||
-- 【三期新增】游侠死亡后变成幽灵,上新挑战目标
|
||||
-- 这里挑战的具体参数不重要,只是为了显示下左侧文字,反正无论如何都完不成的,结束只需要听关卡通知
|
||||
if ScriptLib.GetGroupTempValue(context, HS_State.Play.name.."_".._uid, {}) == 2 then
|
||||
-- 游侠这时候应该已经是2了
|
||||
ScriptLib.AttachChildChallenge(context, challengeTable.fatherId, i*math.pow(10,5)+challengeTable.ghostId,challengeTable.ghostId,{base_info.group_id,10},{_uid},{success=1,fail=1})
|
||||
end
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_avatar_die(context, evt)
|
||||
--multistage内触发的死亡回调
|
||||
local char = ScriptLib.GetGroupTempValue(context, HS_State.Play.name.."_"..context.uid, {})
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : avatar_die "..context.uid.." | character = "..char)
|
||||
--首先排除玩家死在玩法外的情况
|
||||
if ScriptLib.GetGroupTempValue(context, "is_in_play", {}) == 0 then
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : is_in_play = 0")
|
||||
return -1
|
||||
end
|
||||
if char == 0 then
|
||||
--hunter死亡判负
|
||||
ScriptLib.StopChallenge(context, 9012, 0)
|
||||
elseif char == 1 then
|
||||
--prey死亡算被抓
|
||||
LF_Set_Prey_Die(context, context.uid)
|
||||
elseif char == 3 or char == 4 then
|
||||
for i = 1,3 do
|
||||
local prey = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
|
||||
if prey == context.uid then
|
||||
--prey提前死亡不参与游戏
|
||||
LF_Set_Prey_Die(context, context.uid)
|
||||
return 0
|
||||
end
|
||||
end
|
||||
--hunter提前死亡直接结算prey胜利
|
||||
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
|
||||
ScriptLib.EndSceneMultiStagePlayStage(context, _index, "null", true)
|
||||
LF_Stop_Hide_And_Seek(context, 2)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_player_quit(context, evt)
|
||||
--由multistage触发回调玩家离场
|
||||
for j=1,3 do
|
||||
if context.uid == ScriptLib.GetGroupTempValue(context, "prey_"..j, {}) then
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : Running Player_Quit : "..context.uid)
|
||||
--进行中玩家离场视为hunter抓住了一个
|
||||
ScriptLib.ChangeGroupVariableValue(context, "catch_sum", 1)
|
||||
return 0
|
||||
end
|
||||
end
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : Free Player_Quit : "..context.uid)
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_GM_Debug(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : variable_change "..evt.source_name.." "..evt.param2.." -> "..evt.param1)
|
||||
if evt.param1 == evt.param2 then
|
||||
return -1
|
||||
end
|
||||
local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
for i,v in ipairs(uid_list) do
|
||||
--处理玩家隐身显形
|
||||
if evt.source_name == HS_State.OnMap.name.."_"..v then
|
||||
LF_Notify_Player_Visible(context)
|
||||
return -1
|
||||
end
|
||||
end
|
||||
if evt.source_name == "catch_sum" then
|
||||
return -1
|
||||
end
|
||||
if evt.source_name == "GM_stage" then
|
||||
if evt.param1 == 1 then
|
||||
LF_Bake_Random_Scene(context)
|
||||
elseif evt.param1 == 2 then
|
||||
LF_Assign_Character_Card(context)
|
||||
elseif evt.param1 == 3 then
|
||||
LF_Start_Hide_And_Seek(context)
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
---------------------------------------
|
||||
function LF_Start_Hide_And_Seek(context)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_Log : LF_Start_Hide_And_Seek")
|
||||
LF_Start_Comp_Challenge(context)
|
||||
end
|
||||
|
||||
function LF_Stop_Hide_And_Seek(context, value)
|
||||
--1为hunter胜,2为游侠胜,3为意外中断
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_Log : LF_Stop_Hide_And_Seek | value -> "..value)
|
||||
ScriptLib.SetGroupTempValue(context, "is_in_play", 0, {})
|
||||
ScriptLib.EndTimeAxis(context, "rampage")
|
||||
ScriptLib.EndTimeAxis(context, "energy")
|
||||
local hunter = ScriptLib.GetGroupTempValue(context, "hunter", {})
|
||||
--还未进入幽灵状态的,不用进了,所以关掉时间轴(已经结束)
|
||||
for i=1,3 do
|
||||
local _uid = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
|
||||
ScriptLib.EndTimeAxis(context, tostring(_uid))
|
||||
end
|
||||
--这个watcher比较特殊,需要在胜利时检测prey的state,所以要写在还原state之前。
|
||||
if value == 2 then
|
||||
for i = 1 , 3 do
|
||||
local _prey = ScriptLib.GetGroupTempValue(context, "prey_"..i, {})
|
||||
local _const = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
|
||||
if _const ~= 0 then
|
||||
--存活的prey
|
||||
if _prey ~= 0 then
|
||||
local logvalue = ScriptLib.GetGroupTempValue(context, HS_State.Transfer.name.."_".._const, {})
|
||||
ScriptLib.PrintContextLog(context,"## HideAndSeek_V3_LOG uid:".._const.."的Transfer值为:"..logvalue)
|
||||
--统计:胜利的时候处于变身状态
|
||||
if ScriptLib.GetGroupTempValue(context, HS_State.Transfer.name.."_".._const, {}) > 0 then
|
||||
ScriptLib.PrintContextLog(context,"## HideAndSeek_V3_LOG 统计:胜利的时候处于变身状态 uid:".._const)
|
||||
ScriptLib.AddExhibitionReplaceableData(context, _const, "prey_win_in_transfer", 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--还原玩家所有State
|
||||
local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
for i,v in ipairs(uid_list) do
|
||||
LF_Init_Player_State(context, v)
|
||||
ScriptLib.RevertPlayerRegionVision(context, uid_list[i])
|
||||
end
|
||||
ScriptLib.SetPlayerGroupVisionType(context, uid_list, {1})
|
||||
for i,v in ipairs(bait_list) do
|
||||
for m,n in ipairs(v) do
|
||||
ScriptLib.KillEntityByConfigId(context, {config_id = n, entity_type = EntityType.GADGET})
|
||||
end
|
||||
end
|
||||
if value == 3 then
|
||||
--人数不足导致异常处理
|
||||
ScriptLib.StopChallenge(context, 9011, 0)
|
||||
return -1
|
||||
end
|
||||
local _gallery = ScriptLib.GetGroupTempValue(context, "gallery_id", {})
|
||||
-------
|
||||
local catch_sum = ScriptLib.GetGroupVariableValue(context, "catch_sum")
|
||||
--统计:抓捕总数
|
||||
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_catch_sum", catch_sum)
|
||||
--无论胜败都发的牌:
|
||||
--“是猎人”牌
|
||||
ScriptLib.AddExhibitionReplaceableData(context, hunter, "is_hunter", 1)
|
||||
--“是游侠”牌
|
||||
for i=1,3 do
|
||||
local _prey = ScriptLib.GetGroupTempValue(context, "prey_"..i, {})
|
||||
ScriptLib.AddExhibitionReplaceableData(context, _prey, "is_hunter", 2)
|
||||
|
||||
-- 【三期新增翻牌】游侠-使用隐身诱饵维持多长时间的隐身
|
||||
local invisible_time = ScriptLib.GetGroupTempValue(context, "Visible".._prey, {})
|
||||
ScriptLib.AddExhibitionReplaceableData(context, _prey, "prey_keep_invisible", invisible_time)
|
||||
|
||||
end
|
||||
--hunter胜利
|
||||
if value == 1 then
|
||||
--统计:清扫时刻
|
||||
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_miss_none", 1)
|
||||
--统计:迅捷攻势
|
||||
if 1 == ScriptLib.GetGroupTempValue(context, "hunter_win_by_EX", {}) then
|
||||
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_win_by_EX", 1)
|
||||
end
|
||||
--统计:终场倒计时
|
||||
if 1 == ScriptLib.GetGroupTempValue(context, "hunter_win_in_time", {}) then
|
||||
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_win_in_time", 1)
|
||||
end
|
||||
ScriptLib.UpdatePlayerGalleryScore(context, _gallery, {["update_type"]="updateGalleryResult", ["is_hunter_win"]=true})
|
||||
--prey胜利
|
||||
elseif value == 2 then
|
||||
LF_Handle_Exhibition_Prey_Win(context)
|
||||
ScriptLib.UpdatePlayerGalleryScore(context, _gallery, {["update_type"]="updateGalleryResult", ["is_hunter_win"]=false})
|
||||
end
|
||||
|
||||
-- 【三期新增翻牌】一次抓捕多个游侠
|
||||
local max = ScriptLib.GetGroupTempValue(context, "catch_multiple_prey_max", {})
|
||||
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_catch_multiple_prey_max", max)
|
||||
|
||||
LF_Clear_Random_Scene(context)
|
||||
end
|
||||
|
||||
function LF_Assign_Character_Card(context)
|
||||
-- 1)prey和hunter,以及各种其他局内值都用temp value记录
|
||||
-- 2)开启视野优化
|
||||
-- 3)初始化技能sgv
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : LF_Assign_Character_Card is called")
|
||||
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
|
||||
local _gallery = ScriptLib.GetHideAndSeekPlayGalleryId(context, _index)
|
||||
ScriptLib.SetGroupTempValue(context, "gallery_id", _gallery, {})
|
||||
ScriptLib.SetGroupTempValue(context, "is_in_play", 1, {})
|
||||
|
||||
-- local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
-- 【三期新增】新接口取prey,和服务器保持一致
|
||||
local prey_list = ScriptLib.GetHideAndSeekPreyUidList(context, _index)
|
||||
local hunter = ScriptLib.GetHideAndSeekHunter(context, _index)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : hunter_uid = "..hunter)
|
||||
-- 所有参加活动的玩家的uid list
|
||||
local all_player_list = {}
|
||||
for i = 1, #prey_list do
|
||||
table.insert(all_player_list, prey_list[i])
|
||||
end
|
||||
table.insert(all_player_list, hunter)
|
||||
|
||||
-- 开启视野优化
|
||||
for i = 1, #all_player_list do
|
||||
ScriptLib.ForbidPlayerRegionVision(context, all_player_list[i])
|
||||
end
|
||||
ScriptLib.SetPlayerGroupVisionType(context, all_player_list, {0})
|
||||
|
||||
--分配局内身份信息
|
||||
ScriptLib.SetGroupTempValue(context, "hunter", hunter, {})
|
||||
local cnt = 1
|
||||
for i,v in ipairs(prey_list) do
|
||||
if v ~= hunter then-- 其实不用判,先留着了
|
||||
ScriptLib.SetGroupTempValue(context, "prey_"..cnt, v, {})
|
||||
ScriptLib.SetGroupTempValue(context, "const_prey_"..cnt, v, {})
|
||||
cnt = cnt + 1
|
||||
end
|
||||
end
|
||||
--追加一次游侠数量统计,防止在这个阶段取不到值,考虑到不是很靠谱,四阶段重新计算一次
|
||||
ScriptLib.SetGroupTempValue(context, "prey_sum", #prey_list, {})
|
||||
|
||||
--关闭牢笼
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, defs.gadget_prison, 0)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : player_sum = "..#all_player_list)
|
||||
|
||||
--按选择初始化技能列表
|
||||
for i,v in ipairs(all_player_list) do
|
||||
LF_Init_Player_Skill(context, v, i)
|
||||
LF_Init_Player_State(context, v)
|
||||
if v == hunter then
|
||||
ScriptLib.AssignPlayerUidOpNotify(context, {param_index = 16,param_list={},param_uid_list={},duration=5,target_uid_list={v}})
|
||||
else
|
||||
ScriptLib.AssignPlayerUidOpNotify(context, {param_index = 17,param_list={},param_uid_list={},duration=5,target_uid_list={v}})
|
||||
|
||||
-- 【三期新增翻牌】初始化隐身状态的temp value,要在逃跑阶段一开始就初始化
|
||||
ScriptLib.SetGroupTempValue(context, "Visible_Mark"..v, 0, {})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LF_Init_Player_Skill(context, uid, u_ptr)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : LF_Init_Player_Skill : "..uid)
|
||||
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
|
||||
local _gallery = ScriptLib.GetHideAndSeekPlayGalleryId(context, _index)
|
||||
local skill_list = ScriptLib.GetHideAndSeekPlayerSkillList(context, _index, uid)
|
||||
for p,q in ipairs(skill_list) do
|
||||
ScriptLib.AttachGalleryAbilityGroup(context, {uid}, _gallery, q)
|
||||
end
|
||||
end
|
||||
|
||||
function LF_Start_Comp_Challenge(context)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : LF_Start_Comp_Challenge")
|
||||
ScriptLib.CreateFatherChallenge(context, 9011, 9011, defs.duration, {success=10,fail=10})
|
||||
-- local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
-- 【三期新增】新接口取prey,和服务器保持一致
|
||||
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
|
||||
local prey_list = ScriptLib.GetHideAndSeekPreyUidList(context, _index)
|
||||
|
||||
local hunter = ScriptLib.GetGroupTempValue(context, "hunter", {})
|
||||
LF_Set_Player_State_Value(context, hunter, HS_State.Play.name, 0)
|
||||
|
||||
ScriptLib.ForceRefreshAuthorityByConfigId(context, defs.gadget_prison, hunter)
|
||||
|
||||
local challenge_start_time = ScriptLib.GetServerTime(context)
|
||||
|
||||
--prey_sum这里统计就太晚了,需要三阶段开始先统计一次
|
||||
local prey_sum = 0
|
||||
for i,v in ipairs(prey_list) do
|
||||
-- if v == hunter then
|
||||
-- LF_Set_Player_State_Value(context, v, HS_State.Play.name, 0)
|
||||
-- else
|
||||
local idx = 0
|
||||
for j = 1,3 do
|
||||
if v == ScriptLib.GetGroupTempValue(context, "prey_"..j, {}) then
|
||||
idx = j
|
||||
break
|
||||
end
|
||||
end
|
||||
--只有非死亡状态的游侠才继续游戏
|
||||
if ScriptLib.GetGroupTempValue(context, HS_State.Play.name.."_"..v, {}) == 3 then
|
||||
LF_Set_Player_State_Value(context, v, HS_State.Play.name, 1)
|
||||
ScriptLib.AttachChildChallenge(context, 9011, idx*math.pow(10,5)+9013,9013,{base_info.group_id,10},{v},{success=1,fail=1})
|
||||
prey_sum = prey_sum + 1
|
||||
end
|
||||
|
||||
-- 【三期新增】开始隐身的时间先设成挑战开始时间
|
||||
ScriptLib.SetGroupTempValue(context, "VisibleStart"..v, challenge_start_time, {})
|
||||
|
||||
-- end
|
||||
end
|
||||
if prey_sum == 0 then
|
||||
LF_Stop_Hide_And_Seek(context, 1)
|
||||
-- 就不需要开挑战了
|
||||
return 0
|
||||
end
|
||||
--获取到正确的游侠数量
|
||||
ScriptLib.AttachChildChallenge(context, 9011, 9012, 9012, {0,3,9012,prey_sum}, {hunter},{success=10,fail=10})
|
||||
--启动组合挑战
|
||||
ScriptLib.StartFatherChallenge(context, 9011)
|
||||
ScriptLib.InitTimeAxis(context, "rampage", {defs.duration - defs.rampage_time}, false)
|
||||
--处理两个抓捕结算的初始化
|
||||
ScriptLib.InitTimeAxis(context, "hunter_win_in_time", {hunter_win_in_time}, false)
|
||||
ScriptLib.SetGroupTempValue(context, "hunter_win_in_time", 1, {})
|
||||
--新增翻牌用计时器 抓捕阶段第180秒后为决胜时间,猎手在该时间内抓两人,记录翻牌
|
||||
ScriptLib.InitTimeAxis(context, "final_time", {final_time}, false)
|
||||
--处理能量球计时
|
||||
LF_Set_Energy(context)
|
||||
--解除hunter限制
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, defs.gadget_prison, 201)
|
||||
end
|
||||
|
||||
function LF_Set_Energy(context)
|
||||
--出能量球的时间有略微偏移
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : LF_Set_Energy")
|
||||
math.randomseed(ScriptLib.GetServerTime(context))
|
||||
local energy_list = {}
|
||||
for i,v in ipairs(energy_info) do
|
||||
table.insert(energy_list, v.time + math.random(energy_info[i].step[1],energy_info[i].step[2]))
|
||||
end
|
||||
ScriptLib.InitTimeAxis(context, "energy", energy_list, false)
|
||||
end
|
||||
|
||||
function LF_Bake_Random_Scene(context)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : LF_Bake_Random_Scene")
|
||||
--根据ld需求进行调整
|
||||
|
||||
--开启天气
|
||||
for i = 1 , #weather_id_list do
|
||||
ScriptLib.SetWeatherAreaState(context, weather_id_list[i], 1)
|
||||
end
|
||||
|
||||
--suite 2按权重随机创建
|
||||
if suites[2] ~= nil then
|
||||
math.randomseed(ScriptLib.GetServerTime(context))
|
||||
for i,v in ipairs(suites[2].gadgets) do
|
||||
if math.random(100) > 50 then
|
||||
ScriptLib.CreateGadget(context, {config_id = v})
|
||||
end
|
||||
end
|
||||
end
|
||||
--suite 3创建基本空气墙
|
||||
if suites[3] ~= nil then
|
||||
ScriptLib.AddExtraGroupSuite(context, 0, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function LF_Clear_Random_Scene(context)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : LF_Clear_Random_Scene")
|
||||
--根据需求清理数据
|
||||
ScriptLib.EndTimeAxis(context, "hunter_win_by_EX")
|
||||
ScriptLib.EndTimeAxis(context, "hunter_win_in_time")
|
||||
ScriptLib.EndTimeAxis(context, "hunter_catch_by_guide")
|
||||
ScriptLib.RemoveExtraGroupSuite(context, 0, 3)
|
||||
ScriptLib.RemoveExtraGroupSuite(context, 0, 4)
|
||||
--清理诱饵防止local的残留
|
||||
ScriptLib.KillEntityByConfigId(context, {config_id = gadget_energy, entity_type = EntityType.GADGET})
|
||||
for i,v in ipairs(bait_list) do
|
||||
for m,n in ipairs(v) do
|
||||
ScriptLib.KillEntityByConfigId(context, {config_id = n, entity_type = EntityType.GADGET})
|
||||
end
|
||||
end
|
||||
|
||||
ScriptLib.KillEntityByConfigId(context, {config_id = defs.gadget_prison, entity_type = EntityType.GADGET})
|
||||
|
||||
--关闭天气
|
||||
for i = 1 , #weather_id_list do
|
||||
ScriptLib.SetWeatherAreaState(context, weather_id_list[i], 0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function LF_Init_Player_State(context, uid)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : Init_Player_State : "..uid)
|
||||
for m,n in pairs(HS_State) do
|
||||
if n.name == "SGV_HideAndSeek_PlayerState_Play" then
|
||||
-- 【三期新增】唯独只有这个值,初始的时候要额外区分猎人4和游侠3
|
||||
if uid == ScriptLib.GetGroupTempValue(context, "hunter", {}) then
|
||||
LF_Set_Player_State_Value(context, uid, n.name, 4)
|
||||
else
|
||||
LF_Set_Player_State_Value(context, uid, n.name, n.value)
|
||||
end
|
||||
else
|
||||
LF_Set_Player_State_Value(context, uid, n.name, n.value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--用于集中处理hunter失败的结算
|
||||
function LF_Handle_Exhibition_Prey_Win(context)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : LF_Handle_Exhibition_Prey_Win")
|
||||
local hunter = ScriptLib.GetGroupTempValue(context, "hunter", {})
|
||||
local prey_sum = ScriptLib.GetGroupTempValue(context, "prey_sum", {})
|
||||
local catch_sum = ScriptLib.GetGroupVariableValue(context, "catch_sum")
|
||||
--剩余人数结算
|
||||
local prey_alive = prey_sum - catch_sum
|
||||
if prey_alive == 1 then
|
||||
--统计:猎手的惜败
|
||||
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_miss_one", 1)
|
||||
for i=1,3 do
|
||||
local _prey = ScriptLib.GetGroupTempValue(context, "prey_"..i, {})
|
||||
if _prey ~= 0 then
|
||||
--统计:最后的火种
|
||||
ScriptLib.AddExhibitionReplaceableData(context, _prey, "prey_alive_only", 1)
|
||||
break
|
||||
end
|
||||
end
|
||||
elseif prey_alive == 2 then
|
||||
--统计:猎手的失误
|
||||
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_miss_two", 1)
|
||||
end
|
||||
if catch_sum == 0 then
|
||||
--统计:无从复命
|
||||
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_miss_all", 1)
|
||||
end
|
||||
for i=1,3 do
|
||||
local _prey = ScriptLib.GetGroupTempValue(context, "prey_"..i, {})
|
||||
local _const = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
|
||||
if _const ~= 0 then
|
||||
--存活的prey
|
||||
if _prey ~= 0 then
|
||||
--统计:抗争到底
|
||||
ScriptLib.AddExhibitionReplaceableData(context, _const, "prey_alive_win", 1)
|
||||
--统计:全身而退
|
||||
local guide_time = ScriptLib.GetGroupTempValue(context, "prey_win_by_guide", {})
|
||||
ScriptLib.AddExhibitionReplaceableData(context, _const, "prey_win_by_guide", guide_time)
|
||||
--统计:灯下取巧
|
||||
local detect_time = ScriptLib.GetGroupTempValue(context, "prey_win_by_detect_".._prey, {})
|
||||
ScriptLib.AddExhibitionReplaceableData(context, _prey, "prey_win_by_detect", detect_time)
|
||||
--统计:无技能胜利,要反转统计一次
|
||||
if 0 == ScriptLib.GetGroupTempValue(context, "prey_win_without_skill_".._const, {}) then
|
||||
ScriptLib.AddExhibitionReplaceableData(context, _const, "prey_win_without_skill", 1)
|
||||
end
|
||||
elseif _prey == 0 then
|
||||
--统计:默契之力
|
||||
ScriptLib.AddExhibitionReplaceableData(context, _const, "prey_dead_win", 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 【三期新增】隐身诱饵相关
|
||||
function LF_NotifyInvisibleBaits(context)
|
||||
ScriptLib.PrintContextLog(context, "## HideAndSeek_V3_LOG : LF_NotifyInvisibleBaits")
|
||||
|
||||
for i = 1, #invisible_bait_list do
|
||||
ScriptLib.SetEntityServerGlobalValueByConfigId(context, invisible_bait_list[i], "SGV_InvisibleBait_Display", 1)
|
||||
end
|
||||
end
|
||||
---------------------------------------
|
||||
Initialize_Base()
|
||||
1159
gdconf/game_data_config/lua/common/V3_3/HideAndSeek_Skill_V3.lua
Normal file
1159
gdconf/game_data_config/lua/common/V3_3/HideAndSeek_Skill_V3.lua
Normal file
File diff suppressed because it is too large
Load Diff
779
gdconf/game_data_config/lua/common/V3_3/MistTrialV3.lua
Normal file
779
gdconf/game_data_config/lua/common/V3_3/MistTrialV3.lua
Normal file
@@ -0,0 +1,779 @@
|
||||
--[[======================================
|
||||
|| filename: MistTrialV3
|
||||
|| owner: shuyi.chang
|
||||
|| description: 迷城战线三期
|
||||
|| LogName: TD_MistTrialV3
|
||||
|| Protection: [Protection]
|
||||
=======================================]]
|
||||
|
||||
--[[
|
||||
3.3迷城战线复刻
|
||||
|
||||
每个小房间内容是单独的挑战。
|
||||
此group负责管理:负责记着3个特殊挑战的进度、负责持续显示父挑战标题、挑战阶段、挂个大region用于触发断线重连后挑战接续
|
||||
|
||||
和关卡约定的challenge Index:
|
||||
父挑战 999
|
||||
点亮三颗符文 901
|
||||
启动遗迹控制台 902
|
||||
最终挑战 903
|
||||
--]]
|
||||
--[[
|
||||
local defs = {
|
||||
|
||||
--galleryID
|
||||
gallery_id = ,
|
||||
|
||||
--galley限时秒数
|
||||
--迷城战线v2的限时用Gallery控制(excel表)此处用于保证FatherChallenge的时长不要小于Gallery
|
||||
time_limit = 300,
|
||||
|
||||
--父挑战ChallengeId
|
||||
challenge_id = 228,
|
||||
|
||||
--父挑战大RegionID,这个region用于地城中断线重连接续挑战
|
||||
region_id = ,
|
||||
|
||||
--激活古代符文ChallengeId
|
||||
key_challenge = 229,
|
||||
--启动遗迹控制台ChallengeId
|
||||
worktop_challenge = 230,
|
||||
--最终挑战ChallengeId
|
||||
final_challenge = 231,
|
||||
|
||||
--激活古代符文目标数量
|
||||
key_target = 3,
|
||||
|
||||
--【三期新增】【暂时没用】电梯所在房间的两个region id,close是更大的,用于保底玩家离开之后又飞速冲回来
|
||||
elevatorRegion = 99,
|
||||
elevatorCloseRegion = 100,
|
||||
|
||||
--【三期新增】各种门的对应关系,center指和电梯房间对应的门,一定要注意左右的顺序
|
||||
keyDoor =
|
||||
{
|
||||
[1] = { center = config_id_01, left = config_id_02, right = config_id_03, }
|
||||
[2] = { center = config_id_04, left = config_id_05, right = config_id_06, }
|
||||
[3] = { center = config_id_07, left = config_id_08, right = config_id_09, }
|
||||
},
|
||||
|
||||
--【三期新增】【暂时没用】电梯所在房间的三个门,123需要跟上面keyDoor的[1][2][3]对应起来
|
||||
elevatorDoor = {config_id_01, config_id_02, config_id_03},
|
||||
}
|
||||
--]]
|
||||
|
||||
--Mist_trial的Buff_obtain日志
|
||||
local buff_gadgetId = {
|
||||
"Buff_Attack",
|
||||
"Buff_Heal"
|
||||
}
|
||||
|
||||
local extraTriggers = {
|
||||
--这个Trigger用于在地城内断线重连时接续父挑战
|
||||
{ config_id = 8000001, name = "Enter_Region", event = EventType.EVENT_ENTER_REGION, source = "", condition = "condition_Enter_FatherRegion", action = "action_Enter_FatherRegion", trigger_count = 0 },
|
||||
{ config_id = 8000002, name = "Gallery_Stop", event = EventType.EVENT_GALLERY_STOP, source = "", condition = "", action = "action_Gallery_Stop", trigger_count = 0 },
|
||||
|
||||
--用于获知玩法到哪个阶段了
|
||||
{ config_id = 8000004, name = "Key_Challenge_Success", event = EventType.EVENT_CHALLENGE_SUCCESS, source = "901", condition = "", action = "action_Key_Challenge_Success", trigger_count = 0},
|
||||
{ config_id = 8000005, name = "Worktop_Challenge_Success", event = EventType.EVENT_CHALLENGE_SUCCESS, source = "902", condition = "", action = "action_Worktop_Challenge_Success", trigger_count = 0},
|
||||
{ config_id = 8000006, name = "Final_Challenge_Success", event = EventType.EVENT_CHALLENGE_SUCCESS, source = "903", condition = "", action = "action_Final_Challenge_Success", trigger_count = 0},
|
||||
|
||||
--用于玩家开启迷城战线时,初始化标志位
|
||||
{ config_id = 8000007, name = "Gallery_Start", event = EventType.EVENT_GALLERY_START, source = "", condition = "", action = "action_Gallery_Start", trigger_count = 0 },
|
||||
|
||||
--子挑战成功时,向其所在Group发消息
|
||||
{ config_id = 8000008, name = "Sub_Challenge_Success", event = EventType.EVENT_CHALLENGE_SUCCESS, source = "", condition = "", action = "action_Sub_Challenge_Success", trigger_count = 0},
|
||||
--外部挂载子挑战用trigger---
|
||||
{ config_id = 8000009, name = "Variable_Change_MistTail", event = EventType.EVENT_VARIABLE_CHANGE, source = "catchKey", condition = "", action = "",trigger_count = 0 , tag = "666" },
|
||||
|
||||
--三期電梯房保底
|
||||
-- { config_id = 8000010, name = "Player_Enter_Room", event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_Player_Enter_Room",trigger_count = 0 },
|
||||
-- { config_id = 8000011, name = "Player_Leave_Room", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_Player_Leave_Room",trigger_count = 0 },
|
||||
|
||||
-- 【三期新增】保底把所有门初始都打开
|
||||
{ config_id = 8000012, name = "Group_Load", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_Group_Load",trigger_count = 0},
|
||||
|
||||
-- 测试用
|
||||
-- { config_id = 8000013, name = "CHALLENGE_SUCCESS", event = EventType.EVENT_CHALLENGE_SUCCESS, source = "", condition = "", action = "action_EVENT_CHALLENGE_SUCCESS", trigger_count = 0, },
|
||||
-- { config_id = 8000014, name = "CHALLENGE_FAIL", event = EventType.EVENT_CHALLENGE_FAIL, source = "", condition = "", action = "action_EVENT_CHALLENGE_FAIL", trigger_count = 0, },
|
||||
|
||||
}
|
||||
|
||||
local extraVariables = {
|
||||
--Gallery是否在进行 0-未开始 1-进行中 2-已成功(不再触发)
|
||||
{ config_id = 50000001, name = "gallery_state", value = 0, no_refresh = true},
|
||||
--父挑战状态 0-初始 1-进了地城但未开始 2-进行中(正在激活古代符文 3-进行中(启动遗迹控制台)4-进行中(最终挑战) 5-全部完成
|
||||
{ config_id = 50000002, name = "father_state", value = 0, no_refresh = true},
|
||||
--钥匙房 激活古代符文进度
|
||||
{ config_id = 50000003, name = "key_progress", value = 0, no_refresh = true},
|
||||
--子挑战用的触发器
|
||||
{ config_id = 50000004, name = "catchKey", value = 0, no_refresh = false},
|
||||
--地脉异常等级
|
||||
{ config_id = 50000005, name = "floor_level", value = 1, no_refresh = true},
|
||||
|
||||
-- 【三期新增】目前都用不到
|
||||
-- 玩家是否已經離開電梯房
|
||||
{ config_id = 50000006, name = "door_open", value = 0, no_refresh = true},
|
||||
-- 最后一次开启的room index,挑战已开启就改
|
||||
{ config_id = 50000007, name = "last_room_start", value = 0, no_refresh = true},
|
||||
-- 最后一次完成的room index,挑战成功才改
|
||||
{ config_id = 50000008, name = "last_room_finished", value = 0, no_refresh = true},
|
||||
|
||||
}
|
||||
|
||||
--和关卡约定的challenge Index
|
||||
local cfg = {
|
||||
["father_index"] = 999,
|
||||
["key_challenge_index"] = 901,
|
||||
["worktop_challenge_index"] = 902,
|
||||
["final_challenge_index"] = 903
|
||||
}
|
||||
|
||||
local doorState =
|
||||
{
|
||||
open = 201,
|
||||
close = 0,
|
||||
}
|
||||
|
||||
local abilitygroup = "ActivityAbility_MistTrial_AbilityGroup"
|
||||
|
||||
function LF_Initialize_Group(triggers, suites, variables)
|
||||
|
||||
-- insert triggers
|
||||
for i = 1, #extraTriggers do
|
||||
table.insert(triggers, extraTriggers[i])
|
||||
table.insert(suites[1].triggers,extraTriggers[i].name)
|
||||
end
|
||||
|
||||
-- insert variables
|
||||
for i = 1, #extraVariables do
|
||||
table.insert(variables, extraVariables[i])
|
||||
end
|
||||
|
||||
regions[defs.region_id].team_ability_group_list = {abilitygroup}
|
||||
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--================================================================
|
||||
-- 以下由关卡调用
|
||||
--================================================================
|
||||
|
||||
--小房间的操作台选项“开启挑战”,调这个方法-----
|
||||
--由于参数个数限制,需要先调用SetKillMonsterTarget
|
||||
--参数为 {子挑战child_index, 子挑战challengeID}
|
||||
--使用前请保证父挑战已经启动
|
||||
function StartSubChallengeKillMonster(context, prev_context, child_index, challenge_id)
|
||||
|
||||
local father_state = ScriptLib.GetGroupVariableValue(context, "father_state")
|
||||
|
||||
if father_state ~= 0 and father_state ~= 1 then
|
||||
--添加子挑战
|
||||
--挑战类型为:击杀指定数量怪物 参数1: 指定groupid, 参数2:指定group内怪物死亡的数量
|
||||
|
||||
local target_count = ScriptLib.GetGroupTempValue(context, "target_count",{})
|
||||
|
||||
--ScriptLib.SetGroupVariableValue(context, "catchKey", 0)
|
||||
|
||||
ScriptLib.AttachChildChallenge(context, cfg.father_index, child_index, challenge_id, {3, 666, target_count, 1}, {},{success=1, fail=1})
|
||||
|
||||
else
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 #WRONG# Trying to start a subchallenge while father is not actived!! ")
|
||||
end
|
||||
|
||||
-- 【三期新增】控制各种门的开启关闭,子挑战开启的时候来一次(结束的时候也来一次)
|
||||
LF_DoorController_Simple(context, true, child_index)
|
||||
|
||||
-- 【三期新增】回血的sgv在这个时候归零
|
||||
ScriptLib.SetTeamServerGlobalValue(context, context.owner_uid, "SGV_MistTrial_Revive", 0)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--参数为 {怪物所在group_id, 目标个数target_count}
|
||||
function SetKillMonsterTarget(context, prev_context, group_id, target_count)
|
||||
|
||||
ScriptLib.SetGroupTempValue(context, "target_group", group_id, {})
|
||||
ScriptLib.SetGroupTempValue(context, "target_count", target_count, {})
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Set Kill Monster Target. Group@" .. group_id.." Count@".. target_count)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
-- 为StartSubChallengeCustom所创建的自定义类型子挑战加分。
|
||||
-- 钥匙房不要用这个,用 AddMistTrialKeyProgress
|
||||
function AddMistTrialChildChallengeScore(context, prev_context, score)
|
||||
--由于单子b1295835,一旦没结束,尝试重置“catchKey”时会触发上一个意外没关掉的挑战的VariableChange
|
||||
--迷城并不关心杀怪的数量,所以在接到调用时,只需要让catchKey浮动变化就可以了,也就不需要重置。(其实不浮动变化也可,因为只要Set就会触发VariableChange这个Trigger,但还是变吧万一以后Trigger改了
|
||||
if ScriptLib.GetGroupVariableValue(context, "catchKey") > 0 then
|
||||
ScriptLib.SetGroupVariableValue(context, "catchKey", 0)
|
||||
else
|
||||
ScriptLib.SetGroupVariableValue(context, "catchKey", 1)
|
||||
end
|
||||
|
||||
local catchKey = ScriptLib.GetGroupVariableValue(context, "catchKey")
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 SAddMistTrialChildChallengeScore is called, catchKey = "..catchKey)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--终止特定子挑战
|
||||
function StopMistTrialChildChallenge(context, prev_context, childIndex, isWin)
|
||||
-- isWin = 0 (失败) 1(完成)
|
||||
ScriptLib.StopChallenge(context, childIndex, isWin)
|
||||
return 0
|
||||
end
|
||||
|
||||
--当钥匙房被完成时,调这个方法-----
|
||||
--【三期新增,param通常应该为1,challengeId为成功的挑战id】
|
||||
function AddMistTrialKeyProgress(context, prev_context, param, child_index)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Get Key Progress. add@"..param)
|
||||
local father_state = ScriptLib.GetGroupVariableValue(context, "father_state")
|
||||
--if father_state == 2 then
|
||||
ScriptLib.ChangeGroupVariableValue(context, "key_progress", param)
|
||||
local key_progress = ScriptLib.GetGroupVariableValue(context, "key_progress")
|
||||
Reminder_Key_Progress(context, key_progress)
|
||||
--else
|
||||
--ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 #WRONG# Trying to finish a key room while father challenge is @"..father_state.." (need 2)")
|
||||
--end
|
||||
|
||||
-- 【三期新增】控制各种门的开启关闭,子挑战结束的时候来一次(开启的时候也来一次)
|
||||
LF_DoorController_Simple(context, false, child_index)
|
||||
return 0
|
||||
end
|
||||
|
||||
-- 【三期应该没人在用这个了】由于复活的实现原因,不能反复Attach,如果一个地城有多个复活房,每次交互复活房操作台的时候先调用这个来移除
|
||||
function RemoveReviveAbility(context, prev_context)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Remove MistTrial Revive Ability.")
|
||||
ScriptLib.DelGalleryAbilityGroup(context, {}, defs.gallery_id, 0)
|
||||
return 0
|
||||
end
|
||||
|
||||
--LD通知Ability变动 。 参数 0-地脉异常升级 1-全队复活
|
||||
function ModifyMistTrialAbility(context, prev_context, param)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Modify MistTrial Ability. Param@"..param)
|
||||
|
||||
if param == 0 then
|
||||
--设置地脉异常等级,初始1级 升档最多3次 一共4个档
|
||||
ScriptLib.ChangeGroupTempValue(context, "Buff_Attack", 1, {})
|
||||
ScriptLib.ChangeGroupVariableValue(context, "floor_level", 1)
|
||||
|
||||
local floor_level = ScriptLib.GetGroupVariableValue(context, "floor_level")
|
||||
|
||||
if floor_level > 4 or floor_level < 1 then
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 #WRONG# Unexpected floor_level: Got@"..floor_level.." (floor_level is 1 ~ 4 in MistTrialV2)")
|
||||
|
||||
return 0
|
||||
else
|
||||
ScriptLib.SetMistTrialServerGlobalValue(context, floor_level)
|
||||
end
|
||||
|
||||
return 0
|
||||
|
||||
elseif param == 1 then
|
||||
|
||||
--复活,三期改动,复活ability一直挂在角色身上,监听sgv上复活modifier
|
||||
ScriptLib.ChangeGroupTempValue(context, "Buff_Heal", 1, {})
|
||||
ScriptLib.SetTeamServerGlobalValue(context, context.owner_uid, "SGV_MistTrial_Revive", 1)
|
||||
return 0
|
||||
|
||||
else
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 #WRONG# Unexpected ModifyMistTrialAbility param: Got@"..param.." (param is 0 or 1 in MistTrialV2)")
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--================================================================
|
||||
-- triggers
|
||||
--================================================================
|
||||
|
||||
--用于获知挑战进行到哪个阶段了.三符文完成
|
||||
function action_Key_Challenge_Success(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Get Challenge Success. @"..evt.param1)
|
||||
ScriptLib.SetGroupVariableValue(context, "father_state", 3)
|
||||
return 0
|
||||
end
|
||||
|
||||
--用于获知挑战进行到哪个阶段了.激活操作台完成
|
||||
function action_Worktop_Challenge_Success(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Get Challenge Success. @"..evt.param1)
|
||||
ScriptLib.SetGroupVariableValue(context, "father_state", 4)
|
||||
return 0
|
||||
end
|
||||
|
||||
--用于获知挑战进行到哪个阶段了.最终挑战完成
|
||||
function action_Final_Challenge_Success(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Get Challenge Success. @"..evt.param1)
|
||||
ScriptLib.SetGroupVariableValue(context, "father_state", 5)
|
||||
return 0
|
||||
end
|
||||
|
||||
--初始化标志位
|
||||
function action_Gallery_Start(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Gallery Start Detected!! GalleryId@"..evt.param1)
|
||||
ScriptLib.SetGroupVariableValue(context, "gallery_state", 1)
|
||||
ScriptLib.SetGroupVariableValue(context, "father_state", 2)
|
||||
ResetGroupTempVar(context)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--当一个小房间的杀怪挑战完成时,向那个group发一个success
|
||||
function action_Sub_Challenge_Success(context, evt)
|
||||
if CheckIsInTable(context, tonumber(evt.source_name)) == 1 then
|
||||
--特殊三挑战不发,发了也没用
|
||||
return 0
|
||||
else
|
||||
local fromGroup = ScriptLib.GetGroupTempValue(context, "target_group", {})
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 A Sub Challenge Finished. ChallengeID@"..evt.param1.." ChallengeIndex@"..evt.source_name..". Send GroupVar(succcess = 1) to Group@"..fromGroup)
|
||||
ScriptLib.SetGroupVariableValueByGroup(context, "success", 1, fromGroup)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function condition_Enter_FatherRegion(context, evt)
|
||||
if evt.param1 ~= defs.region_id then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--由大Region触发,用且仅用于接续父挑战
|
||||
function action_Enter_FatherRegion(context, evt)
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Enter father region triggered...")
|
||||
|
||||
if ScriptLib.GetGroupVariableValue(context, "father_state") == 0 then
|
||||
|
||||
ScriptLib.SetGroupVariableValue(context, "father_state", 1)
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 First Time Enter region. Set mark.")
|
||||
return 0
|
||||
end
|
||||
|
||||
local gallery_state = ScriptLib.GetGroupVariableValue(context, "gallery_state")
|
||||
|
||||
if gallery_state == 2 then
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 ...gallery is finished, will do nothing.")
|
||||
|
||||
return 0
|
||||
|
||||
elseif gallery_state == 1 then
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Gallery_state = 1 & father_state is not 0, Trying to get Challenge Progress. ")
|
||||
|
||||
if ResumeMistTrial(context) == -1 then
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 #WRONG# Unexpected Challenge Progress!!")
|
||||
|
||||
end
|
||||
return 0
|
||||
|
||||
elseif gallery_state == 0 then
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 ...gallery is not started, will do nothing.")
|
||||
|
||||
return 0
|
||||
else
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 #WRONG# Unexpected Gallery state! gallery_state@".. gallery_state)
|
||||
return 0
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_Gallery_Stop(context, evt)
|
||||
|
||||
if evt.param1 ~= defs.gallery_id then
|
||||
return -1
|
||||
end
|
||||
|
||||
UpLoadActionLog(context)
|
||||
|
||||
--evt.param3
|
||||
--1、时间到 2、客户端中断 3、LUA中断
|
||||
if evt.param3 == 1 then
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Gallery Stop Triggered. reason@ Time Up.")
|
||||
|
||||
ScriptLib.SetGroupVariableValue(context, "gallery_state", 2)
|
||||
|
||||
ScriptLib.FailMistTrialDungeonChallenge(context, cfg.father_index)
|
||||
|
||||
ScriptLib.SetGroupVariableValue(context, "father_state", 5)
|
||||
|
||||
elseif evt.param3 == 2 then
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Gallery Stop Triggered. reason@ Client.")
|
||||
|
||||
ScriptLib.SetGroupVariableValue(context, "gallery_state", 2)
|
||||
|
||||
ScriptLib.FailMistTrialDungeonChallenge(context, cfg.father_index)
|
||||
|
||||
ScriptLib.SetGroupVariableValue(context, "father_state", 5)
|
||||
|
||||
elseif evt.param3 == 3 then
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Gallery Stop Triggered. reason@ Lua.")
|
||||
ScriptLib.SetGroupVariableValue(context, "gallery_state", 2)
|
||||
ScriptLib.SetGroupVariableValue(context, "father_state", 5)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_Group_Load(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 group is loaded")
|
||||
LF_DoorController_Simple(context, false, 0)
|
||||
return 0
|
||||
end
|
||||
|
||||
-- function action_Player_Leave_Room(context, evt)
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 leave region " .. evt.param1)
|
||||
|
||||
-- if evt.param1 == defs.elevatorCloseRegion then
|
||||
-- -- 在没有完成三个钥匙房之前离开电梯房,需要关门
|
||||
-- if ScriptLib.GetGroupVariableValue(context, "father_state") < 3 then
|
||||
-- -- 最后的param一定要填-1,中间的填啥都行,反正用不上
|
||||
-- LF_DoorController(context, true, -1)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- return 0
|
||||
-- end
|
||||
|
||||
-- function action_Player_Enter_Room(context, evt)
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 enter region " .. evt.param1)
|
||||
|
||||
-- if evt.param1 == defs.elevatorRegion then
|
||||
-- -- 如果玩家不知为何离开之后又冲进来了,而且还没完成三个钥匙房,得把所有门打开
|
||||
-- if ScriptLib.GetGroupVariableValue(context, "father_state") < 3 then
|
||||
|
||||
-- for i = 1, #defs.elevatorDoor do
|
||||
-- ScriptLib.SetGadgetStateByConfigId(context, defs.elevatorDoor[i], doorState.open)
|
||||
-- end
|
||||
|
||||
-- LF_CloseAllKeyDoors(context, false)
|
||||
-- end
|
||||
-- end
|
||||
-- return 0
|
||||
-- end
|
||||
|
||||
|
||||
-- function action_EVENT_CHALLENGE_SUCCESS(context, evt)
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_CoinCollect: challenge index = "..evt.param1.." succeeds")
|
||||
|
||||
-- return 0
|
||||
-- end
|
||||
|
||||
|
||||
-- function action_EVENT_CHALLENGE_FAIL(context, evt)
|
||||
-- ScriptLib.PrintContextLog(context, "## TD_CoinCollect: challenge index = "..evt.param1.." fails")
|
||||
|
||||
-- return 0
|
||||
-- end
|
||||
|
||||
--================================================================
|
||||
-- local functions
|
||||
--================================================================
|
||||
function LF_DoorController_Simple(context, start, childIdx)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_DoorController_Simple is called, start = "..tostring(start)..", childIdx = "..childIdx)
|
||||
|
||||
local destState
|
||||
if start == true then destState = doorState.close
|
||||
elseif start == false then destState = doorState.open
|
||||
end
|
||||
|
||||
-- 校验一下childIdx必须是0-3
|
||||
if childIdx > 3 or childIdx < 0 then
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_DoorController_Simple: child index = "..childIdx.." is illegal, return immediately")
|
||||
return 0
|
||||
end
|
||||
|
||||
if childIdx == 0 then
|
||||
-- 电梯房间的门全打开
|
||||
for i = 1, #defs.elevatorDoor do
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.elevatorDoor[i], destState)
|
||||
end
|
||||
|
||||
-- 其他所有的门也全打开
|
||||
LF_OpenAllKeyDoors(context, true)
|
||||
return
|
||||
end
|
||||
|
||||
-- 钥匙房间的门
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[childIdx].center, destState)
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[childIdx].left, destState)
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[childIdx].right, destState)
|
||||
|
||||
end
|
||||
|
||||
|
||||
-- 【三期新增】【暂时用不上】控制场景中各种门的开启和关闭(都没设保底),childIdx应该为1/2/3,离开电梯的特殊情况传-1
|
||||
function LF_DoorController(context, start, childIdx)
|
||||
-- 根据挑战id找房间在defs表里的id
|
||||
local progress = ScriptLib.GetGroupVariableValue(context, "key_progress")
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_DoorController is called, start = "..tostring(start)..", childIdx = "..childIdx)
|
||||
|
||||
if childIdx == -1 then
|
||||
-- 玩家离开电梯房间,所有电梯门都关上,其他门都打开(不存档,所以先不写这个保底,初始门应该都配成0,即本来就是开着的)
|
||||
for i = 1, #defs.elevatorDoor do
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.elevatorDoor[i], doorState.close)
|
||||
end
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_DoorController: all doors in elevator room is closed")
|
||||
return 0
|
||||
end
|
||||
|
||||
if childIdx > 3 or childIdx < 1 then
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_DoorController: child index is illegal, return immediately")
|
||||
return 0
|
||||
end
|
||||
|
||||
if start == true then
|
||||
-- 玩家开启任何一个钥匙挑战,钥匙房的所有门都关上
|
||||
LF_OpenAllKeyDoors(context, false)
|
||||
|
||||
-- 门的状态设置完了再改相关挑战结束room group var
|
||||
ScriptLib.SetGroupVariableValue(context, "last_room_start", childIdx)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_DoorController: all doors in room "..childIdx.." is closed")
|
||||
|
||||
elseif start == false then
|
||||
if progress == 1 then
|
||||
-- 其他房间和这个房间相连的门打开(两对,四个门)
|
||||
for i = 1, #defs.keyDoor do
|
||||
if i ~= childIdx then
|
||||
LF_OpenDoorPairs(context, i, childIdx)
|
||||
end
|
||||
end
|
||||
|
||||
elseif progress == 2 then
|
||||
-- 玩家完成第二个钥匙挑战,这个房间左右两个门里,不和上一个房间相连的门打开(一对,两个门)
|
||||
-- 找完上一个完成房间的idx,再设置成新的
|
||||
local finalRoomIdx
|
||||
local lastRoomIdx = ScriptLib.GetGroupVariableValue(context, "last_room_finished")
|
||||
for i = 1, #defs.keyDoor do
|
||||
if i ~= childIdx and i ~= lastRoomIdx then
|
||||
-- 找还没去过的那个房间
|
||||
finalRoomIdx = i
|
||||
end
|
||||
end
|
||||
LF_OpenDoorPairs(context, finalRoomIdx, childIdx)
|
||||
|
||||
|
||||
elseif progress == 3 then
|
||||
-- 玩家完成第三个钥匙挑战,这个房间和电梯对应的门开启,电梯和它对应的门也开启
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[childIdx].center, doorState.open)
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.elevatorDoor[childIdx], doorState.open)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_DoorController: door = "..defs.keyDoor[childIdx].center..", "..defs.elevatorDoor[childIdx].." is open")
|
||||
|
||||
end
|
||||
|
||||
-- 门的状态设置完了再改相关挑战结束room group var
|
||||
ScriptLib.SetGroupVariableValue(context, "last_room_finished", childIdx)
|
||||
end
|
||||
end
|
||||
|
||||
-- 【暂时用不上】
|
||||
function LF_OpenDoorPairs(context, roomIdx_01, roomIdx_02)
|
||||
-- todo:判断下两个room idx,[1, 3]且不能重复
|
||||
-- 找这两个room idx之间的两个门的config id
|
||||
|
||||
-- 参数顺序无所谓,这里重新设一下
|
||||
local room01 = math.min(roomIdx_01, roomIdx_02)
|
||||
local room02 = math.max(roomIdx_01, roomIdx_02)
|
||||
|
||||
if room01 == 1 and room02 == 3 then
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[room01].left, doorState.open)
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[room02].right, doorState.open)
|
||||
|
||||
else
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[room01].right, doorState.open)
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[room02].left, doorState.open)
|
||||
|
||||
end
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_GetNextDoor is called, room01 = "..room01..", room02 = "..room02..", door = "..defs.keyDoor[room01].right..
|
||||
", "..defs.keyDoor[room02].left)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function LF_OpenAllKeyDoors(context, open)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_OpenAllKeyDoors is called, open = "..tostring(open))
|
||||
|
||||
local destState
|
||||
if open == true then destState = doorState.open
|
||||
elseif open == false then destState = doorState.close
|
||||
end
|
||||
|
||||
for i = 1, #defs.keyDoor do
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[i].center, destState)
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[i].left, destState)
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.keyDoor[i].right, destState)
|
||||
end
|
||||
end
|
||||
|
||||
--钥匙房进度
|
||||
function Reminder_Key_Progress(context, progress)
|
||||
|
||||
if progress == 1 then
|
||||
ScriptLib.ShowReminder(context, 43001002)
|
||||
return 0
|
||||
elseif progress == 2 then
|
||||
ScriptLib.ShowReminder(context, 43001003)
|
||||
return 0
|
||||
elseif progress == 3 then
|
||||
ScriptLib.ShowReminder(context, 43001004)
|
||||
return 0
|
||||
else
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 #WRONG# Unexpected Key Progress Change! value@"..progress)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--当需要接续挑战时,根据挑战阶段挂载对应的子挑战,如果是一阶段,还需要续上挑战进度
|
||||
function ResumeMistTrial(context, evt)
|
||||
|
||||
--父挑战状态 0-初始 1-进了地城但未开始 2-进行中(正在激活古代符文 3-进行中(启动遗迹控制台)4-进行中(最终挑战) 5-全部完成
|
||||
local father_state = ScriptLib.GetGroupVariableValue(context, "father_state")
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 ResumeMistTrial Called. father_state@".. father_state)
|
||||
--迷城战线v2的限时用Gallery控制(excel表)
|
||||
--此处用于保证接续挑战时,CreateFatherChallenge的时长不要小于Gallery
|
||||
local father_life = 1800
|
||||
|
||||
if father_state == 0 or father_state == 1 then
|
||||
|
||||
--挑战还没开始过,就触发了接续挑战
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 #WRONG# Mark has set 1 but father challenge state is 0 ! ")
|
||||
|
||||
return 0
|
||||
|
||||
elseif father_state == 2 then
|
||||
--接续钥匙房挑战 defs.key_challenge
|
||||
local saved = ScriptLib.GetGroupVariableValue(context, "key_progress")
|
||||
|
||||
--创建父挑战
|
||||
ScriptLib.CreateFatherChallenge(context, cfg.father_index, defs.challenge_id, father_life , {success=99999, fail=99999})
|
||||
|
||||
--挑战类型为:触发特定Trigger 参数1: event_type所在枚举序号; 参数2: trigger_tag;参数3: 次数;参数4:Bool,次数达成是否计为成功;参数5:初始次数值
|
||||
ScriptLib.AttachChildChallenge(context, cfg.father_index, cfg.key_challenge_index, defs.key_challenge, {3,cfg.key_challenge_index,defs.key_target,1,saved}, {}, {success=1, fail=1} )
|
||||
|
||||
local ret = LF_StartChallenge(context, cfg.father_index)
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Resuming MistTrial Starting: 激活古代符文. Saved key num@"..saved..", start challenge ret = "..ret)
|
||||
|
||||
return 0
|
||||
|
||||
elseif father_state == 3 then
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Resuming MistTrial Starting: 启动遗迹控制台.")
|
||||
|
||||
--创建父挑战
|
||||
ScriptLib.CreateFatherChallenge(context, cfg.father_index, defs.challenge_id, father_life , {success=99999, fail=99999})
|
||||
|
||||
--接续启动遗迹控制台 defs.worktop_challenge
|
||||
--挑战类型为:触发特定Trigger 参数1: event_type所在枚举序号; 参数2: trigger_tag;参数3: 次数;参数4:Bool,次数达成是否计为成功;参数5:初始次数值
|
||||
ScriptLib.AttachChildChallenge(context, cfg.father_index, cfg.worktop_challenge_index, defs.worktop_challenge, {7,cfg.worktop_challenge_index,1,1}, {}, {success=1, fail=1} )
|
||||
|
||||
LF_StartChallenge(context, cfg.father_index)
|
||||
|
||||
return 0
|
||||
|
||||
elseif father_state == 4 then
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Resuming MistTrial Starting: 最终挑战.")
|
||||
|
||||
--创建父挑战
|
||||
ScriptLib.CreateFatherChallenge(context, cfg.father_index, defs.challenge_id, father_life , {success=99999, fail=99999})
|
||||
|
||||
--接续 完成最终挑战
|
||||
ScriptLib.AttachChildChallenge(context, cfg.father_index, cfg.final_challenge_index, defs.final_challenge, {3,cfg.final_challenge_index,1,1}, {}, {success=99999, fail=1} )
|
||||
|
||||
LF_StartChallenge(context, cfg.father_index)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
elseif father_state == 5 then
|
||||
|
||||
--挑战还没开始过,就触发了接续挑战
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Trying to resume challenge but it is all clear. Do nothing.")
|
||||
|
||||
return 0
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
function ResetGroupTempVar(context)
|
||||
for k,v in pairs(buff_gadgetId) do
|
||||
ScriptLib.SetGroupTempValue(context, v,0,{})
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--上报运营日志数据埋点
|
||||
function UpLoadActionLog(context)
|
||||
|
||||
local log = {
|
||||
["Buff_Attack"] = 0,
|
||||
["Buff_Heal"] = 0
|
||||
}
|
||||
|
||||
for k, v in pairs(log) do
|
||||
log[k] = ScriptLib.GetGroupTempValue(context, k ,{})
|
||||
end
|
||||
ScriptLib.MarkGroupLuaAction(context, "Mist_trial", "", log)
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 UpLoadActionLog: "..log["Buff_Attack"].." |"..log["Buff_Heal"])
|
||||
return 0
|
||||
end
|
||||
|
||||
--用于检查value是否在目标table中
|
||||
function CheckIsInTable(context,check_value)
|
||||
--和关卡约定的challenge Index
|
||||
for k,v in pairs(cfg) do
|
||||
if v == check_value then
|
||||
--ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 Check Is SpecialChallenge. return 1")
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function LF_StartChallenge(context, challenge_index)
|
||||
-- 起challenge之前先检查一下是不是已经开了,开了就不能再起了,不然显示会被挤掉
|
||||
local success = -1
|
||||
local ret = -1
|
||||
if ScriptLib.IsChallengeStartedByChallengeIndex(context, base_info.group_id, challenge_index) == false then
|
||||
ret = ScriptLib.StartFatherChallenge(context, challenge_index)
|
||||
success = 0
|
||||
end
|
||||
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 LF_StartChallenge is called, challenge index = "..challenge_index..", succees = "..success..", challenge ret = "..ret)
|
||||
|
||||
return success
|
||||
end
|
||||
|
||||
|
||||
--================================================================
|
||||
-- ServerLuaCall
|
||||
--================================================================
|
||||
function SLC_MistTrial_TryStartChallenge(context)
|
||||
-- 在这里第一次起挑战和gallery
|
||||
ScriptLib.CreateFatherChallenge(context, cfg.father_index, 228, 1800, {success = 99999, fail = 99999, fail_on_wipe=true})
|
||||
ScriptLib.AttachChildChallenge(context, cfg.father_index, cfg.key_challenge_index, 229, {3,cfg.key_challenge_index,3,1},{},{success=0,fail=0})
|
||||
local ret1 = LF_StartChallenge(context, cfg.father_index)
|
||||
local ret2 = ScriptLib.StartGallery(context, defs.gallery_id)
|
||||
ScriptLib.PrintContextLog(context, "## TD_MistTrialV3 SLC_MistTrial_TryStartChallenge is called, challenge ret = "..ret1..", gallery ret = "..ret2)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--================================================================
|
||||
-- Initialization
|
||||
--================================================================
|
||||
LF_Initialize_Group(triggers, suites, variables)
|
||||
@@ -0,0 +1,192 @@
|
||||
|
||||
--[[======================================
|
||||
|| filename: SandwormChallenge_DodgeChallenge
|
||||
|| owner: luyao.huang
|
||||
|| description:
|
||||
|| LogName: SandwormChallenge_DodgeChallenge
|
||||
|| Protection:
|
||||
=======================================]]--
|
||||
|
||||
|
||||
|
||||
local local_defs =
|
||||
{
|
||||
challenge_index = 666,
|
||||
challenge_id = 2012004,
|
||||
live_challenge_index = 667,
|
||||
live_challenge_id = 2012003,
|
||||
dodge_challenge_index = 668,
|
||||
dodge_challenge_id = 2012002,
|
||||
challenge_option = 177,
|
||||
}
|
||||
|
||||
|
||||
|
||||
local challenge_Tri = {
|
||||
[1] = { name = "select_option_dodge_challenge", config_id = 200010001, event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_select_option_dodge_challenge", trigger_count = 0},
|
||||
[2] = { name = "group_load_dodge_challenge", config_id = 200010002, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load_dodge_challenge", trigger_count = 0},
|
||||
[3] = { name = "challenge_fail_dodge_challenge", config_id = 200010003, event = EventType.EVENT_CHALLENGE_FAIL, source = "", condition = "", action = "action_challenge_fail_dodge_challenge", trigger_count = 0},
|
||||
[4] = { name = "challenge_success_dodge_challenge", config_id = 200010004, event = EventType.EVENT_CHALLENGE_SUCCESS, source = "", condition = "", action = "action_challenge_success_dodge_challenge", trigger_count = 0},
|
||||
[6] = { name = "gadget_state_change_dodge_challenge", config_id = 200010006, event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_gadget_state_change_dodge_challenge", trigger_count = 0},
|
||||
}
|
||||
|
||||
function dodge_challenge_Initialize()
|
||||
for k,v in pairs(challenge_Tri) do
|
||||
table.insert(triggers, v)
|
||||
table.insert(suites[1].triggers, v.name)
|
||||
end
|
||||
table.insert(variables,{ config_id = 200010001, name = "is_success", value = 0})
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------
|
||||
|| ||
|
||||
|| 触发器回调 ||
|
||||
|| ||
|
||||
-----------------------------------------------------------------]]--
|
||||
function action_gadget_state_change_dodge_challenge(context,evt)
|
||||
if evt.param2 == defs.worktop_id then
|
||||
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] gadget_state_change:操作台状态变化")
|
||||
if evt.param1 == 0 then
|
||||
--恢复选项
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] gadget_state_change:操作台到0状态,恢复选项")
|
||||
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, defs.worktop_id, {local_defs.challenge_option})
|
||||
end
|
||||
if evt.param1 == 201 or evt.param1 == 202 then
|
||||
--清选项
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] gadget_state_change:操作台到非0状态,清理选项")
|
||||
ScriptLib.DelWorktopOptionByGroupId(context, base_info.group_id, defs.worktop_id, local_defs.challenge_option)
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
function action_select_option_dodge_challenge(context,evt)
|
||||
if evt.param2 == local_defs.challenge_option then
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] select_option:选择选项,开启挑战")
|
||||
--开挑战
|
||||
--ScriptLib.ActiveChallenge(context, local_defs.challenge_index, local_defs.challenge_id, defs.challenge_time, defs.max_hit_times, 0, 0)
|
||||
|
||||
local uid = ScriptLib.GetSceneOwnerUid(context)
|
||||
ScriptLib.CreateFatherChallenge(context, local_defs.challenge_index, local_defs.challenge_id, defs.challenge_time, {success = 10, fail = 5, fail_on_wipe = true})
|
||||
ScriptLib.StartFatherChallenge(context, local_defs.challenge_index)
|
||||
ScriptLib.AttachChildChallenge(context, local_defs.challenge_index, local_defs.dodge_challenge_index, local_defs.dodge_challenge_id,
|
||||
{3,1,defs.max_hit_times,0,0},{},{success=10, fail=5})
|
||||
ScriptLib.AttachChildChallenge(context, local_defs.challenge_index, local_defs.live_challenge_index, local_defs.live_challenge_id,
|
||||
{defs.challenge_time},{},{success=10, fail=5})
|
||||
|
||||
--转操作台状态
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.worktop_id, GadgetState.GearStart)
|
||||
|
||||
|
||||
--开启挑战时立刻召一次沙虫
|
||||
LF_Create_Normal_Sandworm_By_Custom_Params(context, defs.ambush_times, defs.attack_times)
|
||||
|
||||
--开启玩法杂项
|
||||
LF_Start_Play(context)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_challenge_success_dodge_challenge(context,evt)
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] challenge_success:挑战成功,挑战id为"..evt.param1)
|
||||
if evt.param1 == local_defs.live_challenge_id then
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] challenge_success:挑战成功")
|
||||
|
||||
ScriptLib.StopChallenge(context,local_defs.challenge_index,1)
|
||||
|
||||
--记一个变量,方便下次恢复
|
||||
ScriptLib.SetGroupVariableValue(context, "is_success", 1)
|
||||
|
||||
--创建宝箱
|
||||
ScriptLib.CreateGadget(context, { config_id = defs.chest_id })
|
||||
|
||||
--转操作台状态到完成
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.worktop_id, GadgetState.GearStop)
|
||||
|
||||
--清理玩法杂项
|
||||
LF_Clear_Play(context)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_challenge_fail_dodge_challenge(context,evt)
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] challenge_success:挑战失败,挑战id为"..evt.param1)
|
||||
if evt.param1 == local_defs.live_challenge_id then
|
||||
ScriptLib.StopChallenge(context,local_defs.challenge_index,1)
|
||||
|
||||
|
||||
--记一个变量,方便下次恢复
|
||||
ScriptLib.SetGroupVariableValue(context, "is_success", 1)
|
||||
|
||||
--创建宝箱
|
||||
ScriptLib.CreateGadget(context, { config_id = defs.chest_id })
|
||||
|
||||
--转操作台状态到完成
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.worktop_id, GadgetState.GearStop)
|
||||
|
||||
--清理玩法杂项
|
||||
LF_Clear_Play(context)
|
||||
end
|
||||
|
||||
|
||||
if evt.param1 == local_defs.dodge_challenge_id then
|
||||
|
||||
ScriptLib.StopChallenge(context,local_defs.challenge_index,0)
|
||||
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] challenge_fail:挑战失败")
|
||||
--转操作台状态到初始
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.worktop_id, GadgetState.Default)
|
||||
|
||||
--清理玩法杂项
|
||||
LF_Clear_Play(context)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
function action_group_load_dodge_challenge(context,evt)
|
||||
|
||||
local is_success = ScriptLib.GetGroupVariableValue(context,"is_success") == 1
|
||||
if is_success then
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] group_load:group加载,之前已成功")
|
||||
--如果之前已成功,将操作台直接转到完成状态
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.worktop_id, GadgetState.GearStop)
|
||||
else
|
||||
ScriptLib.PrintContextLog(context,"## [SandwormChallenge_DodgeChallenge] group_load:group加载,之前未成功")
|
||||
--如果之前未成功,则正常给操作台上选项
|
||||
ScriptLib.SetGadgetStateByConfigId(context, defs.worktop_id, GadgetState.Default)
|
||||
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, defs.worktop_id, {local_defs.challenge_option})
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
--[[-----------------------------------------------------------------
|
||||
|| ||
|
||||
|| 杂项方法 ||
|
||||
|| ||
|
||||
-----------------------------------------------------------------]]--
|
||||
function LF_Start_Play(context)
|
||||
|
||||
--开空气墙
|
||||
ScriptLib.CreateGadget(context, { config_id = defs.airwall_id })
|
||||
--打开沙虫计数开关
|
||||
ScriptLib.SetGroupVariableValue(context, "is_attack_count", 1)
|
||||
end
|
||||
|
||||
|
||||
function LF_Clear_Play(context)
|
||||
--清掉空气墙
|
||||
ScriptLib.KillEntityByConfigId(context, { config_id = defs.airwall_id })
|
||||
|
||||
--关掉计数
|
||||
ScriptLib.SetGroupVariableValue(context, "is_attack_count", 0)
|
||||
end
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------
|
||||
dodge_challenge_Initialize()
|
||||
89
gdconf/game_data_config/lua/common/V3_3/TestEyepointLod.lua
Normal file
89
gdconf/game_data_config/lua/common/V3_3/TestEyepointLod.lua
Normal file
@@ -0,0 +1,89 @@
|
||||
--[[======================================
|
||||
|| filename: EyePointLOD
|
||||
|| owner: shuyi.chang
|
||||
|| description: EyePoint固定LOD测试
|
||||
|| LogName: ## [TestEyepointLOD]
|
||||
|| Protection:
|
||||
=======================================]]
|
||||
--[[
|
||||
local defs = {
|
||||
target_region_config_id = 1,
|
||||
related_big_region_config_id = 2,
|
||||
}
|
||||
--]]
|
||||
|
||||
local extraTriggers =
|
||||
{
|
||||
{ config_id = 50000001, name = "ENTER_REGION", event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_EVENT_ENTER_REGION", trigger_count = 0 },
|
||||
{ config_id = 50000002, name = "LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_EVENT_LEAVE_REGION", trigger_count = 0 },
|
||||
|
||||
}
|
||||
|
||||
local extraVariables =
|
||||
{
|
||||
-- 设置LOD层级
|
||||
{ config_id = 50000101, name = "lodLevel", value = 1, no_refresh = true },
|
||||
}
|
||||
|
||||
local pos = regions[defs.related_big_region_config_id].pos
|
||||
local markGadget = { config_id = 80001, gadget_id = 70220006, pos = { x = pos.x, y = pos.y, z = pos.z }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1 }
|
||||
|
||||
|
||||
--================================================================
|
||||
-- Local Functions
|
||||
--================================================================
|
||||
function LF_Initialize_Group(triggers, suites, variables, gadgets, regions)
|
||||
|
||||
-- insert triggers
|
||||
for i = 1, #extraTriggers do
|
||||
table.insert(triggers, extraTriggers[i])
|
||||
end
|
||||
|
||||
-- add triggers to suite
|
||||
for i = 1, #extraTriggers do
|
||||
-- 都放到初始suite 1中
|
||||
table.insert(suites[1].triggers,extraTriggers[i].name)
|
||||
|
||||
end
|
||||
|
||||
-- insert variables
|
||||
for i = 1, #extraVariables do
|
||||
table.insert(variables, extraVariables[i])
|
||||
end
|
||||
|
||||
-- table.insert(gadgets, markGadget)
|
||||
-- table.insert(suites[1].gadgets, markGadget.config_id)
|
||||
end
|
||||
|
||||
--================================================================
|
||||
-- Triggers
|
||||
--================================================================
|
||||
|
||||
function action_EVENT_ENTER_REGION(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## [TestEyepointLOD] player enters region "..evt.param1)
|
||||
|
||||
if evt.param1 == defs.target_region_config_id then
|
||||
local fix_lod_level = ScriptLib.GetGroupVariableValue(context, "lodLevel")
|
||||
local temp = ScriptLib.SetPlayerEyePointLOD(context, defs.target_region_config_id, defs.related_big_region_config_id, fix_lod_level)
|
||||
ScriptLib.PrintContextLog(context, "## [TestEyepointLOD] lod level is set to "..fix_lod_level..", succeed = "..temp)
|
||||
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function action_EVENT_LEAVE_REGION(context, evt)
|
||||
ScriptLib.PrintContextLog(context, "## [TestEyepointLOD] player leaves region "..evt.param1)
|
||||
|
||||
if evt.param1 == defs.target_region_config_id then
|
||||
local temp = ScriptLib.ClearPlayerEyePoint(context, defs.target_region_config_id)
|
||||
ScriptLib.PrintContextLog(context, "## [TestEyepointLOD] player eye point is cleared, succeed = "..temp)
|
||||
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--================================================================
|
||||
-- Initialization
|
||||
--================================================================
|
||||
LF_Initialize_Group(triggers, suites, variables, gadgets, regions)
|
||||
Reference in New Issue
Block a user