添加配置表

This commit is contained in:
flswld
2022-11-30 00:00:20 +08:00
parent f70a890338
commit d7f3f3b866
33382 changed files with 8476601 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
--对“天选之人”释放“强力技”时攻击弱点瘫痪boss
function SLC_Activity_BlitzRush_Enhanced_WeakTrigger (context)
local varName = "SLC_Activity_BlitzRush_Enhanced_WeakTrigger"
local uid = context.uid
AddPlayerTempValue(context, uid, varName)
return 0
end
--通过攻击弱点瘫痪过X次怪物
function SLC_Activity_BlitzRush_WeakTrigger (context)
local varName = "SLC_Activity_BlitzRush_WeakTrigger"
local uid = context.uid
AddPlayerTempValue(context, uid, varName)
return 0
end
--对X个“天选之人”造成最后一击
function SLC_Activity_BlitzRush_Enhanced_Killed(context)
local varName = "SLC_Activity_BlitzRush_Enhanced_Killed"
local uid = context.uid
AddPlayerTempValue(context, uid, varName)
return 0
end
--未受到过任何“强力技”伤害击败boss
function SLC_Activity_BlitzRush_AttackTagTrigger(context)
local varName = "SLC_Activity_BlitzRush_AttackTagTrigger"
local uid = context.uid
AddPlayerTempValue(context, uid, varName)
return 0
end
--用3电桩冲击波造成伤害
function SLC_RoleElectricPowerSource_AttackSum(context)
local uid_list = ScriptLib.GetSceneUidList(context)
local varName = "SLC_RoleElectricPowerSource_AttackSum_S4"
ScriptLib.PrintContextLog(context, "##BiltzRush LOG : Activity_BlitzRush_Call_RoleElectricPowerSource")
for k,uid in pairs(uid_list) do
AddPlayerTempValue(context, uid, varName)
end
return 0
end
--挑战中雷暴石发动攻击
function SLC_RoleElectricBomb_AttackSum(context)
local uid_list = ScriptLib.GetSceneUidList(context)
local varName = "SLC_RoleElectricBomb_AttackSum_S4"
ScriptLib.PrintContextLog(context, "##BiltzRush LOG : Activity_BlitzRush_Call_RoleElectricBomb")
for k,uid in pairs(uid_list) do
AddPlayerTempValue(context, uid, varName)
end
return 0
end
--雷暴石的不需要处理的SLC
function SLC_RoleElectricBomb_MultiAttack(context)
return 0
end
--给玩家的tempValue+1
function AddPlayerTempValue(context, uid, varName)
local value = ScriptLib.GetGroupTempValue(context, varName..uid, {})
value = value + 1
ScriptLib.SetGroupTempValue(context, varName..uid, value, {})
ScriptLib.AddExhibitionReplaceableData(context, uid, varName, 1)
ScriptLib.PrintContextLog(context, "##BiltzRush LOG : player add "..uid..varName..value)
return 0
end

View File

@@ -0,0 +1,28 @@
local define = {
linkCount = "RoleElectricPowerSourceConnectCount", --连线时玩家被上的global_value
}
local extraTriggers={
{ config_id = 8000001, name = "EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE", event = EventType.EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE, source = "", condition = "", action = "action_EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE", trigger_count = 0 }
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables, { config_id=50000001,name = "linkedKillNum", value = 0, no_refresh = true})
end
function action_EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE(context, evt)
--检查击杀者是否带2个以上连线
if evt.param2 ~= 0 then
if ScriptLib.GetTeamAbilityFloatValue(context, evt.param2, define.linkCount) >= 2 then
--增加GlobalVar计数
ScriptLib.ChangeGroupVariableValue(context, "linkedKillNum", 1)
end
end
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,203 @@
--地脉花循环营地模板
--local defs = {
-- group_id = xxx ,
-- monster_waves = 4,
-- chest_id = xxx,
-- operator1_id = xxx,
-- operator2_id = xxx
--}
local Tri = {
[1] = { name = "any_monster_die", config_id = 8000001, event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "", action = "action_any_monster_die", trigger_count = 0 },
[2] = { name = "blossom_progress_finish", config_id = 8000002, event = EventType.EVENT_BLOSSOM_PROGRESS_FINISH, source = "", condition= "", action = "action_blossom_progress_finish", trigger_count = 0 },
[4] = { name = "group_load", config_id = 8000004, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
[5] = { name = "group_refresh", config_id = 8000005, event = EventType.EVENT_GROUP_REFRESH, source = "", condition = "", action = "action_group_refresh", trigger_count = 0 },
--[6] = { name = "chest_die", config_id = 8000006, event = EventType.EVENT_ANY_GADGET_DIE, source = "", condition = "", action = "action_any_gadget_die", trigger_count = 0 },
[7] = { name = "select_option", config_id = 8000007, event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_select_option", trigger_count = 0 },
[8] = { name = "blossom_chest_die", config_id = 8000008, event = EventType.EVENT_BLOSSOM_CHEST_DIE, source = "", condition = "", action = "action_blossom_chest_die", trigger_count = 0 },
}
function Initialize()
for k,v in pairs(Tri) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
--注入一个blossom的标志位。下次groupload时如果为1说明玩法已经开始了不再走一次init
table.insert(variables,{ config_id=50000001,name = "HasStarted", value = 0, no_refresh = true})
table.insert(variables,{ config_id=50000002,name = "wave", value = 0, no_refresh = true})
end
----------------------------------
function action_any_monster_die(context, evt)
--当怪物死的时候,增加循环营地进度
ScriptLib.AddBlossomScheduleProgressByGroupId(context, 0)
--如果还有怪物活着,无事发生
if ScriptLib.GetGroupMonsterCountByGroupId(context, 0) ~= 0 then
return -1
end
--当前波次怪物死光了,则加载下一波怪物
LF_Create_Next_Monster_Wave(context)
return 0
end
function action_group_load(context, evt)
--group加载时刷新循环营地
ScriptLib.PrintContextLog(context,"BG: Group has been loaded!")
ScriptLib.SetGroupVariableValue(context,"GroupCompletion",0)
--group load时判定一下这个group是否已经开启如果已经开启则无事发生
local has_started = ScriptLib.GetGroupVariableValue(context,"HasStarted")
if (has_started == 1) then
ScriptLib.PrintContextLog(context,"BG: Group has been started, refresh failed!")
return 0
end
ScriptLib.RefreshBlossomGroup(context, { group_id = 0, suite = 1, exclude_prev = true, is_delay_unload = true })
LF_Init_Blossom_Group(context)
return 0
end
function action_group_refresh(context, evt)
ScriptLib.PrintContextLog(context,"BG: Group has been refreshed!")
--group load时判定一下这个group是否已经开启如果已经开启则无事发生
local has_started = ScriptLib.GetGroupVariableValue(context,"HasStarted")
if (has_started == 1) then
ScriptLib.PrintContextLog(context,"BG: Group has been started, refresh failed!")
return 0
end
--group刷新时初始化整个group
LF_Init_Blossom_Group(context)
return 0
end
function action_blossom_chest_die(context,evt)
--领取完奖励后,刷新循环营地
if evt.param1 == defs.chest then
ScriptLib.PrintContextLog(context,"BG: blossom has been opened. Refreh the next blossom group")
--group重置为没有开始的状态
ScriptLib.SetGroupVariableValue(context,"HasStarted",0)
ScriptLib.SetGroupVariableValue(context,"wave",0)
ScriptLib.RefreshBlossomGroup(context, { group_id = 0, suite = 1, exclude_prev = true })
end
return 0
end
function action_select_option(context,evt)
--玩家选择选项后隐藏地脉淤积gadget清除gadget上的选项激活第一波怪物
ScriptLib.PrintContextLog(context,"BG: Option has been selected! Monster waves start!")
ScriptLib.SetGadgetStateByConfigId(context, LF_Get_Blossom_Operator(context), 201)
ScriptLib.DelWorktopOptionByGroupId(context,0,LF_Get_Blossom_Operator(context),187)
--所有东西成功刷出来了将group设置为已开始状态
ScriptLib.SetGroupVariableValue(context,"HasStarted",1)
LF_Start_Monster_Wave(context)
return 0
end
function action_blossom_progress_finish(context,evt)
--进度打满以后,创建奖励
LF_Create_Reward(context)
ScriptLib.SetGroupVariableValue(context,"GroupCompletion",1)
return 0
end
----------------------------------
function LF_Create_Reward(context)
--创建循环营地奖励方法并将循环营地进度置到reward
ScriptLib.PrintContextLog(context,"BG: Monster wave has ended, creating blossom group reward")
ScriptLib.SetBlossomScheduleStateByGroupId(context,0,3)
ScriptLib.PrintContextLog(context,"BG: Creaing blossom chest!!")
ScriptLib.CreateBlossomChestByGroupId(context,0,defs.chest)
end
function LF_Create_Next_Monster_Wave(context)
--更新下一波怪物潮的方法如果已经到了最后一波则不刷新此时理论上来说打完应该直接触发blossom group finish
local wave = ScriptLib.GetGroupVariableValue(context,"wave")
--local wave = ScriptLib.GetGroupTempValue(context, "wave", {})
local nextWave = wave + 1
if nextWave+1 > #suites then
ScriptLib.PrintContextLog(context, "BG: This is final wave ")
else
ScriptLib.PrintContextLog(context,"BG: Creating monster wave: "..nextWave)
ScriptLib.AddExtraGroupSuite(context, 0, nextWave+1)
ScriptLib.PrintContextLog(context,"BG: We are trying to load suite : "..nextWave+1)
ScriptLib.SetGroupVariableValue(context,"wave",nextWave)
--ScriptLib.SetGroupTempValue(context, "wave", nextWave, {})
end
end
function LF_Start_Monster_Wave(context)
--启动怪物潮,进入打怪阶段
ScriptLib.SetBlossomScheduleStateByGroupId(context, 0, 2)
ScriptLib.SetGroupVariableValue(context,"wave",0)
--ScriptLib.SetGroupTempValue(context, "wave", 0, {})
--加载第一波怪物
LF_Create_Next_Monster_Wave(context)
end
function LF_Init_Blossom_Group(context)
--初始化循环营地方法移除全部的怪物group并刷新地脉淤积操作台
ScriptLib.PrintContextLog(context,"BG: Blossom group is initiating")
--初始化时先移除掉所有怪物的suite
for i = 2, #suites do
ScriptLib.RemoveExtraGroupSuite(context,0,i)
end
if (LF_Get_Blossom_Operator(context) == -1) then
return -1
end
ScriptLib.PrintContextLog(context,"BG: Current operator config id is: "..LF_Get_Blossom_Operator(context))
--加载地脉淤积的gadget
local ret = ScriptLib.CreateGadget(context, {config_id = LF_Get_Blossom_Operator(context)})
ScriptLib.PrintContextLog(context,"BG: Create worktop result: "..ret)
--给地脉淤积的gadget增加操作选项
ScriptLib.SetWorktopOptionsByGroupId(context,0,LF_Get_Blossom_Operator(context),{187})
return 0
end
function LF_Get_Blossom_Operator(context)
--获取当前BlossomGroup的地脉淤积操作台的方法根据当前的刷新类型返回不同的操作台
local operator = {[1]=defs.operator_1,[2]=nil,[3]=defs.operator_2}
local refreshType = ScriptLib.GetBlossomRefreshTypeByGroupId(context, 0)
if not (refreshType == 1 or refreshType == 3) then
return -1
end
ScriptLib.PrintContextLog(context,"BG: Current blossom group refresh type: "..refreshType)
return operator[refreshType]
end
----------------------------------
Initialize()

View File

@@ -0,0 +1,275 @@
--[[
藏宝图特殊藏宝点的一笔画玩法
]]--
local matrix =
{
{defs.gadget_11,defs.gadget_12,defs.gadget_13},
{defs.gadget_21,defs.gadget_22,defs.gadget_23},
{defs.gadget_31,defs.gadget_32,defs.gadget_33}
}
local extraTriggers={
{config_id = 9000001, name = "GadgetStateChange", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_Gadget_State_Change", trigger_count = 0 },
{config_id = 9000002,name = "LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_EVENT_LEAVE_REGION", forbid_guest = false, trigger_count = 0 },
{ config_id = 9000003, name = "GADGET_CREATE", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "", action = "action_gadget_create", trigger_count = 0 },
{ config_id = 9000004, name = "group_load_DOL", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
{ config_id = 9000005, name = "general_award_taken_DOL", event = EventType.EVENT_GENERAL_REWARD_TAKEN, source = "", condition = "", action = "action_general_reward_taken", trigger_count = 0 },
}
function Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=50000001,name = "digged", value = 0, no_refresh = true})
table.insert(variables,{ config_id=50000002,name = "successed", value = 0, no_refresh = true})
table.insert(variables,{ config_id=50000003,name = "challenge_state", value = 0})
table.insert(variables,{ config_id=50000004,name = "current_stone", value = 0})
--初始化
end
function action_general_reward_taken(context,evt)
--挖掘点被挖掉的时候触发
ScriptLib.PrintContextLog(context,"DOL: Group has been digged, load the first brick!!!")
--发一个reminder
ScriptLib.ShowReminder(context, 600043)
local targetSolution
--向服务器申请获得当前group的解法列某些情况下可能没走group load做个保险
targetSolution = ScriptLib.GetBonusTreasureMapSolution(context, defs.group_ID)
ScriptLib.PrintContextLog(context,"DOL: Target Solution is: ")
for i = 1,#targetSolution do
ScriptLib.PrintContextLog(context,"DOL :"..targetSolution[i])
end
--如果因为任何原因没有拿到解法,立刻返回,不加载石板,防止后续报错
if (#targetSolution == 0) then
return 0
end
--创建起始方块
ScriptLib.CreateGadget(context, { config_id = defs.gadget_starter })
ScriptLib.SetGroupVariableValue(context,"digged",1)
return 0
end
function action_group_load(context, evt)
ScriptLib.PrintContextLog(context,"DOL: Draw One Line Group Loaded ")
local targetSolution
--向服务器申请获得当前group的解法列
targetSolution = ScriptLib.GetBonusTreasureMapSolution(context, defs.group_ID)
ScriptLib.PrintContextLog(context,"DOL: Target Solution is: ")
for i = 1,#targetSolution do
ScriptLib.PrintContextLog(context,"DOL :"..targetSolution[i])
end
--如果因为任何原因没有拿到解法,立刻返回,不加载石板,防止后续报错
if (#targetSolution == 0) then
return 0
end
--group load时如果没有胜利则强制加载第一块石板
if ScriptLib.GetGroupVariableValue(context, "successed")~=1 and ScriptLib.GetGroupVariableValue(context,"digged") == 1 then
ScriptLib.PrintContextLog(context,"DOL: Reloading from the start!! ")
--重置一下挑战状态
ScriptLib.SetGroupVariableValue(context,"challenge_state",0)
local ret = ScriptLib.CreateGadget(context, { config_id = defs.gadget_starter })
ScriptLib.PrintContextLog(context,"DOL: Building the first brick result: "..ret)
end
return 0
end
--处理失败逻辑
function FaildProcess(context,str)
--Fiald process start
ScriptLib.PrintContextLog(context,"Fiald Process Start : "..str)
ScriptLib.SetGroupVariableValue(context, "isProcessFaild", 1)
ScriptLib.PrintContextLog(context,str.." Set isPrecessFaild = 1")
for k,v in pairs(matrix) do
for ik,iv in pairs(v) do
ScriptLib.PrintContextLog(context,str.." Loop ".. iv)
local tempGadgeState = ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, iv)
ScriptLib.PrintContextLog(context,str.." tempGadgetState = ".. tempGadgeState)
if tempGadgeState ~= 903 then
if iv ~= defs.gadget_starter then
ScriptLib.SetGadgetStateByConfigId(context, iv, 102)
else
ScriptLib.SetGadgetStateByConfigId(context, iv, 201)
end
end
end
end
ScriptLib.StopChallenge(context,233,0)
--ScriptLib.SetGroupVariableValue(context, "activeCount", 0)
ScriptLib.PrintContextLog(context,"DOL: Fiald Process End : "..str)
--Fiald process End
ScriptLib.RemoveExtraGroupSuite(context, defs.group_ID, 2)
ScriptLib.SetGroupVariableValue(context, "challenge_state", 0)
ScriptLib.CreateGadget(context, { config_id = defs.gadget_starter })
end
function LuaCallFail(context)
FaildProcess(context,"踩到空方块")
return 0
end
function action_gadget_create(context, evt)
ScriptLib.PrintContextLog(context,"DOL: Changed gadget id is: "..evt.param2)
ScriptLib.PrintContextLog(context,"DOL: Changed gadget config id is: "..evt.param1)
if evt.param2==70900304 then
ScriptLib.PrintContextLog(context," DOLBuild First Brick")
--if ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, evt.param1)==0 then
local ret = ScriptLib.SetGadgetStateByConfigId(context, evt.param1, 101)
ScriptLib.PrintContextLog(context,"DOL: First brick change state result: "..ret)
--end
end
return 0
end
function action_Gadget_State_Change(context, evt)
--未开始挑战并将一个石板踩亮说明挑战开始加载剩余的所有石板、并将challenge_state设置为1挑战进行中
if ScriptLib.GetGroupVariableValue(context, "challenge_state")==0 and evt.param1==202 then
--生成第一块石板的时候,同时开启挑战
local ret = ScriptLib.StartChallenge(context,233,defs.challenge,{0,defs.challenge,1})
ScriptLib.PrintContextLog(context,"DOL: Challenge active result "..ret)
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
ScriptLib.SetGroupVariableValue(context, "challenge_state", 1)
for i=1,#matrix do
for j=1,#matrix[i] do
if matrix[i][j]==evt.param2 then
ScriptLib.SetGroupVariableValue(context, "current_stone", i*10+j)
end
end
end
return 0
end
--挑战中踩到石板
--如果是成功踩亮则检测踩到的是否和current_stone邻接
--如果是将石板踩灭,确认是否是重复踩了一块石板
if ScriptLib.GetGroupVariableValue(context, "challenge_state")==1 then
local current_stone_id = ScriptLib.GetGroupVariableValue(context, "current_stone")
--ScriptLib.PrintContextLog(context,"DOL:current stone id: "..current_stone_id)
if evt.param1==202 then
ScriptLib.PrintContextLog(context,"DOL:step on an DEFAULT stone")
CheckTwoGadgetIsAdjacent(context,ScriptLib.GetGroupVariableValue(context, "current_stone"),evt.param2)
end
if evt.param1==201 and evt.param3==202 then
CheckTwoGadgetIsAdjacent(context,ScriptLib.GetGroupVariableValue(context, "current_stone"),evt.param2)
local current_idx=ScriptLib.GetGroupVariableValue(context, "current_stone")
local config_one=matrix[math.floor(current_idx/10)][current_idx%10]
if config_one==evt.param2 then
ScriptLib.PrintContextLog(context,"DOL:step on the SAME stone")
--ScriptLib.SetGadgetStateByConfigId(context, evt.param2, 202)
else
ScriptLib.PrintContextLog(context,"DOL:step on a ACTIVITED stone")
end
end
--每次石板状态变化,都要检查一次是否成功
CheckIsSuccess(context)
return 0
end
return 0
end
function action_EVENT_LEAVE_REGION(context, evt)
if evt.param1~=defs.trigger_boarder or ScriptLib.GetGroupVariableValue(context, "successed")==1 then
return 0
end
FaildProcess(context,"出圈")
return 0
end
--检测玩法是否成功
function CheckIsSuccess(context)
--用到的时候再找服务端要,防止服务器清数据
local targetSolution = ScriptLib.GetBonusTreasureMapSolution(context, defs.group_ID)
--校验一下是否拿到数据,如果没拿到直接返回失败
if (#targetSolution == 0) then
return 0
end
local score=0
local state=nil
local isSuccess = true
for i=1,#matrix do
for j=1,#matrix[i] do
state=ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID,matrix[i][j])
--石板激活但目标解法不为1说明该次判定失败直接返回失败
ScriptLib.PrintContextLog(context,"DOL : Brick ["..i..","..j.."] is "..state-201)
ScriptLib.PrintContextLog(context,"DOL : target index is "..(i-1)*#matrix+j)
if (state-201) ~= targetSolution[(i-1)*#matrix+j] and (state-101) ~= targetSolution[(i-1)*#matrix+j] then
isSuccess = false
break
end
end
end
if (isSuccess == false) then
return 0
end
if isSuccess then
ScriptLib.PrintContextLog(context,"DOL:SUCCESS!")
for i=1,#matrix do
for j=1,#matrix[i] do
ScriptLib.SetGadgetStateByConfigId(context, matrix[i][j], 901)
end
end
ScriptLib.SetGroupVariableValue(context, "challenge_state", 2)
--ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 3)
ScriptLib.SetGroupVariableValue(context, "successed", 1)
ScriptLib.StopChallenge(context,233,1)
end
return 0
end
--检测两个方块是否是相邻方块
function CheckTwoGadgetIsAdjacent(context,current_idx,config_two)
local x=math.floor(current_idx/10)
local y=current_idx%10
if matrix[x][y]==config_two then
return 0
end
if y>1 then
if matrix[x][y-1]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", x*10+y-1)
return 0
end
end
if y< #matrix[x] then
if matrix[x][y+1]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", x*10+y+1)
return 0
end
end
if x>1 then
if matrix[x-1][y]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", (x-1)*10+y)
return 0
end
end
if x < #matrix then
if matrix[x+1][y]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", (x+1)*10+y)
return 0
end
end
FaildProcess(context,"踩错")
return 0
end
Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,26 @@
function LF_Initialize_Group(triggers, suites)
local id=8100001
for i=1,#gadgets do
if gadgets[i].gadget_id == 70900380 then
local configId=gadgets[i].config_id
local insertRegion={ config_id = id, shape = RegionShape.SPHERE, radius = 14.5, pos=gadgets[i].pos, area_id = gadgets[i].area_id,ability_group_list = { "Fly_Electric_Core_Play" } }
table.insert(regions,insertRegion)
for j=1,#suites do
for k=1,#suites[j].gadgets do
if suites[j].gadgets[k]==configId then
table.insert(suites[j].regions,id)
end
end
end
id=id+1
end
end
--初始化
end
function Electric_Core_Explain(context)
ScriptLib.MarkPlayerAction(context, 7002, 3, 1)
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,26 @@
function LF_Initialize_Group(triggers, suites)
local id=8100001
for i=1,#gadgets do
if gadgets[i].gadget_id == 70290154 then
local configId=gadgets[i].config_id
local insertRegion={ config_id = id, shape = RegionShape.SPHERE, radius = 8.0, pos=gadgets[i].pos, area_id = gadgets[i].area_id,ability_group_list = { "Fly_Electric_Core_Play_Challenge" } }
table.insert(regions,insertRegion)
for j=1,#suites do
for k=1,#suites[j].gadgets do
if suites[j].gadgets[k]==configId then
table.insert(suites[j].regions,id)
end
end
end
id=id+1
end
end
--初始化
end
function Electric_Core_Explain(context)
ScriptLib.MarkPlayerAction(context, 7002, 3, 1)
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,148 @@
--自定义函数部分
local extrTriggers = {
initialtrigger = {
["Gadget_State_Change"] = { config_id = 8000001, name = "Gadget_State_Change", event= EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "gadget_state_change", trigger_count = 0 },
["Random_Floor"] = { config_id = 8000002, name = "Random_Floor", event= EventType.EVENT_TIME_AXIS_PASS, source = "triggerElementFloor", condition = "", action = "action_timeaxis_randomfloor", trigger_count = 0 },
["Challenge_Fail"] = { config_id = 8000003, name = "Challenge_Fail", event= EventType.EVENT_CHALLENGE_FAIL, source = "", condition = "", action = "action_challenge_fail", trigger_count = 0 },
["ALL_PLAYER_DIE"] = { config_id = 8000004, name = "ALL_PLAYER_DIE", event= EventType.EVENT_DUNGEON_ALL_AVATAR_DIE, source = "", condition = "", action = "action_all_avatar_die", trigger_count = 0 },
["Challenge_Success"] = { config_id = 8000005, name = "Challenge_Success", event= EventType.EVENT_CHALLENGE_SUCCESS, source = "", condition = "", action = "action_challenge_success", trigger_count = 0 },
}
}
function DeduplicationRandom( context, configIDList, randomNum )
math.randomseed(ScriptLib.GetServerTime(context))
local TempList = {}
local ReturnList = {}
for i,v in ipairs(configIDList) do
table.insert(TempList, v)
end
for i=1,randomNum do
local TempNum = math.random(#TempList)
table.insert(ReturnList, TempList[TempNum] )
table.remove(TempList, TempNum)
end
return ReturnList
end
function gadget_state_change( context, evt )
-- 监听玩法开始
if evt.param2 ~= EnterConfigID then
return 0
end
if evt.param1 == 202 then
ScriptLib.PrintContextLog(context, "##EF LOG : Start Play")
ScriptLib.InitTimeAxis(context, "triggerElementFloor", elemenFloorTimer, true)
local CurList = DeduplicationRandom(context, floorList, 2)
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, CurList[1], 201)
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, CurList[2], 202)
end
return 0
end
function action_timeaxis_randomfloor( context, evt )
ScriptLib.PrintContextLog(context, "##EF LOG : Random Floor")
-- 每次随机一套地板
for i,v in ipairs(floorList) do
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 0)
end
local CurList = DeduplicationRandom(context, floorList, 2)
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, CurList[1], 201)
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, CurList[2], 202)
return 0
end
function action_challenge_fail( context,evt )
ScriptLib.PrintContextLog(context, "##EF LOG : End Play")
ScriptLib.EndTimeAxis(context, "triggerElementFloor")
for i,v in ipairs(floorList) do
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 0)
end
return 0
end
function action_challenge_success( context,evt )
ScriptLib.PrintContextLog(context, "##EF LOG : End Play")
ScriptLib.EndTimeAxis(context, "triggerElementFloor")
for i,v in ipairs(floorList) do
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 0)
end
return 0
end
function action_all_avatar_die( context,evt )
-- 所有角色死亡
local UidList = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(UidList) do
if ScriptLib.IsPlayerAllAvatarDie(context, v) == false then
return 0
end
end
ScriptLib.PrintContextLog(context, "##EF LOG : End Play")
ScriptLib.EndTimeAxis(context, "triggerElementFloor")
for i,v in ipairs(floorList) do
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 0)
end
return 0
end
function LF_Initialize_Group()
for k,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
return 0
end
LF_Initialize_Group()

View File

@@ -0,0 +1,17 @@
--雷暴石单次命中3个怪
function SLC_RoleElectricBomb_MultiAttack(context)
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
ScriptLib.AddExhibitionAccumulableData(context, v, "SLC_RoleElectricBomb_MultiAttack", 1)
end
return 0
end
--挑战中雷暴石发动攻击
function SLC_RoleElectricBomb_AttackSum(context)
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
ScriptLib.AddExhibitionAccumulableData(context, v, "SLC_RoleElectricBomb_AttackSum", 1)
end
return 0
end

View File

@@ -0,0 +1,33 @@
local tri = {
{ name = "any_monster_die", config_id = 8000100, event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "", action = "action_any_monster_die", trigger_count = 0 }
}
function Init()
table.insert(triggers, tri[1])
for i,v in ipairs(suites) do
table.insert(v.triggers, tri[1].name)
end
end
--连接双电桩时击杀怪物
function action_any_monster_die(context, evt)
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
if 2 <= ScriptLib.GetTeamAbilityFloatValue(context, v, "RoleElectricPowerSourceConnectCount") then
ScriptLib.AddExhibitionAccumulableData(context, v, "SLC_RoleElectricPowerSource_MultiConnect", 1)
end
end
return 0
end
--用3电桩冲击波造成伤害
function SLC_RoleElectricPowerSource_AttackSum(context)
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
ScriptLib.AddExhibitionAccumulableData(context, v, "SLC_RoleElectricPowerSource_AttackSum", 1)
end
return 0
end
Init()

View File

@@ -0,0 +1,141 @@
--[[
local vision_def = {
{ vision_id = 11, enter = 100, leave = 101 },
{ vision_id = 22, enter = 102, leave = 103 },
}
local vision_mutex = {
{11,12}
}
--]]
local Tri = {
{ name = "enter_region", config_id = 8000001, event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_enter_region", trigger_count = 0, forbid_guest = false },
{ name = "leave_region", config_id = 8000002, event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_leave_region", trigger_count = 0, forbid_guest = false },
{ name = "variable_change", config_id = 8000003, event = EventType.EVENT_VARIABLE_CHANGE, source = "", condition = "", action = "action_variable_change", trigger_count = 0 }
}
function Initialize()
for i,v in ipairs(Tri) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
--如果服务器上不好修的话要考虑自己维护一个次数的tempValueTable
end
-----------------------------------------------------
function action_enter_region(context, evt)
local opt = ScriptLib.GetGroupTempValue(context, "optimize_"..context.uid, {})
if opt ~= 1 then
ScriptLib.SetGroupTempValue(context, "optimize_"..context.uid, 10, {})
for k,v in pairs(vision_def) do
if evt.param1 == v.enter then
local result = 1
--用于处理高炉内外视野互斥的问题
for p,q in ipairs(vision_mutex) do
for m,n in ipairs(q) do
if q[1] == v.vision_id then
ScriptLib.PrintContextLog(context, "## opt_log1: add vision "..q[1])
ScriptLib.AddPlayerGroupVisionType(context, {context.uid}, {q[1]})
ScriptLib.DelPlayerGroupVisionType(context, {context.uid}, {q[2]})
result = 0
end
if q[2] == v.vision_id then
local eid = ScriptLib.GetAvatarEntityIdByUid(context, context.uid)
local pos = ScriptLib.GetPosByEntityId(context, eid)
for each,vision in pairs(vision_def) do
if vision.vision_id == q[1] then
if LF_Check_Avatar_In_Region(context, pos, regions[vision.enter]) == false then
ScriptLib.PrintContextLog(context, "## opt_log2: add vision "..q[2])
ScriptLib.AddPlayerGroupVisionType(context, {context.uid}, {q[2]})
else
ScriptLib.PrintContextLog(context, "## opt_log2: del vision "..q[2])
ScriptLib.DelPlayerGroupVisionType(context, {context.uid}, {q[2]})
end
result = 0
end
end
end
end
end
if result == 1 then
ScriptLib.PrintContextLog(context, "## opt_log: add vision "..v.vision_id)
ScriptLib.AddPlayerGroupVisionType(context, {context.uid}, {v.vision_id})
end
break
end
end
end
return 0
end
function action_leave_region(context, evt)
local opt = ScriptLib.GetGroupTempValue(context, "optimize_"..context.uid, {})
if opt ~= 1 then
ScriptLib.SetGroupTempValue(context, "optimize_"..context.uid, 10, {})
LF_ReCalculate_VisionType(context, context.uid)
end
return 0
end
function action_variable_change(context, evt)
if evt.param1 == 0 then
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
if "optimize_"..v == evt.source_name then
LF_ReCalculate_VisionType(context, v)
end
end
end
return 0
end
function LF_ReCalculate_VisionType(context, uid)
local eid = ScriptLib.GetAvatarEntityIdByUid(context, uid)
local pos = ScriptLib.GetPosByEntityId(context, eid)
local vision = {1}
for k,v in pairs(vision_def) do
if LF_Check_Avatar_In_Region(context, pos, regions[v.leave]) == true then
table.insert(vision, v.vision_id)
end
end
--重算一次vision互斥以每个互斥二元组中第一个查到的为准
for i,v in ipairs(vision) do
for m,n in ipairs(vision_mutex) do
if n[1] == v then
for p,q in ipairs(vision) do
if q == n[2] then
table.remove(vision, p)
end
end
end
end
end
ScriptLib.SetPlayerGroupVisionType(context, {uid}, vision)
end
function LF_Check_Avatar_In_Region(context, pos, region)
if region.shape == RegionShape.SPHERE then
local X = pos.x - region.pos.x
local Y = pos.y - region.pos.y
local Z = pos.z - region.pos.z
if math.sqrt(X*X+Y*Y+Z*Z) > region.radius then
return false
else
ScriptLib.PrintContextLog(context, "## opt_log: in region "..region.config_id)
return true
end
elseif region.shape == RegionShape.CUBIC then
if math.abs(pos.x-region.pos.x) > region.size.x/2 then
return false
elseif math.abs(pos.y-region.pos.y) > region.size.y/2 then
return false
elseif math.abs(pos.z-region.pos.z) > region.size.z/2 then
return false
end
ScriptLib.PrintContextLog(context, "## opt_log: in region "..region.config_id)
return true
end
return false
end
---------------------------------
Initialize()

View File

@@ -0,0 +1,85 @@
--魔晶矿循环营地模板
local Tri1 = {
[1] = { name = "group_load", config_id = 8000001, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
}
local Tri2 = {
[1] = { name = "group_refresh", config_id = 8000002, event = EventType.EVENT_GROUP_REFRESH, source = "", condition = "", action = "action_group_refresh", trigger_count = 0 },
[2] = { name = "any_gadget_die", config_id = 8000003, event = EventType.EVENT_ANY_GADGET_DIE, source = "", condition = "", action = "action_any_gadget_die", trigger_count = 0 },
[3] = { name = "blossom_progress_finish", config_id = 8000004, event = EventType.EVENT_BLOSSOM_PROGRESS_FINISH, source = "", condition= "", action = "action_blossom_progress_finish", trigger_count = 0 },
}
function Initialize()
for k,v in pairs(Tri1) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
for k,v in pairs(Tri2) do
table.insert(triggers, v)
table.insert(suites[2].triggers, v.name)
end
--注入一个blossom的标志位。下次groupload时如果为1说明
table.insert(variables,{ config_id=50000001,name = "HasStarted", value = 0, no_refresh = true})
end
----------------------------------
--group加载时直接把suite2的trigger刷出来
function action_group_load(context, evt)
ScriptLib.PrintContextLog(context,"OreBG: Group has been loaded!")
ScriptLib.SetGroupVariableValue(context,"GroupCompletion",0)
--group load时判定一下这个group是否已经开启如果已经开启则无事发生
local has_started = ScriptLib.GetGroupVariableValue(context,"HasStarted")
if (has_started == 1) then
ScriptLib.PrintContextLog(context,"BG: Group has been started, refresh failed!")
return 0
end
ScriptLib.RefreshBlossomGroup(context, { group_id = 0, suite = 2, exclude_prev = true, is_delay_unload = true })
return 0
end
--group刷新时加载suite3的魔晶矿并重置blossom group计数
function action_group_refresh(context, evt)
ScriptLib.PrintContextLog(context,"OreBG: Group has been refreshed!")
--将循环营地进度置为2循环营地进行中
ScriptLib.SetBlossomScheduleStateByGroupId(context,0,2)
--加载suite3的魔晶矿
ScriptLib.AddExtraGroupSuite(context,0,3)
--group重置为没有开始的状态
ScriptLib.SetGroupVariableValue(context,"HasStarted",1)
return 0
end
--魔晶矿被挖掉的时候,增加循环营地进度
function action_any_gadget_die(context,evt)
ScriptLib.PrintContextLog(context,"OreBG: Player get 1 ore!")
ScriptLib.AddBlossomScheduleProgressByGroupId(context, 0)
return 0
end
--循环营地打满后刷新循环营地状态并将GroupCompletion置为1
function action_blossom_progress_finish(context,evt)
ScriptLib.PrintContextLog(context,"OreBG: This ore blossom group has been finished!")
--将循环营地进度置为3循环营地完成
ScriptLib.SetBlossomScheduleStateByGroupId(context,0,3)
ScriptLib.SetGroupVariableValue(context,"GroupCompletion",1)
--group重置为没有开始的状态
ScriptLib.SetGroupVariableValue(context,"HasStarted",0)
return 0
end
----------------------------------
Initialize()

View File

@@ -0,0 +1,18 @@
function LF_Initialize_Group(triggers, suites)
table.insert(variables,{ config_id=50000001,name = "takedConfigID", value = 0, no_refresh = true})
table.insert(variables,{ config_id=50000002,name = "takeCount", value = 0})
--初始化
end
function PhotoTakenSuccessfully(context)
local entityID=0
ScriptLib.ChangeGroupVariableValue(context, "takeCount", 1)
for i=1,#gadgets do
entityID=ScriptLib.GetEntityIdByConfigId(context, gadgets[i].config_id)
if entityID==context.target_entity_id or entityID==context.source_entity_id then
ScriptLib.SetGroupVariableValue(context, "takedConfigID", gadgets[i].config_id)
end
end
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,319 @@
--[[
雷共鸣石黑河玩法
ServerUploadTool Save to [/root/env/data/lua/common/V2_0]
]]--
local RaioPillars={181006,181007,181008,181009,181010}
local extraTriggers={
{ config_id = 8000001, name = "GROUP_LOAD", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
{ config_id = 8000002, name = "SELECT_OPTION", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_select_option", trigger_count = 0 },
{ config_id = 8000003, name = "VARIBLE_CHANGE", event = EventType.EVENT_VARIABLE_CHANGE, source = "step", condition = "", action = "action_step_change", trigger_count = 0 },
{ config_id = 8000004, name = "MONSTRE_DIE", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "", action = "action_monster_die", trigger_count = 0 },
{ config_id = 8000005, name = "GADGET_STATE_CHANGE", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_gadget_state_change", trigger_count = 0 },
{ config_id = 8000006, name = "AXIS_SUCCESS", event = EventType.EVENT_TIME_AXIS_PASS, source = "checkSuccess", condition = "", action = "action_axis_success", trigger_count = 0 },
{ config_id = 8000007, name = "AXIS_FAIL", event = EventType.EVENT_TIME_AXIS_PASS, source = "checkFail", condition = "", action = "action_axis_fail", trigger_count = 0 },
{ config_id = 8000008, name = "GROUP_REFRESH", event = EventType.EVENT_GROUP_REFRESH, source = "", condition = "", action = "action_group_refresh", trigger_count = 0 },
{ config_id = 8000009,name = "group_will_unload", event = EventType.EVENT_GROUP_WILL_UNLOAD, source = "", condition = "", action = "action_group_will_unload", trigger_count = 0 },
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[2].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=50000001,name = "step", value = 0, no_refresh = false})
table.insert(variables,{ config_id=50000002,name = "killMonster", value = 0, no_refresh = false})
table.insert(variables,{ config_id=50000003,name = "RaioCotterDoLaserSkill", value = 0, no_refresh = false})
--初始化
end
function DeleteLaserSkill(context)
ScriptLib.KillEntityByConfigId(context, { config_id = 181027 })
return 0
end
function RaioCotterDoLaserSkill(context)
local RaioCotterDoLaserSkill = ScriptLib.GetGroupVariableValue(context, "RaioCotterDoLaserSkill")
RaioCotterDoLaserSkill=RaioCotterDoLaserSkill+1
ScriptLib.SetGroupVariableValue(context, "RaioCotterDoLaserSkill", RaioCotterDoLaserSkill)
ScriptLib.CreateGadget(context, { config_id = 181027 })
ScriptLib.SetGadgetStateByConfigId(context, 181001, 901)
return 0
end
--把所有雷桩的状态重置
function ResetAllGadgets(context)
ScriptLib.SetGadgetStateByConfigId(context, 181006, GadgetState.Default)
ScriptLib.SetGadgetStateByConfigId(context, 181007, GadgetState.Default)
ScriptLib.SetGadgetStateByConfigId(context, 181008, GadgetState.Default)
ScriptLib.SetGadgetStateByConfigId(context, 181009, GadgetState.Default)
ScriptLib.SetGadgetStateByConfigId(context, 181010, GadgetState.Default)
return 0
end
function SetAllOptions(context)
ScriptLib.SetGadgetStateByConfigId(context, 181006, 201)
ScriptLib.SetWorktopOptionsByGroupId(context, 133220181, 181006, {80})
ScriptLib.SetWorktopOptionsByGroupId(context, 133220181, 181007, {79})
ScriptLib.SetWorktopOptionsByGroupId(context, 133220181, 181008, {79})
ScriptLib.SetWorktopOptionsByGroupId(context, 133220181, 181009, {79})
ScriptLib.SetWorktopOptionsByGroupId(context, 133220181, 181010, {79})
return 0
end
function RemoveAllOptions(context)
ScriptLib.DelWorktopOptionByGroupId(context, 133220181, 181006, 80)
ScriptLib.DelWorktopOptionByGroupId(context, 133220181, 181007, 79)
ScriptLib.DelWorktopOptionByGroupId(context, 133220181, 181008, 79)
ScriptLib.DelWorktopOptionByGroupId(context, 133220181, 181009, 79)
ScriptLib.DelWorktopOptionByGroupId(context, 133220181, 181010, 79)
return 0
end
function CheckConnectPhaseOne(context)
if 203 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181007) then
return false
end
if 204 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181008) then
return false
end
if 902 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181009) then
return false
end
if 901 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181010) then
return false
end
return true
end
function CheckConnectPhaseTwo(context)
if 901 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181007) then
return false
end
if 902 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181008) then
return false
end
if 204 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181009) then
return false
end
if 203 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181010) then
return false
end
return true
end
function CheckConnectPhaseThree(context)
if 203 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181007) then
return false
end
if 204 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181008) then
return false
end
if 204 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181009) then
return false
end
if 203 ~= ScriptLib.GetGadgetStateByConfigId(context, 133220181, 181010) then
return false
end
return true
end
--triggers
function action_group_will_unload(context, evt)
ScriptLib.RemoveEntityByConfigId(context, 133220181, EntityType.MONSTER, 181011)
ScriptLib.RemoveEntityByConfigId(context, 133220181, EntityType.MONSTER, 181088)
ScriptLib.RemoveEntityByConfigId(context, 133220181, EntityType.MONSTER, 181058)
ScriptLib.RemoveEntityByConfigId(context, 133220181, EntityType.MONSTER, 181003)
return 0
end
function action_gadget_state_change(context, evt)
if evt.param2==181001 and evt.param1==0 then
local step=ScriptLib.GetGroupVariableValue(context, "step")
if step == 3 then
ScriptLib.ShowReminder(context, 7210504)
ScriptLib.CreateMonster(context, { config_id = 181088, delay_time = 5 })
end
if step==5 then
ScriptLib.ShowReminder(context, 7210505)
ScriptLib.CreateMonster(context, { config_id = 181058, delay_time = 5 })
ScriptLib.CreateMonster(context, { config_id = 181003, delay_time = 5 })
end
end
return 0
end
--处理对应的阶段创建出对应的解图案
function action_step_change(context, evt)
if evt.param1==2 then
ScriptLib.AddExtraGroupSuite(context, 133220181, 8)
end
if evt.param1==4 then
ScriptLib.AddExtraGroupSuite(context, 133220181, 9)
end
if evt.param1==6 then
ScriptLib.AddExtraGroupSuite(context, 133220181, 10)
end
return 0
end
function action_monster_die(context, evt)
--[[
if 0==ScriptLib.GetGroupMonsterCount(context) then
--根据死的是哪个怪物来推进玩法进度
if evt.param1==181011 then
ScriptLib.SetGroupVariableValue(context, "step",2)
end
if evt.param1==181088 then
ScriptLib.SetGroupVariableValue(context, "step", 4)
end
if (evt.param1==181058) or (evt.param1==181003) then
ScriptLib.SetGroupVariableValue(context, "step", 6)
end
--打开所有雷桩的按钮
SetAllOptions(context)
else
ScriptLib.PrintContextLog(context, "剩余怪物"..ScriptLib.GetGroupMonsterCount(context))
end
]]--
if evt.param1==181011 then
ScriptLib.SetGroupVariableValue(context, "step",2)
SetAllOptions(context)
end
if evt.param1==181088 then
ScriptLib.SetGroupVariableValue(context, "step", 4)
SetAllOptions(context)
end
if (evt.param1==181058) or (evt.param1==181003) then
if ScriptLib.GetGroupVariableValue(context, "killMonster")==1 then
ScriptLib.SetGroupVariableValue(context, "step", 6)
SetAllOptions(context)
else
ScriptLib.SetGroupVariableValue(context, "killMonster", 1)
end
end
return 0
end
--刷到suite2时初始化关卡
function action_group_refresh(context, evt)
if evt.param1==2 then
ScriptLib.SetGroupVariableValue(context, "step", 1)
ScriptLib.CreateMonster(context, { config_id = 181011, delay_time = 0 })
ScriptLib.SetGroupVariableValue(context, "killMonster", 0)
end
return 0
end
function action_group_load(context, evt)
ScriptLib.SetGroupVariableValue(context, "step", 1)
ScriptLib.CreateMonster(context, { config_id = 181011, delay_time = 0 })
ScriptLib.SetGroupVariableValue(context, "killMonster", 0)
return 0
end
--判定成功
function action_axis_success(context, evt)
ScriptLib.SetGadgetStateByConfigId(context, 181001, GadgetState.GearStart)
ResetAllGadgets(context)
local step=ScriptLib.GetGroupVariableValue(context, "step")
if step == 2 then
ScriptLib.KillExtraGroupSuite(context, 133220181, 8)
ScriptLib.SetGroupVariableValue(context, "step",3)
ScriptLib.ShowReminder(context, 7210503)
end
if step==4 then
ScriptLib.KillExtraGroupSuite(context, 133220181, 9)
ScriptLib.SetGroupVariableValue(context, "step",5)
end
if step==6 then
ScriptLib.KillExtraGroupSuite(context, 133220181, 10)
ScriptLib.SetGroupVariableValue(context, "step",7)
end
return 0
end
--判定失败
function action_axis_fail(context, evt)
--归还按钮
SetAllOptions(context)
ResetAllGadgets(context)
return 0
end
function action_select_option(context, evt)
if evt.param2==79 then
local _gadgetStateList = {203,204,901,902}
local _key = 0
for k,v in pairs(_gadgetStateList) do
if v == ScriptLib.GetGadgetStateByConfigId(context, 133220181, evt.param1) then
_key = k
break
end
end
if 0 == _key then
ScriptLib.SetGroupGadgetStateByConfigId(context, 133220181, evt.param1, _gadgetStateList[1])
return 0
end
_key = _key + 1
_key = _key%#_gadgetStateList
if 0 == _key then
_key = #_gadgetStateList
end
if 0 ~= ScriptLib.SetGroupGadgetStateByConfigId(context, 133220181, evt.param1, _gadgetStateList[_key]) then
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_IndexStep")
return -1
end
end
if evt.param2==80 then
ScriptLib.SetGadgetStateByConfigId(context, 181006, GadgetState.GearStop)
RemoveAllOptions(context)
local step=ScriptLib.GetGroupVariableValue(context, "step")
if step == 2 then
if CheckConnectPhaseOne(context)==true then
ScriptLib.InitTimeAxis(context, "checkSuccess", {3}, false)
else
ScriptLib.InitTimeAxis(context, "checkFail", {3}, false)
end
end
if step==4 then
if CheckConnectPhaseTwo(context)==true then
ScriptLib.InitTimeAxis(context, "checkSuccess", {3}, false)
else
ScriptLib.InitTimeAxis(context, "checkFail", {3}, false)
end
end
if step==6 then
if CheckConnectPhaseThree(context)==true then
ScriptLib.InitTimeAxis(context, "checkSuccess", {3}, false)
else
ScriptLib.InitTimeAxis(context, "checkFail", {3}, false)
end
end
end
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,49 @@
--[[
使用region进行性能优化
]]--
local extraTriggers={
{config_id = 9000001, name = "ENTER_REGION", event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_EVENT_ENTER_REGION", forbid_guest = false,trigger_count = 0 },
{config_id = 9000002,name = "LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_EVENT_LEAVE_REGION", forbid_guest = false, trigger_count = 0 },
}
function Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[1].triggers,extraTriggers[i].name)
end
--初始化
end
function action_EVENT_ENTER_REGION(context, evt)
if evt.param1~=defs.inner_region then
return 0
end
--设置视野锚点
ScriptLib.SetPlayerEyePoint(context, defs.inner_region, defs.related_region)
ScriptLib.SetLimitOptimization(context, context.uid, true)
--环境小动物优化
ScriptLib.SwitchSceneEnvAnimal(context, 0)
--设置visiontype
ScriptLib.SetPlayerGroupVisionType(context, {context.uid}, {0})
--禁用visiontype变化
ScriptLib.SetGroupTempValue(context, "optimize_"..context.uid, 1, { group_id = 133213025})
return 0
end
function action_EVENT_LEAVE_REGION(context, evt)
if evt.param1~=defs.outer_region then
return 0
end
--关闭视野锚点
ScriptLib.ClearPlayerEyePoint(context, defs.inner_region)
ScriptLib.SetLimitOptimization(context, context.uid, false)
--环境小动物优化
ScriptLib.SwitchSceneEnvAnimal(context, 2)
--重置visiontype
ScriptLib.SetGroupTempValue(context, "optimize_"..context.uid, 0, { group_id = 133213025})
return 0
end
Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,77 @@
--[[
使用region进行性能优化
]]--
local whiteList={
133220037,
133210237,
}
local extraTriggers={
{config_id = 9000001, name = "ENTER_REGION", event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_EVENT_ENTER_REGION", forbid_guest = false,trigger_count = 0 },
{config_id = 9000002,name = "LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_EVENT_LEAVE_REGION", forbid_guest = false, trigger_count = 0 },
}
function Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
--初始化
end
function action_EVENT_ENTER_REGION(context, evt)
if evt.param1~=defs.inner_region then
return 0
end
--设置视野锚点
local isInWhiteList=0
local curGroup=ScriptLib.GetContextGroupId(context)
for i=1,#whiteList do
if whiteList[i]==curGroup then
isInWhiteList=isInWhiteList+1
end
end
if isInWhiteList>=1 then
ScriptLib.SetPlayerEyePointStream(context, defs.inner_region, defs.related_region, false)
else
ScriptLib.SetPlayerEyePointStream(context, defs.inner_region, defs.related_region, true)
end
ScriptLib.SetLimitOptimization(context, context.uid, true)
--环境小动物优化
ScriptLib.SwitchSceneEnvAnimal(context, 0)
if defs.bossRegionSpecialOptimization==nil then
--设置visiontype
ScriptLib.SetPlayerGroupVisionType(context, {context.uid}, {0})
else
ScriptLib.SetPlayerGroupVisionType(context, {context.uid}, {30010001})
ScriptLib.ForbidPlayerRegionVision(context, context.uid)
end
--禁用visiontype变化
ScriptLib.SetGroupTempValue(context, "optimize_"..context.uid, 1, { group_id = 133213025})
return 0
end
function action_EVENT_LEAVE_REGION(context, evt)
if evt.param1~=defs.outer_region then
return 0
end
--关闭视野锚点
ScriptLib.ClearPlayerEyePoint(context, defs.inner_region)
ScriptLib.SetLimitOptimization(context, context.uid, false)
--环境小动物优化
ScriptLib.SwitchSceneEnvAnimal(context, 2)
--重置visiontype
ScriptLib.SetPlayerGroupVisionType(context, {context.uid}, {1})
if defs.bossRegionSpecialOptimization~=nil then
ScriptLib.RevertPlayerRegionVision(context, context.uid)
end
--重置visiontype
ScriptLib.SetGroupTempValue(context, "optimize_"..context.uid, 0, { group_id = 133213025})
return 0
end
Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,77 @@
--[[
使用region进行性能优化
]]--
local whiteList={
133220037,
133210237,
}
local extraTriggers={
{config_id = 9000001, name = "ENTER_REGION", event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_EVENT_ENTER_REGION", forbid_guest = false,trigger_count = 0 },
{config_id = 9000002,name = "LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_EVENT_LEAVE_REGION", forbid_guest = false, trigger_count = 0 },
}
function Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
--初始化
end
function action_EVENT_ENTER_REGION(context, evt)
if evt.param1~=defs.inner_region then
return 0
end
--设置视野锚点
local isInWhiteList=0
local curGroup=ScriptLib.GetContextGroupId(context)
for i=1,#whiteList do
if whiteList[i]==curGroup then
isInWhiteList=isInWhiteList+1
end
end
if isInWhiteList>=1 then
ScriptLib.SetPlayerEyePointStream(context, defs.inner_region, defs.related_region, false)
else
ScriptLib.SetPlayerEyePointStream(context, defs.inner_region, defs.related_region, true)
end
ScriptLib.SetLimitOptimization(context, context.uid, true)
--环境小动物优化
ScriptLib.SwitchSceneEnvAnimal(context, 0)
if defs.bossRegionSpecialOptimization==nil then
--设置visiontype
ScriptLib.SetPlayerGroupVisionType(context, {context.uid}, {0})
else
ScriptLib.SetPlayerGroupVisionType(context, {context.uid}, {30010001})
ScriptLib.ForbidPlayerRegionVision(context, context.uid)
end
--禁用LD配置的visiontype变化
ScriptLib.ForbidPlayerRegionVision(context, context.uid)
return 0
end
function action_EVENT_LEAVE_REGION(context, evt)
if evt.param1~=defs.outer_region then
return 0
end
--关闭视野锚点
ScriptLib.ClearPlayerEyePoint(context, defs.inner_region)
ScriptLib.SetLimitOptimization(context, context.uid, false)
--环境小动物优化
ScriptLib.SwitchSceneEnvAnimal(context, 2)
--重置visiontype
ScriptLib.SetPlayerGroupVisionType(context, {context.uid}, {1})
if defs.bossRegionSpecialOptimization~=nil then
ScriptLib.RevertPlayerRegionVision(context, context.uid)
end
--还原LD配置的visiontype变化
ScriptLib.RevertPlayerRegionVision(context, context.uid)
return 0
end
Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,96 @@
local gadget_list = {{key="water",id=70350281},{key="fire",id=70350282},{key="ice",id=70350283},{key="wind",id=70350284},{key="electric",id=70350285},{key="none",id=70350286}}
local var = {
["common"] = {"SGV_AttackDamageLevel","SGV_ElementMasteryLevel","SGV_AttackSpeedLevel","SGV_RangeLevel"},
["water"] = {"SGV_Bubble","SGV_WaterImpulse","SGV_Evaporate","SGV_Wet","SGV_TargetAOE","SGV_Dot"},
["fire"] = {"SGV_Aoe","SGV_Enbreak","SGV_FireImpulse","SGV_Melt","SGV_Defensedown","SGV_FireArea","SGV_Missile"},
["ice"] = {"SGV_Explosion","SGV_Slowdown","SGV_IceImpulse","SGV_Frozen","SGV_Resistancedown","SGV_TDSpecialGrade_Ice","SGV_Ice_Fog"},
["wind"] = {"SGV_UpgradeRepulse","SGV_TowUnits","SGV_WindImpulse","SGV_ReduceWindResistance","SGV_ExtraDamageByHp","SGV_ShootBullet","SGV_CanCharge"},
["electric"] = {"SGV_ExtraTargets","SGV_Confine","SGV_ElectricImpulse","SGV_UpgradeElectricRecation","SGV_FurySwipe","SGV_ExtraThunder","SGV_UpgradeNormalAttack"},
["none"] = {"SGV_HitExplosion","SGV_ReducePhysicalResistance","SGV_DamageByTime","SGV_WantedSign","SGV_EnergyBallAttack"},
}
local tri = {
[1] = {config_id=10000, name="group_load", event=EventType.EVENT_GROUP_LOAD, source="", condition="", action="action_group_load", trigger_count=0},
[2] = {config_id=10001, name="group_refresh", event=EventType.EVENT_GROUP_REFRESH, source="", condition="", action="action_group_load", trigger_count=0},
[3] = {config_id=10002, name="variable_change", event=EventType.EVENT_VARIABLE_CHANGE, source="", condition="", action="action_variable_change", trigger_count=0}
}
function Initialize()
for i,v in ipairs(points) do
if i > #gadget_list then
break
end
if points[i] == nil then
break
end
temp_gadget = {config_id = 8000+i, gadget_id = gadget_list[i].id, pos = points[i].pos, rot = points[i].rot, level = 1}
table.insert(gadgets, temp_gadget)
--table.insert(suites[1].gadgets, temp_gadget.config_id)
end
------------
for k,v in pairs(var) do
for m,n in ipairs(v) do
local _var = { name = n, value = 0, no_refresh = true }
table.insert(variables, _var)
end
end
-------------
for i,v in ipairs(tri) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
end
function action_group_load(context, evt)
ScriptLib.PrintLog("--------------- v4 -----------------")
for i,v in ipairs(gadget_list) do
local SGV_table = {}
for p,q in ipairs(var.common) do
SGV_table[q] = 0
end
for m,n in ipairs(var) do
if m == v.key then
for p,q in ipairs(n) do
SGV_table[q] = 0
end
end
end
--[[
for k,v in pairs(SGV_table) do
ScriptLib.PrintContextLog(context, "k="..k.." | v="..v)
end
--]]
--ScriptLib.CreateGadgetWithGlobalValue(context, 8000+i, SGV_table)
ScriptLib.CreateGadgetWithGlobalValue(context, 8000+i, {})
end
return 0
end
function action_variable_change(context, evt)
--local value = ScriptLib.GetGroupVariableValue(context, evt.source_name)
for k,v in pairs(var) do
for p,q in ipairs(v) do
if q == evt.source_name then
if k == "common" then
for m,n in ipairs(gadget_list) do
ScriptLib.SetEntityServerGlobalValueByConfigId(context, 8000+m, evt.source_name, evt.param1)
end
return 0
else
for m,n in ipairs(gadget_list) do
if n.key == k then
ScriptLib.SetEntityServerGlobalValueByConfigId(context, 8000+m, evt.source_name, evt.param1)
end
end
return 0
end
end
end
end
return 0
end
Initialize()

View File

@@ -0,0 +1,672 @@
--2.0奥博伦派对玩法
--local defs = {
-- group_id = 111101122 ,
-- tamari_gadget_id = defs.temari_gadget_id,
-- host_option_id = 184,
-- guset_option_id = 185,
-- host_chest_id = 122001,
--}
local tempDefs = {
pre_quest = 7217605,
host_option = 2351,
guest_option = 2350,
find_ball_challenge_offline = 244,
hide_ball_challenge = 236,
find_ball_challenge = 235,
father_hide_ball_challenge = 242,
father_find_ball_challenge = 243,
challenge_time = 30
}
local chests = {}
local temari_gadgets = {}
local Tri1 = {
[1] = { name = "group_load", config_id = 8000001, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0},
[2] = { name = "quest_finish", config_id = 8000002, event = EventType.EVENT_QUEST_FINISH, source = "",condition = "",action = "action_quest_finish",trigger_count= 0},
}
local Tri2 = {
[1] = { name = "quest_start", config_id = 8000003, event = EventType.EVENT_QUEST_START, source = "",condition = "",action = "action_quest_start",trigger_count= 0},
[2] = { name = "challenge_success", config_id = 8000004, event = EventType.EVENT_CHALLENGE_SUCCESS, source = "",condition = "",action = "action_challenge_success",trigger_count= 0},
[3] = { name = "challenge_fail", config_id = 8000005, event = EventType.EVENT_CHALLENGE_FAIL, source = "",condition = "",action = "action_challenge_fail",trigger_count= 0},
[4] = { name = "select_option", config_id = 8000006, event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_select_option", trigger_count = 0, forbid_guest = false },
[5] = { name = "group_refresh", config_id = 8000007, event = EventType.EVENT_GROUP_REFRESH, source = "", condition = "", action = "action_group_refresh", trigger_count = 0},
[6] = { name = "gadget_create", config_id = 8000008, event = EventType.EVENT_GADGET_CREATE, source = "", condition = "", action = "action_gadget_create", trigger_count = 0},
}
function Initialize()
for k,v in pairs(Tri1) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
for k,v in pairs(Tri2) do
table.insert(triggers, v)
table.insert(suites[2].triggers, v.name)
end
table.insert(chests,defs.chest_1)
table.insert(chests,defs.chest_2)
table.insert(chests,defs.chest_3)
--table.insert(chests,defs.chest_online)
table.insert(temari_gadgets,defs.temari_1)
table.insert(temari_gadgets,defs.temari_2)
table.insert(temari_gadgets,defs.temari_3)
table.insert(temari_gadgets,defs.temari_online)
table.insert(variables,{ config_id=50000001,name = "has_hidden", value = 0,no_refresh = true})
--记录uid的低四位
table.insert(variables,{ config_id=50000002,name = "challenger_uid1", value = 0})
--记录uid的高位challenger_uid2*10000+challenger_uid就是最后正确的uid
table.insert(variables,{ config_id=50000003,name = "challenger_uid2", value = 0})
--记录放球的小数位
table.insert(variables,{ config_id=50000004,name = "pos_x1", value = 0})
table.insert(variables,{ config_id=50000005,name = "pos_z1", value = 0})
end
--------------------------------------------------------------------
--group load时无事发生
function action_group_load(context,evt)
ScriptLib.PrintContextLog(context,"TMR: Group Load!")
LF_Initiate_Play(context)
return 0
end
--group refresh时重置group状态回到第一关
function action_group_refresh(context,evt)
ScriptLib.PrintContextLog(context,"TMR: Group Refresh!")
LF_Reset_Group(context)
return 0
end
--任务开始时,加载下一关(单机挑战)
function action_quest_start(context,evt)
ScriptLib.PrintContextLog(context,"TMR: Player has triggered some quest!!")
--校验一下任务id确保是奥博伦任务触发的任务开始
if string.sub(evt.param1,1,5) == tostring(defs.FatherQuest) then
ScriptLib.PrintContextLog(context,"TMR: Triggered quest is :"..evt.param1)
LF_Set_Challenge_State(context,1)
LF_Load_Next_Level(context)
LF_Start_Challenge(context,0)
end
return 0
end
--操作台创建时,直接挂选项
function action_gadget_create(context,evt)
if (evt.param1 == defs.temari_gadget_id) then
LF_Set_Gadget_Option(context)
end
return 0
end
function action_quest_finish(context,evt)
ScriptLib.PrintContextLog(context,"TMR: pre quest has been finished, load the second suite!!")
if (evt.param1 == tempDefs.pre_quest) then
LF_Initiate_Play(context)
end
return 0
end
--选择了选项,根据当前主客机,触发不同的挑战(联机挑战)
function action_select_option(context,evt)
--试图开启主机藏球挑战
if evt.param2 == tempDefs.host_option then
--藏球挑战
if LF_Is_Host(context) then
if LF_Get_Challenge_State(context) == 10 or LF_Get_Challenge_State(context) == 12 then
--仅在联机玩法初始化以及主机已完成藏球的情况下,可以开启藏球挑战
ScriptLib.PrintContextLog(context,"TMR: !!!!!!!!!!!!Hide ball challenge starts!!!!!!!")
LF_Load_Online_Level(context,1)
LF_Set_Challenge_State(context,11)
LF_Start_Challenge(context,1)
ScriptLib.DelWorktopOptionByGroupId(context,defs.group_id,defs.temari_gadget_id,tempDefs.host_option)
elseif LF_Get_Challenge_State(context) == 11 then
--主机在藏球挑战中再次交互,试图开启藏球挑战(理论上不存在这种情况)
ScriptLib.PrintContextLog(context,"TMR: CHALLENGE FAILS!!! Cannot start duplicated challenges!!!")
elseif LF_Get_Challenge_State(context) == 13 then
--客机正在找球,不允许主机开启藏球挑战
ScriptLib.SendServerMessageByLuaKey(context, "GUEST_CHALLENGING", {context.uid})
ScriptLib.PrintContextLog(context,"TMR: CHALLENGE FAILS!!! Guest is challenging!!!")
end
else
--客机不能开启主机的藏球挑战
ScriptLib.SendServerMessageByLuaKey(context, "HOST_ONLY_CHALLENGE", {context.uid})
ScriptLib.PrintContextLog(context,"TMR: CHALLENGE FAILS!!!! Guest cannot hide ball!")
end
end
if evt.param2 == tempDefs.guest_option then
--找球挑战(允许主机也开启挑战,因此这里不做主客机的区分)
if LF_Get_Challenge_State(context)==12 then
--主机已完成藏球,可以开始挑战
ScriptLib.PrintContextLog(context,"TMR: !!!!!!!!!!!Find ball challenge starts!!!!!!!!!!!!")
LF_Load_Online_Level(context,2)
local ret = LF_Start_Challenge(context,2)
if (ret == -1) then
ScriptLib.PrintContextLog(context,"TMR: CHALLENGE FAILS!!!! Same gallery is activating!")
LF_Online_Hide_Level(context)
return 0
end
LF_Set_Challenge_State(context,13)
ScriptLib.DelWorktopOptionByGroupId(context,defs.group_id,defs.temari_gadget_id,tempDefs.guest_option)
elseif LF_Get_Challenge_State(context)== 10 then
--主机没有藏球,不能挑战
ScriptLib.SendServerMessageByLuaKey(context, "LEVEL_NOT_SETTLED", {context.uid})
ScriptLib.PrintContextLog(context,"TMR: CHALLENGE FAILS!!!! Host hasn't hide the ball!")
elseif LF_Get_Challenge_State(context)== 11 then
--主机正在藏球,不能挑战
ScriptLib.SendServerMessageByLuaKey(context, "LEVEL_SETTLING", {context.uid})
ScriptLib.PrintContextLog(context,"TMR: CHALLENGE FAILS!!!! Host is hiding the ball!")
elseif LF_Get_Challenge_State(context)== 13 then
--挑战中试图再开启一个找球挑战,理论上不存在这种情况
ScriptLib.PrintContextLog(context,"TMR: CHALLENGE FAILS!!!! Cannot start duplicated challenges!!!")
end
end
return 0
end
--分别处理单机玩法和联机玩法挑战失败的情况
function action_challenge_fail(context,evt)
if LF_Get_Play_Phase(context) == 1 then
if evt.param1 == tempDefs.find_ball_challenge_offline then
ScriptLib.PrintContextLog(context,"TMR: Offline Challenge fails!")
LF_Stop_Temari_Gallery(context)
LF_Update_Quest_State(context,false)
end
else
--联机挑战阶段挑战失败
if evt.param1 == tempDefs.father_hide_ball_challenge then
--藏球失败
ScriptLib.PrintContextLog(context,"TMR: Host Challenge fails!")
--创建一个藏球宝箱 5.27需求,不需要联机奖励宝箱了
--ScriptLib.CreateGadget(context,{config_id=chests[#chests]})
--修改挑战状态。如果玩家至少藏过一次球则即使失败也将状态置为12即藏过球否则置为10认为没有藏球
if (LF_Has_Hidden_Ball(context)) then
LF_Set_Challenge_State(context,12)
else
LF_Set_Challenge_State(context,10)
end
LF_Set_Gadget_Option(context)
--移除掉联机用的关卡布设
LF_Online_Hide_Level(context)
--LF_Teleport_Player(context)
end
if evt.param1 == tempDefs.father_find_ball_challenge then
--客机找球挑战失败
ScriptLib.PrintContextLog(context,"TMR: Guest Challenge fails!")
LF_Set_Challenge_State(context,12)
--移除掉联机用的关卡布设
LF_Online_Hide_Level(context)
LF_Set_Gadget_Option(context)
LF_Stop_Temari_Gallery(context)
end
end
return 0
end
--分别处理单机玩法和联机玩法挑战成功的情况
function action_challenge_success(context,evt)
ScriptLib.PrintContextLog(context,"TMR: Some challenge has been finished!!!")
if LF_Get_Play_Phase(context) == 1 then
if evt.param1 == tempDefs.find_ball_challenge_offline then
ScriptLib.PrintContextLog(context,"TMR: Offline Challenge success!")
LF_Stop_Temari_Gallery(context)
LF_Update_Quest_State(context,true)
--创建一个单机找球挑战宝箱,仅单机挑战的最后一关给一个宝箱
if (LF_Get_OfflineChallenge_Level(context)-2 == 3) then
ScriptLib.CreateGadget(context,{config_id=chests[LF_Get_OfflineChallenge_Level(context)-2]})
end
end
else
--联机挑战阶段挑战成功
if evt.param1 == tempDefs.father_hide_ball_challenge then
--藏球挑战成功
ScriptLib.PrintContextLog(context,"TMR: Host Challenge finishes!")
--创建一个藏球宝箱 5.27需求,不需要联机奖励宝箱了
--ScriptLib.CreateGadget(context,{config_id=chests[#chests]})
--修改挑战状态
LF_Set_Challenge_State(context,12)
LF_Set_Gadget_Option(context)
LF_Teleport_Player(context)
end
if evt.param1 == tempDefs.father_find_ball_challenge then
--找球挑战成功挑战状态回到12
ScriptLib.PrintContextLog(context,"TMR: Guest Challenge success!")
LF_Set_Challenge_State(context,12)
--移除掉联机用的关卡布设
LF_Online_Hide_Level(context)
LF_Set_Gadget_Option(context)
LF_Stop_Temari_Gallery(context)
end
end
return 0
end
--------------------------------------------------------------------
--辅助方法-----------------------------------------------------------
--------------------------------------------------------------------
--关卡相关方法---------------------------------------------------
--初始化整个玩法的方法仅当groupload时调用
function LF_Initiate_Play(context)
local uidList = ScriptLib.GetSceneUidList(context)
--上线的时候如果同时group load可能找不到uidlist做一个保护
if (uidList == nil or #uidList == 0) then
return 0
end
local avatar_entity = ScriptLib.GetAvatarEntityIdByUid(context, uidList[1])
local quest_state = ScriptLib.GetQuestState(context, avatar_entity, tempDefs.pre_quest)
ScriptLib.PrintContextLog(context,"TMR: Prequest state is: "..quest_state)
if ScriptLib.GetQuestState(context, avatar_entity, tempDefs.pre_quest) == QuestState.FINISHED then
ScriptLib.PrintContextLog(context,"TMR: pre quest has been finished, group load!!")
local ret = ScriptLib.GoToGroupSuite(context,defs.group_id,2)
--将当前suite切换到2确保下一次从suite3开始加载
LF_Set_OfflineChallenge_Level(context,2)
ScriptLib.PrintContextLog(context,"TMR: The result of loading suite 2 : "..ret)
end
end
--加载单机挑战的下一个关卡
function LF_Load_Next_Level(context)
local curLevel = LF_Get_OfflineChallenge_Level(context)
curLevel = curLevel + 1
ScriptLib.PrintContextLog(context,"TMR: Ready to load SUITE: "..curLevel)
LF_Set_OfflineChallenge_Level(context,curLevel)
ScriptLib.AddExtraGroupSuite(context,defs.group_id,curLevel)
end
--初始化联机玩法
function LF_Initiate_Online_Challenge(context)
--把交互用的奥博伦球创建出来
ScriptLib.CreateGadget(context,{config_id = defs.temari_gadget_id})
--给奥博伦交互球设置选项
LF_Set_Gadget_Option(context)
end
--加载联机挑战的关卡
--phase = 1主机藏球挑战phase = 2客机找球挑战
function LF_Load_Online_Level(context,phase)
if ( phase == 1 ) then
--加载最后一组suite和LD约定最后一组suite为联机关卡
ScriptLib.AddExtraGroupSuite(context,0,#suites)
--去掉场景内现在藏着的球
ScriptLib.KillEntityByConfigId(context,{config_id = defs.temari_online})
else
--加载最后一组suite和LD约定最后一组suite为联机关卡
ScriptLib.AddExtraGroupSuite(context,0,#suites)
--把存储的球的位置加载出来
local pos = LF_Load_Online_Temari_Pos(context)
ScriptLib.CreateGadgetByConfigIdByPos(context, defs.temari_online, {x=pos.x,y=pos.y,z=pos.z}, {x=0,y=0,z=0})
end
end
--重置整个group的方法将group还原至最初的状态
function LF_Reset_Group(context)
if LF_Get_Play_Phase(context) == 1 then
LF_Set_OfflineChallenge_Level(context,2)
LF_Set_Challenge_State(context,0)
else
--移除掉联机用的关卡布设
ScriptLib.RemoveExtraGroupSuite(context,0,#suites)
ScriptLib.KillEntityByConfigId(context,{config_id = defs.temari_online})
LF_Set_Challenge_State(context,10)
LF_Set_Gadget_Option(context)
end
end
--gallery/challenge/quest相关方法--------------------------------------------------
--启动挑战的方法,对于联机挑战,需要把启动的子挑战挂在父挑战上一起启动。
--target:0单机找球1联机藏球2联机找球
function LF_Start_Challenge(context,target)
if LF_Get_Play_Phase(context) == 1 then
--要求开启挑战,因为是单机的,直接开就可以了
ScriptLib.ActiveChallenge(context,tempDefs.find_ball_challenge_offline,tempDefs.find_ball_challenge_offline,tempDefs.challenge_time, 0, tempDefs.find_ball_challenge_offline, 1)
LF_Start_Temari_Gallery(context)
else
if (target == 2) then
local ret = LF_Start_Temari_Gallery(context)
--如果gallery没有开出来说明同scene下已经有一个同名gallery了整个玩法都不允许开启
if (ret == -1) then
return -1
end
--开启挑战的时候存一下开启挑战者的uid
LF_Save_Challenger(context)
end
--联机状态下,要把子挑战挂给父挑战后再开启
local challenge = 0
local father_challenge = 0
if (target == 1) then
challenge = tempDefs.hide_ball_challenge
father_challenge = tempDefs.father_hide_ball_challenge
elseif target == 2 then
challenge = tempDefs.find_ball_challenge_offline
father_challenge = tempDefs.father_find_ball_challenge
end
local child_challenge_param_table = {tempDefs.challenge_time,0,challenge,1}
ScriptLib.CreateFatherChallenge(context, father_challenge, father_challenge, tempDefs.challenge_time, {success=2, fail=1})
ScriptLib.AttachChildChallenge(context, father_challenge, challenge, challenge, child_challenge_param_table, {context.uid},{success=1, fail=1})
ScriptLib.StartFatherChallenge(context,father_challenge)
end
return 0
end
--终止挑战的方法challenge目标的挑战ID
--target: 0:单机挑战1联机藏球2联机找球
--resulttrue=1false=0
function LF_Stop_Challenge(context,target,result)
if LF_Get_Play_Phase(context) == 1 then
--单机的直接关掉即可
ScriptLib.PrintContextLog(context,"TMR: Stop offline challenge here!!!")
ScriptLib.StopChallenge(context,tempDefs.find_ball_challenge_offline,result)
else
if (target == 1) then
--结束联机藏球挑战
ScriptLib.PrintContextLog(context,"TMR: Stop hide ball challenge with result: "..result)
ScriptLib.StopChallenge(context,tempDefs.father_hide_ball_challenge,result)
elseif (target == 2) then
--结束联机找球挑战
ScriptLib.PrintContextLog(context,"TMR: Stop find ball challenge with result: "..result)
ScriptLib.StopChallenge(context,tempDefs.father_find_ball_challenge,result)
end
end
end
--启动藏球的方向指示gallery
function LF_Start_Temari_Gallery(context)
local ret = ScriptLib.SetPlayerStartGallery(context, 9001, {context.uid})
--如果gallery没有开出来说明同scene下已经有一个同名gallery了整个玩法都不允许开启
if (ret == -1) then
return -1
end
local temari_pos = LF_Get_Temari_Pos(context)
ScriptLib.SetHandballGalleryBallPosAndRot(context, 9001, {x=temari_pos.x,y=temari_pos.y,z=temari_pos.z}, {x=0,y=0,z=0})
end
--关闭藏球的方向指示gallery
function LF_Stop_Temari_Gallery(context)
ScriptLib.StopGallery(context, 9001, true)
end
--根据参数更新单机挑战的任务状态传入true为成功、false为失败
function LF_Update_Quest_State(context, questState)
local curLevel = LF_Get_OfflineChallenge_Level(context)
local quest_level = curLevel-2
local quest_suffix = "01"
if (questState) then
quest_suffix = "01"
else
quest_suffix = "02"
end
local quest_param = defs.group_id.."0"..quest_level..quest_suffix
local ret = ScriptLib.AddQuestProgress(context,quest_param)
ScriptLib.PrintContextLog(context,"TMR: quest param is "..quest_param)
ScriptLib.PrintContextLog(context,"TMR: The result of Adding quest progress is "..ret)
--不论挑战是否胜利,都要移除掉当前加载的关卡
ScriptLib.PrintContextLog(context,"TMR: The removed suite is "..curLevel)
ScriptLib.RemoveExtraGroupSuite(context,defs.group_id,curLevel)
--如果胜利且是单机挑战的最后一个suite胜利后直接进入联机玩法状态
if (questState) then
if (curLevel+1>=#suites) then
ScriptLib.PrintContextLog(context,"TMR:!!!!!!!!!!!!!!!!!Offline challenge has finished!!!!!!!!!!!!!!!!")
LF_Set_Challenge_State(context,10)
LF_Initiate_Online_Challenge(context)
end
end
--如果挑战失败,要将当前的关卡向前回滚一关,这样下次开启任务才能再次开启当前关卡
if (not questState) then
LF_Set_OfflineChallenge_Level(context,curLevel-1)
end
end
--通用类方法-----------------------------------------------------------
--将玩家传送回奥博伦球控制台附近
function LF_Teleport_Player(context)
local temari_worktop_id = ScriptLib.GetEntityIdByConfigId(context,defs.temari_gadget_id)
local temari_pos = ScriptLib.GetPosByEntityId(context, temari_worktop_id)
local uidlist = ScriptLib.GetSceneUidList(context)
ScriptLib.PrintContextLog(context,"TMR: Current host player is :"..uidlist[1])
ScriptLib.PrintContextLog(context,"TMR: The context uid is: "..context.uid)
if (LF_Is_Host(context)) then
ScriptLib.TransPlayerToPos(context, {uid_list = {uidlist[1]}, pos = {x=temari_pos.x,y=temari_pos.y,z=temari_pos.z}, radius = 1, rot = {x=0, y=0, z=1},is_skip_ui=false} )
else
ScriptLib.TransPlayerToPos(context, {uid_list = {context.uid}, pos = {x=temari_pos.x,y=temari_pos.y,z=temari_pos.z}, radius = 1, rot = {x=0, y=0, z=1},is_skip_ui=false} )
end
end
--给奥博伦球gadget设置选项
function LF_Set_Gadget_Option(context)
ScriptLib.SetWorktopOptionsByGroupId(context,defs.group_id,defs.temari_gadget_id,{tempDefs.guest_option,tempDefs.host_option})
end
--联机玩法中,隐藏关卡配置的方法,调用后隐藏掉当前的关卡配置以及放着的球
function LF_Online_Hide_Level(context)
--干掉藏起来的球
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.GADGET, defs.temari_online)
--干掉放置用关卡
ScriptLib.RemoveExtraGroupSuite(context,0,#suites)
end
--通用的放球方法,把球放下来并记录其位置
function LF_Hide_Ball(context)
local uid_list = ScriptLib.GetSceneUidList(context)
local avatar_id = ScriptLib.GetAvatarEntityIdByUid(context, uid_list[1])
local pos = ScriptLib.GetPosByEntityId(context, avatar_id)
ScriptLib.CreateGadgetByConfigIdByPos(context, defs.temari_online, {x=pos.x+1,y=pos.y+1.5,z=pos.z}, {x=0,y=0,z=0})
--存一下球的位置,马上要销毁掉
LF_Save_Online_Temari_Pos(context)
LF_Online_Hide_Level(context)
end
--挑战开启时,将挑战者记录下来
function LF_Save_Challenger(context)
ScriptLib.PrintContextLog(context,"TMR: Save challenger uid: "..context.uid)
--拆一下uid存下来防止位数超了
local uid1 = context.uid % 10000 --低位
local uid2 = math.floor(context.uid / 10000) --高位
ScriptLib.SetGroupVariableValue(context,"challenger_uid1",uid1)
ScriptLib.SetGroupVariableValue(context,"challenger_uid2",uid2)
ScriptLib.PrintContextLog(context,"TMR: Saving uid2"..uid2)
ScriptLib.PrintContextLog(context,"TMR: Saving uid1"..uid1)
end
function LF_Is_Same_Challenger(context)
local uid1 = ScriptLib.GetGroupVariableValue(context,"challenger_uid1")
local uid2 = ScriptLib.GetGroupVariableValue(context,"challenger_uid2")
local uid = uid2 * 10000 + uid1
ScriptLib.PrintContextLog(context,"TMR: Player touching ball is: "..context.uid.." and the player set ball is "..uid)
return context.uid == uid
end
-----CRUD类方法-----------------------------------------------------------
--改变当前玩法状态
--0group初始化状态完全没有开始
--1单机挑战进行中用level参数确定当前正在进行的单机关卡数
--10已完成单机挑战联机挑战未开启
--11主机进行藏球挑战
--12主机已完成藏球
--13客机进行找球挑战
function LF_Set_Challenge_State(context,target_state)
ScriptLib.PrintContextLog(context,"TMR: Changing play state to: "..target_state)
ScriptLib.SetGroupVariableValue(context,"ChallengeState",target_state)
end
--获取当前玩法状态
--0group初始化状态完全没有开始
--1单机挑战进行中用level参数确定当前正在进行的单机关卡数
--10已完成单机挑战联机挑战未开启
--11主机进行藏球挑战
--12主机已完成藏球
--13客机进行找球挑战
function LF_Get_Challenge_State(context)
return ScriptLib.GetGroupVariableValue(context,"ChallengeState")
end
--设置单机挑战的当前关卡
function LF_Set_OfflineChallenge_Level(context,targetLevel)
ScriptLib.SetGroupVariableValue(context,"ChallengeLevel",targetLevel)
end
--读取单机挑战的当前关卡
function LF_Get_OfflineChallenge_Level(context)
return ScriptLib.GetGroupVariableValue(context,"ChallengeLevel")
end
--返回当前关卡的手鞠球位置
function LF_Get_Temari_Pos(context)
if (LF_Get_Play_Phase(context) == 1) then
--一阶段获取手鞠球的位置
local curLevel = LF_Get_OfflineChallenge_Level(context)
local temari_entity_id = ScriptLib.GetEntityIdByConfigId(context,temari_gadgets[curLevel-2])
local temari_pos = ScriptLib.GetPosByEntityId(context, temari_entity_id)
ScriptLib.PrintContextLog(context,"TMR: Temari pos: "..temari_pos.x..","..temari_pos.y..","..temari_pos.z)
return temari_pos
else
--二阶段获取手鞠球的位置
local temari_entity_id = ScriptLib.GetEntityIdByConfigId(context,defs.temari_online)
local temari_pos = ScriptLib.GetPosByEntityId(context, temari_entity_id)
ScriptLib.PrintContextLog(context,"TMR: Temari pos: "..temari_pos.x..","..temari_pos.y..","..temari_pos.z)
return temari_pos
end
end
--存储联机玩法中当前球的位置
function LF_Save_Online_Temari_Pos(context)
local pos = LF_Get_Temari_Pos(context)
ScriptLib.PrintContextLog(context,"TMR: Save Temari pos: "..pos.x..","..pos.y..","..pos.z)
local ret = ScriptLib.SetGroupVariableValue(context,"pos_x",math.floor(pos.x))
ScriptLib.SetGroupVariableValue(context,"pos_y",math.ceil(pos.y))
ScriptLib.SetGroupVariableValue(context,"pos_z",math.floor(pos.z))
ScriptLib.SetGroupVariableValue(context,"pos_x1",math.floor((pos.x-math.floor(pos.x))*10))
ScriptLib.SetGroupVariableValue(context,"pos_z1",math.floor((pos.z-math.floor(pos.z))*10))
ScriptLib.PrintContextLog(context,"TMR: set pos ret = "..ret)
end
--读取联机玩法中当前球的位置
function LF_Load_Online_Temari_Pos(context)
local pos_x = ScriptLib.GetGroupVariableValue(context,"pos_x")
local pos_y = ScriptLib.GetGroupVariableValue(context,"pos_y")
local pos_z = ScriptLib.GetGroupVariableValue(context,"pos_z")
local pos_x1 = ScriptLib.GetGroupVariableValue(context,"pos_x1")/10
local pos_z1 = ScriptLib.GetGroupVariableValue(context,"pos_z1")/10
ScriptLib.PrintContextLog(context,"TMR: Load Temari pos: "..pos_x+pos_x1..","..pos_y..","..pos_z+pos_z1)
local pos = {x=pos_x+pos_x1,y=pos_y,z=pos_z+pos_z1}
return pos
end
--返回玩家是否至少藏了一次球
function LF_Has_Hidden_Ball(context)
if ScriptLib.GetGroupVariableValue(context,"has_hidden")==1 then
return true
else
return false
end
end
--返回当前整体玩法进度
--phase1单机挑战阶段
--phase2联机挑战阶段phase 2下刷新group不会再回到phase 1
function LF_Get_Play_Phase(context)
if (LF_Get_Challenge_State(context)<10) then
return 1
else
return 2
end
end
--返回当前(触发事件)的玩家是否是主机
function LF_Is_Host(context)
local uid_List = ScriptLib.GetSceneUidList(context)
local host_id = uid_List[1]
ScriptLib.PrintContextLog(context,"TMR: Current user id is "..context.uid)
ScriptLib.PrintContextLog(context,"TMR: Host user id is "..host_id)
return (host_id==context.uid) or (context.uid == 0)
end
--------------------------------------------------------------------
--server lua call---------------------------------------------------
--找球胜利通过球自身的ability调用调用时需要判定当前玩家主客机如果是主机则无事发生
function SLC_Find_Ball(context)
if LF_Get_Play_Phase(context) == 1 then
ScriptLib.PrintContextLog(context,"TMR: Player has found the ball!")
local curLevel = LF_Get_OfflineChallenge_Level(context)
ScriptLib.KillEntityByConfigId(context,{config_id = temari_gadgets[curLevel-2]})
LF_Stop_Challenge(context,0,1)
else
--联机情况下,判断挑战开启者和碰到球的是否是一个人,如果不是则无事发生
if (LF_Is_Same_Challenger(context)) then
ScriptLib.PrintContextLog(context,"TMR: Guest has found the ball!")
ScriptLib.KillEntityByConfigId(context,{config_id = defs.temari_online})
--成就相关,如果当前完成的玩家并不是主机,则发送一次成就完成的消息
if (not LF_Is_Host(context)) then
ScriptLib.MarkPlayerAction(context, 6018 , 3 , 1)
end
LF_Stop_Challenge(context,2,1)
end
end
return 0
end
--放球的server lua call被主机的E技能键调用
function SLC_Hide_Ball(context)
local avatar_id = ScriptLib.GetAvatarEntityIdByUid(context, context.uid)
local pos = ScriptLib.GetPosByEntityId(context, avatar_id)
ScriptLib.CreateGadgetByConfigIdByPos(context, defs.temari_online, {x=pos.x,y=pos.y+1,z=pos.z}, {x=0,y=0,z=0})
----存一下球的位置,马上要销毁掉
LF_Save_Online_Temari_Pos(context)
LF_Stop_Challenge(context,1,1)
LF_Online_Hide_Level(context)
--藏球后将藏球的标志置为1说明玩家至少藏了一次球
ScriptLib.SetGroupVariableValue(context,"has_hidden",1)
return 0
end
--------------------------------------------------------------------
Initialize()

View File

@@ -0,0 +1,72 @@
--2.0奥博伦派对-前置WQ用于启动奥博伦的方向指示gallery
local Tri = {
[1] = { name = "quest_start", config_id = 8000001, event = EventType.EVENT_QUEST_START, source = "7217604", condition = "", action = "action_quest_start", trigger_count = 0},
[2] = { name = "challenge_success", config_id = 8000002, event = EventType.EVENT_CHALLENGE_SUCCESS, source = "",condition = "",action = "action_challenge_success",trigger_count= 0},
[3] = { name = "challenge_fail", config_id = 8000003, event = EventType.EVENT_CHALLENGE_FAIL, source = "",condition = "",action = "action_challenge_fail",trigger_count= 0},
}
function Initialize()
for k,v in pairs(Tri) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
end
--------------------------------------------------------------------
--奥博伦前置任务启动的时候起一个gallery
function action_quest_start(context,evt)
ScriptLib.PrintContextLog(context,"TMRPre: Quest start!")
LF_Start_Temari_Gallery(context)
return 0
end
--奥博伦前置任务启动的时候起一个gallery
function action_challenge_success(context,evt)
ScriptLib.PrintContextLog(context,"TMRPre: challenge stops!")
LF_Stop_Temari_Gallery(context)
return 0
end
--奥博伦前置任务启动的时候起一个gallery
function action_challenge_fail(context,evt)
ScriptLib.PrintContextLog(context,"TMRPre: challenge stops!")
LF_Stop_Temari_Gallery(context)
return 0
end
--------------------------------------------------------------------
--启动藏球的方向指示gallery
function LF_Start_Temari_Gallery(context)
local temari_pos = LF_Get_Temari_Pos(context)
ScriptLib.SetPlayerStartGallery(context, 9001, {context.uid})
ScriptLib.SetHandballGalleryBallPosAndRot(context, 9001, {x=temari_pos.x,y=temari_pos.y,z=temari_pos.z}, {x=0,y=0,z=0})
end
--关闭藏球的方向指示gallery
function LF_Stop_Temari_Gallery(context)
ScriptLib.StopGallery(context, 9001, true)
end
--返回当前关卡的手鞠球位置
function LF_Get_Temari_Pos(context)
local temari_entity_id = ScriptLib.GetEntityIdByConfigId(context,defs.temari_id)
local temari_pos = ScriptLib.GetPosByEntityId(context, temari_entity_id)
ScriptLib.PrintContextLog(context,"TMR: Temari pos: "..temari_pos.x..","..temari_pos.y..","..temari_pos.z)
return temari_pos
end
--server lua call---------------------------------------------------
--找球胜利通过球自身的ability调用调用时需要判定当前玩家主客机如果是主机则无事发生
function SLC_Find_Ball(context)
ScriptLib.PrintContextLog(context,"TMR: Player has found the ball!")
--不管任务是否成功都要手动kill一次球确保特效触发正确
ScriptLib.KillEntityByConfigId(context,{config_id = defs.temari_id})
ScriptLib.StopChallenge(context,235,1)
return 0
end
--------------------------------------------------------------------
Initialize()

View File

@@ -0,0 +1,121 @@
--自定义函数部分
local extrTriggers = {
initialtrigger = {
["Enter_Region"] = { config_id = 8000001, name = "Enter_Region", event= EventType.EVENT_ENTER_REGION, source = "1", condition = "", action = "player_in_region", trigger_count = 0, forbid_guest = false },
["Random_Floor"] = { config_id = 8000002, name = "Random_Floor", event= EventType.EVENT_TIME_AXIS_PASS, source = "triggerThunderFloor", condition = "", action = "action_timeaxis_randomfloor", trigger_count = 0 },
}
}
function DeduplicationRandom( context, configIDList, randomNum )
math.randomseed(ScriptLib.GetServerTime(context))
local TempList = {}
local ReturnList = {}
for i,v in ipairs(configIDList) do
table.insert(TempList, v)
end
for i=1,randomNum do
local TempNum = math.random(#TempList)
table.insert(ReturnList, TempList[TempNum] )
table.remove(TempList, TempNum)
end
ScriptLib.PrintContextLog(context, "##TF LOG : return random lsit")
return ReturnList
end
function player_in_region( context, evt )
-- 监听玩法开始
if evt.param1 ~= EnterConfigID then
return 0
end
ScriptLib.PrintContextLog(context, "##TF LOG : player in region")
ScriptLib.InitTimeAxis(context, "triggerThunderFloor", thunderFloorTimer, true)
math.randomseed(ScriptLib.GetServerTime(context))
local randomNum = math.random(randomNumMin, randomNumMax)
local CurList = DeduplicationRandom(context, floorList, randomNum)
for i,v in ipairs(CurList) do
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 201)
end
-- ScriptLib.EndTimeAxis(context, "triggerThunderFloor")
-- for i,v in ipairs(floorList) do
-- ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 0)
-- end
return 0
end
function action_timeaxis_randomfloor( context, evt )
-- 每次随机一套地板
if randomNumMax > #floorList then
ScriptLib.PrintContextLog(context, "##TF LOG : randomNumMax is bigger than Listlength")
return 0
elseif randomNumMin > randomNumMax then
ScriptLib.PrintContextLog(context, "##TF LOG : randomNumMin is bigger than randomNumMax")
return 0
end
for i,v in ipairs(floorList) do
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 0)
end
math.randomseed(ScriptLib.GetServerTime(context))
local randomNum = math.random(randomNumMin, randomNumMax)
local CurList = DeduplicationRandom(context, floorList, randomNum)
for i,v in ipairs(CurList) do
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 201)
end
return 0
end
function LF_Initialize_Group(triggers, suites)
for k,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,152 @@
--雷元素溢出洞口
--需求:
--1. 同group内的溢出洞口每经过时间randomTime发一次球
--2. 每次randomCount个洞口会发球
--[[
local defs = {
--GroupID
group_id = 240950005,
--控制挑战开始的操作机关configID
--starter_configID = ,
--随机时间轴。每个轴上数字间隔8~15秒,请人力随机
RandomTimeAxis = {
{2,18,38,56,81,99,115,133,148,165,180,196,211,235,257,276,300,315,330,349,367,383,400,416,431,449,471,487},
{1,17,36,53,69,89,109,134,158,173,197,213,231,249,264,289,305,324,347,362,385,407,429,453,473,491},
{2,19,42,61,85,104,128,146,167,190,209,232,255,271,288,307,327,348,368,393,412,430,455,477,500},
},
--配置每次几个洞口发球
random_thunderhole_sum = {
min = 1,
max = 3,
},
}
]]--
local define = {
gadgetList = {},
groupID = defs.group_id,
starter_configID = defs.starter_configID,
RandomTimeAxis = defs.RandomTimeAxis,
random_thunderhole_sum = defs.random_thunderhole_sum,
}
local extraTriggers={
initialtrigger =
{
--["Select_Option"] = { config_id = 8000001, name = "Select_Option", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_select_option", trigger_count = 0 },
["TimeAxis_Event"] = { config_id = 8000002, name = "TimeAxis_Event", event= EventType.EVENT_TIME_AXIS_PASS, source = "", condition = "", action = "action_trigger_timeaxis", trigger_count = 0 },
--["Challenge_Fail"] = { config_id = 8000003, name = "Challenge_Fail", event= EventType.EVENT_CHALLENGE_FAIL, source = "", condition = "", action = "action_challenge_fail", trigger_count = 0 },
["GroupVariable_Change"] = { config_id = 8000003, name = "GroupVariable_Change", event= EventType.EVENT_VARIABLE_CHANGE, source = "challenge", condition = "", action = "action_group_variable_change", trigger_count = 0 },
--["GadgetState_Change"] = { config_id = 8000004, name = "GadgetState_Change", event= EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_gadget_state_change", trigger_count = 0 },
--["Challenge_Success"] = { config_id = 8000005, name = "Challenge_Success", event= EventType.EVENT_CHALLENGE_SUCCESS, source = "", condition = "", action = "action_challenge_success", trigger_count = 0 },
}
}
function LF_Initialize_Group(triggers, suites)
for k,v in pairs(extraTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
GetThunderHoleGadget(context)
return 0
end
--取得所有的溢出洞口
function GetThunderHoleGadget(context)
for k,v in pairs(gadgets) do
if v.gadget_id == 70330086 then
table.insert(define.gadgetList,v.config_id)
end
end
return 0
end
--[[function action_select_option(context, evt)
-- 判断是gadgetid starter_configID option_id 7
if evt.param1 == define.starter_configID then
if evt.param2 == 7 then
--所有溢出洞口物件切状态
for k,v in pairs(define.gadgetList) do
ScriptLib.SetGadgetStateByConfigId(context, v, 201)
end
--初始化时间轴
ScriptLib.InitTimeAxis(context, "shoot", define.RandomTimeAxis[math.random(#define.RandomTimeAxis)], true)
end
end
return 0
end
]]--
function action_trigger_timeaxis(context, evt)
RandomThunderHole(context, define.random_thunderhole_sum.min, define.random_thunderhole_sum.max)
return 0
end
-- 在suit中随机抽取randomCount个幸运物件让它们发球
function RandomThunderHole(context, minNum, maxNum)
math.randomseed(ScriptLib.GetServerTime(context))
randomNum = math.random(minNum, maxNum)
for i=1,randomNum do
if ScriptLib.GetGadgetStateByConfigId(context, define.groupID, define.gadgetList[i]) ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, define.gadgetList[i], 202)--物件切202发球后会自己切回201
end
end
return 0
end
--[[function action_gadget_state_change(context, evt)
if evt.param2 == define.starter_configID and evt.param1 == 0 then
--停止时间轴
ScriptLib.EndTimeAxis(context, "shoot")
--关闭未关闭的溢出洞口
StopAllGear(context)
else
--检查是不是关卡把洞口物件关了,如果关卡给关了,把时间轴停下
CheckThunderHoleState(context)
end
return 0
end]]--
function action_group_variable_change(context, evt)
--如果是开启挑战
if evt.param1 == 0 and evt.param2 == 1 then
--停止时间轴
ScriptLib.EndTimeAxis(context, "shoot")
--关闭未关闭的溢出洞口
StopAllGear(context)
end
--如果是结束挑战
if evt.param1 == 1 and evt.param2 == 0 then
--所有溢出洞口物件切状态
for k,v in pairs(define.gadgetList) do
ScriptLib.SetGadgetStateByConfigId(context, v, 201)
end
--初始化时间轴
ScriptLib.InitTimeAxis(context, "shoot", define.RandomTimeAxis[math.random(#define.RandomTimeAxis)], true)
end
return 0
end
function StopAllGear(context)
--所有溢出洞口物件停
for k,v in pairs(define.gadgetList) do
if ScriptLib.GetGadgetStateByConfigId(context, define.groupID, v) ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, v, 0)
end
end
return 0
end
function CheckThunderHoleState(context)
for i=1,#define.gadgetList do
if ScriptLib.GetGadgetStateByConfigId(context, define.groupID, define.gadgetList[i]) == 0 then
ScriptLib.EndTimeAxis(context, "shoot")
break
end
end
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,434 @@
--[[
--delay改为默认配置读不到就使用默认值
--group和nextgroup改为默认配置
--buff没有用到删除
--主控
--默认建造时间
local delay=30
local challenge_programme={
[1]=tide_defs_01,
[2]=tide_defs_02,
[3]=tide_defs_03
}
--怪物group的ID
local monster_group=245001003
local tide_defs_01 ={
--自适应配置项delay
--[1] = {delay = 30,guide_routes={1,2},enter={1001,1003},exit={1004},enter_id={7,8},exit_id={9}},
[1] = {guide_routes={1,2}},
[2] = {guide_routes={1,2}},
[3] = {guide_routes={1,2}},
[4] = {guide_routes={1,2}},
[5] = {guide_routes={1,2}},
},
local tide_defs_02 ={
[1] = {guide_routes={1,2}},
[2] = {guide_routes={1,2}},
[3] = {guide_routes={1,2}},
[4] = {guide_routes={1,2}},
[5] = {guide_routes={1,2}},
},
local tide_defs_03 ={
[1] = {guide_routes={1,2}},
[2] = {guide_routes={1,2}},
[3] = {guide_routes={1,2}},
[4] = {guide_routes={1,2}},
[5] = {guide_routes={1,2}},
}
local routes_start_point={
[1]={start_point={x=77.129,y=4.623077,z=-50.57449},points={1,2,3,4,5,6,7,8}},
[2]={start_point={x=64.96883,y=0.5410852,z=-16.04972},points={1,2,3,4,5,6,7,8,9,10}},
}
local guide_point_pool={1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040}
--]]
function LF_Init_Challenge_Group()
GM1 ={ config_id = 8100001, name = "GM", event = EventType.EVENT_VARIABLE_CHANGE, source = "GM_VALUE", condition = "", action = "action_GM_Action", trigger_count = 0}
t3 = { config_id = 8000003, name = "challenge_success", event = EventType.EVENT_SCENE_MULTISTAGE_PLAY_STAGE_END, source = "", condition = "", action = "action_EVENT_SCENE_MULTISTAGE_PLAY_STAGE_END", trigger_count = 0}
t4 = { config_id = 8000004, name = "group_load", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 }
t5 = { config_id = 8000005, name = "timer_event", event = EventType.EVENT_TIMER_EVENT, source = "route_points_delay", condition = "", action = "action_add_route_points", trigger_count = 0}
t6 = { config_id = 8000006, name = "point_arrive", event = EventType.EVENT_PLATFORM_REACH_POINT, source = "", condition = "", action = "action_REACH_POINT", trigger_count = 0 }
t7 = { config_id = 8000007, name = "end_stage_request", event = EventType.EVENT_SCENE_MULTISTAGE_PLAY_END_STAGE_REQ, source = "", condition = "", action = "action_END_STAGE", trigger_count = 0 }
t8 = { config_id = 8000008, name = "pick_card_event", event = EventType.EVENT_MECHANICUS_PICKED_CARD, source = "", condition = "", action = "action_PICK_CARD", trigger_count = 0 }
t9 = { config_id = 8000009,name = "TIMER_EVENT_DELAY", event = EventType.EVENT_TIMER_EVENT, source = "delay", condition = "", action = "action_END_DELAY", trigger_count = 0 }
t10 = { config_id = 8000010,name = "TIMER_EVENT_START_REMINDER", event = EventType.EVENT_TIMER_EVENT, source = "reminder", condition = "", action = "action_START_REMINDER", trigger_count = 0 }
t11 = { config_id = 8000011,name = "ALL_AVATAR_DIE", event = EventType.EVENT_DUNGEON_ALL_AVATAR_DIE, source = "", condition = "", action = "action_ALL_AVATAR_DIE", trigger_count = 0 }
for i,v in ipairs(suites) do
table.insert(v.triggers, GM1.name)
table.insert(v.triggers, t3.name)
table.insert(v.triggers, t4.name)
table.insert(v.triggers, t5.name)
table.insert(v.triggers, t6.name)
table.insert(v.triggers, t7.name)
table.insert(v.triggers, t8.name)
table.insert(v.triggers, t9.name)
table.insert(v.triggers, t10.name)
table.insert(v.triggers, t11.name)
end
table.insert(triggers, GM1)
table.insert(triggers, t3)
table.insert(triggers, t4)
table.insert(triggers, t5)
table.insert(triggers, t6)
table.insert(triggers, t7)
table.insert(triggers, t8)
table.insert(triggers, t9)
table.insert(triggers, t10)
table.insert(triggers, t11)
table.insert(variables, { config_id=50000001,name = "GM_VALUE", value = 0})
table.insert(variables, { config_id=50000002,name = "wave_ptr", value = 0})
table.insert(variables, { config_id=50000003,name = "special_challenge", value = 0})
table.insert(variables, { config_id=50000004,name = "left_monsters", value = 0})
table.insert(variables, { config_id=50000005,name = "max_escapable_monsters", value = 10})
table.insert(variables, { config_id=50000006,name = "escaped_monsters", value = 0})
table.insert(variables, { config_id=50000007,name = "route_guide_points_index", value = 1,no_refresh = true})
--怪物对地脉镇石造成额外伤害
table.insert(variables, { config_id=50000008,name = "monster_double_damage", value = 0})
--挑战逃出的怪物不超过一个
table.insert(variables, { config_id=50000009,name = "GM_Ignore_Monster_Escape", value = 0})
table.insert(variables, { config_id=50000010,name = "challenge_93", value = 0})
table.insert(variables, { config_id=50000011,name = "challenge_94", value = 0})
table.insert(variables, { config_id=50000012,name = "challenge_95", value = 0})
table.insert(variables, { config_id=50000013,name = "challenge_active_93", value = 0})
table.insert(variables, { config_id=50000014,name = "challenge_active_94", value = 0})
table.insert(variables, { config_id=50000015,name = "challenge_active_95", value = 0})
table.insert(variables, { config_id=50000016,name = "planNum", value = 1,no_refresh = true})
table.insert(variables, { config_id=50000017,name = "ban_tag_1", value = 999})
table.insert(variables, { config_id=50000018,name = "ban_tag_2", value = 999})
table.insert(variables, { config_id=50000019,name = "ban_tag_3", value = 999})
end
--------------------------------------
function action_GM_Action(context, evt)
if evt.source_name ~="GM_VALUE" then
return 0
end
if defs.max_escapable_monsters~= nil then
ScriptLib.SetGroupVariableValue(context, "max_escapable_monsters", defs.max_escapable_monsters)
end
ScriptLib.SetGroupVariableValue(context, "wave_ptr", 1)
--使用GM来随
local planNum=evt.param1
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 随到的方案是:"..planNum)
ScriptLib.SetGroupVariableValue(context, "planNum", planNum)
--请求ban_tag_list
ScriptLib.ExecuteGroupLua(context, monster_group, "req_ban_tag", {planNum,defs.group_id})
local tag=ScriptLib.GetGroupVariableValue(context, "ban_tag_1")
local ban_list={}
if tag<999 then
ban_list[1]=tag
end
tag=ScriptLib.GetGroupVariableValue(context, "ban_tag_2")
if tag<999 then
ban_list[2]=tag
end
tag=ScriptLib.GetGroupVariableValue(context, "ban_tag_3")
if tag<999 then
ban_list[3]=tag
end
if 0~=ScriptLib.InitSceneMultistagePlay(context, 999, MultistagePlayType.Chess, {rounds = #challenge_programme[planNum], init_building_points = defs.init_building_points or 200},ScriptLib.GetSceneUidList(context)) then
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : muitistage初始化失败")
else
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功设置muitistage|rounds="..#challenge_programme[planNum])
end
--迭代项
ScriptLib.ExecuteGroupLua(context, monster_group, "set_monster_preview", {defs.group_id,planNum})
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功设置怪物预览")
--设置怪物总数量
ScriptLib.ExecuteGroupLua(context, monster_group, "set_monster_number_req", {ScriptLib.GetGroupVariableValue(context, "wave_ptr")})
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功设置剩余怪物")
ScriptLib.SetSceneMultiStagePlayValues(context, 999, {round=ScriptLib.GetGroupVariableValue(context, "wave_ptr"),rounds=#challenge_programme[planNum],left_monsters=ScriptLib.GetGroupVariableValue(context, "left_monsters"),max_escapable_monsters=ScriptLib.GetGroupVariableValue(context, "max_escapable_monsters"),escaped_monsters=ScriptLib.GetGroupVariableValue(context, "escaped_monsters"),stage_bonus_building_points=0}, true)
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功设置显示参数|rounds="..#challenge_programme[planNum].."|left_monsters="..ScriptLib.GetGroupVariableValue(context, "left_monsters"))
ScriptLib.StartSceneMultiStagePlayStage(context, 999, defs.build_time or 123, Multistage.ChessBuild,"build"..ScriptLib.GetGroupVariableValue(context, "wave_ptr"),{})
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功开始挑战")
ScriptLib.ExecuteGroupLua(context, defs.gear_group_id, "Initialize_Fundations", {0})
add_route_guide_points(context)
ScriptLib.CreateGroupTimerEvent(context, defs.group_id, "reminder",5)
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : grouploadsuccess")
return 0
end
function action_ALL_AVATAR_DIE(context, evt)
local uidList=ScriptLib.GetSceneUidList(context)
local count=0
for i=1,#uidList do
if ScriptLib.IsPlayerAllAvatarDie(context, uidList[i]) then
count=count+1
end
end
if count >= (#uidList) then
ScriptLib.EndSceneMultiStagePlay(context, 999, false)
return 0
end
return 0
end
function action_END_STAGE(context, evt)
if evt.param2==Multistage.ChessBuild then
ScriptLib.EndSceneMultiStagePlayStage(context, 999,"build"..ScriptLib.GetGroupVariableValue(context, "wave_ptr"), true)
end
return 0
end
--翻牌子
function action_PICK_CARD(context, evt)
--牌子效果
--立即回复地脉镇石5点耐久度
if evt.param2==77 then
local hp=ScriptLib.GetGroupVariableValue(context, "escaped_monsters")
hp=hp-5
if hp<0 then
hp=0
end
ScriptLib.SetGroupVariableValue(context, "escaped_monsters", hp)
ScriptLib.SetSceneMultiStagePlayValue(context, 999, "escaped_monsters",hp, true)
return 0
end
--每翻一次下个战斗阶段敌人的血量提升10%
if evt.param2==92 then
local pickCount=ScriptLib.GetGroupVariableValue(context, "challenge_93")
pickCount=pickCount+1
ScriptLib.SetGroupVariableValue(context, "challenge_93", pickCount)
end
--每翻一次下个战斗阶段敌人的防御提升2%
if evt.param2==93 then
local pickCount=ScriptLib.GetGroupVariableValue(context, "challenge_94")
pickCount=pickCount+1
ScriptLib.SetGroupVariableValue(context, "challenge_94", pickCount)
end
--每翻一次下个战斗阶段怪物逃逸值加1
if evt.param2==94 then
local pickCount=ScriptLib.GetGroupVariableValue(context, "challenge_95")
pickCount=pickCount+1
ScriptLib.SetGroupVariableValue(context, "challenge_95", pickCount)
end
return 0
end
--设置卡牌效果
function Set_Cards_Effect(context)
--重置选中次数,获取上轮的选中次数
local pickCount=ScriptLib.GetGroupVariableValue(context, "challenge_93")
ScriptLib.SetGroupVariableValue(context, "challenge_active_93", pickCount)
ScriptLib.SetGroupVariableValue(context, "challenge_93", 0)
pickCount=ScriptLib.GetGroupVariableValue(context, "challenge_94")
ScriptLib.SetGroupVariableValue(context, "challenge_active_94", pickCount)
ScriptLib.SetGroupVariableValue(context, "challenge_94", 0)
pickCount=ScriptLib.GetGroupVariableValue(context, "challenge_95")
ScriptLib.SetGroupVariableValue(context, "challenge_active_95", pickCount)
ScriptLib.SetGroupVariableValue(context, "challenge_95", 0)
end
--重置卡牌效果
function Reset_Cards_Effect(context)
return 0
end
function add_ban_tag(context, prev_context, param1, param2, param3)
if param1<999 then
ScriptLib.SetGroupVariableValue(context, "ban_tag_1", param1)
end
if param2<999 then
ScriptLib.SetGroupVariableValue(context, "ban_tag_2", param2)
end
if param3<999 then
ScriptLib.SetGroupVariableValue(context, "ban_tag_3", param3)
end
return 0
end
function action_group_load(context, evt)
if defs.testMode==1 then
return 0
end
if defs.max_escapable_monsters~= nil then
ScriptLib.SetGroupVariableValue(context, "max_escapable_monsters", defs.max_escapable_monsters)
end
ScriptLib.SetGroupVariableValue(context, "wave_ptr", 1)
--随一套方案出来
math.randomseed(ScriptLib.GetServerTime(context))
local planNum=math.random(#challenge_programme)
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 随到的方案是:"..planNum)
ScriptLib.SetGroupVariableValue(context, "planNum", planNum)
--请求ban_tag_list
ScriptLib.ExecuteGroupLua(context, monster_group, "req_ban_tag", {planNum,defs.group_id})
local tag=ScriptLib.GetGroupVariableValue(context, "ban_tag_1")
local ban_list={}
if tag<999 then
ban_list[1]=tag
end
tag=ScriptLib.GetGroupVariableValue(context, "ban_tag_2")
if tag<999 then
ban_list[2]=tag
end
tag=ScriptLib.GetGroupVariableValue(context, "ban_tag_3")
if tag<999 then
ban_list[3]=tag
end
if 0~=ScriptLib.InitSceneMultistagePlay(context, 999, MultistagePlayType.Chess, {ban_card_tag_list=ban_list,rounds = #challenge_programme[planNum], init_building_points = defs.init_building_points or 200},ScriptLib.GetSceneUidList(context)) then
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : muitistage初始化失败")
else
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功设置muitistage|rounds="..#challenge_programme[planNum])
end
--迭代项
ScriptLib.ExecuteGroupLua(context, monster_group, "set_monster_preview", {defs.group_id,planNum})
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功设置怪物预览")
--设置怪物总数量
ScriptLib.ExecuteGroupLua(context, monster_group, "set_monster_number_req", {ScriptLib.GetGroupVariableValue(context, "wave_ptr")})
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功设置剩余怪物")
ScriptLib.SetSceneMultiStagePlayValues(context, 999, {round=ScriptLib.GetGroupVariableValue(context, "wave_ptr"),rounds=#challenge_programme[planNum],left_monsters=ScriptLib.GetGroupVariableValue(context, "left_monsters"),max_escapable_monsters=ScriptLib.GetGroupVariableValue(context, "max_escapable_monsters"),escaped_monsters=ScriptLib.GetGroupVariableValue(context, "escaped_monsters"),stage_bonus_building_points=0}, true)
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功设置显示参数|rounds="..#challenge_programme[planNum].."|left_monsters="..ScriptLib.GetGroupVariableValue(context, "left_monsters"))
ScriptLib.StartSceneMultiStagePlayStage(context, 999, defs.build_time or 123, Multistage.ChessBuild,"build"..ScriptLib.GetGroupVariableValue(context, "wave_ptr"),{})
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 成功开始挑战")
ScriptLib.ExecuteGroupLua(context, defs.gear_group_id, "Initialize_Fundations", {0})
add_route_guide_points(context)
ScriptLib.CreateGroupTimerEvent(context, defs.group_id, "reminder",5)
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : grouploadsuccess")
return 0
end
function action_START_REMINDER(context, evt)
ScriptLib.ShowReminder(context, 400025)
return 0
end
function action_add_route_points(context, evt)
add_route_guide_points(context)
ScriptLib.CreateGroupTimerEvent(context, defs.group_id, "route_points_delay", defs.route_guide_timer)
return 0
end
function add_route_guide_points(context)
local curPlanNumber=ScriptLib.GetGroupVariableValue(context, "planNum")
local curwave=ScriptLib.GetGroupVariableValue(context, "wave_ptr")
if challenge_programme[curPlanNumber][curwave].guide_routes ==nil then
ScriptLib.PrintContextLog(context, "## TD_LOG : Guide Routes Is Nil")
return 0
end
for i=1,#challenge_programme[curPlanNumber][curwave].guide_routes do
local idx=ScriptLib.GetGroupVariableValue(context, "route_guide_points_index")
if -2==ScriptLib.CreateGadgetByConfigIdByPos(context, guide_point_pool[idx], routes_start_point[challenge_programme[curPlanNumber][curwave].guide_routes[i]].start_point, { x = 0.000, y = 0.000, z = 0.000 }) then
ScriptLib.PrintContextLog(context, "## TD_LOG : Guide Points Not Enough")
return 0
end
ScriptLib.SetPlatformPointArray(context, guide_point_pool[idx], challenge_programme[curPlanNumber][curwave].guide_routes[i],routes_start_point[challenge_programme[curPlanNumber][curwave].guide_routes[i]].points, { route_type = 0 })
if idx >= #guide_point_pool then
idx=1
else
idx=idx+1
end
ScriptLib.SetGroupVariableValue(context, "route_guide_points_index", idx)
end
ScriptLib.CreateGroupTimerEvent(context, defs.group_id, "route_points_delay", defs.route_guide_timer)
return 0
end
function stop_route_guide_points(context)
ScriptLib.CancelGroupTimerEvent(context, defs.group_id, "route_points_delay")
ScriptLib.KillGroupEntity(context,{group_id=defs.group_id,gadgets=guide_point_pool})
return 0
end
function action_REACH_POINT(context,evt)
--ScriptLib.KillEntityByConfigId(context, { config_id = evt.param1 })
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, evt.param1, GadgetState.GearStart)
return 0
end
function del_monster_number(context, prev_context, param1, param2, param3)
local new_num=ScriptLib.GetGroupVariableValue(context, "left_monsters")
if new_num==0 then
return 0
end
new_num=new_num-1
ScriptLib.SetGroupVariableValue(context, "left_monsters", new_num)
ScriptLib.SetSceneMultiStagePlayValue(context, 999, "left_monsters",new_num, true)
return 0
end
function set_monster_number(context, prev_context, param1, param2, param3)
ScriptLib.SetGroupVariableValue(context, "left_monsters", param1)
return 0
end
--某group结束,进下一阶段
function tide_done(context, prev_context, param1, param2, param3)
local curPlanNumber=ScriptLib.GetGroupVariableValue(context, "planNum")
ScriptLib.EndSceneMultiStagePlayStage(context, 999,"battle"..ScriptLib.GetGroupVariableValue(context, "wave_ptr"), true)
local wave = ScriptLib.GetGroupVariableValue(context, "wave_ptr")
wave=wave+1
ScriptLib.SetGroupVariableValue(context, "wave_ptr", wave)
ScriptLib.PrintContextLog(context, "## wave = "..wave)
if wave > #challenge_programme[curPlanNumber] then
ScriptLib.EndSceneMultiStagePlay(context, 999, true)
ScriptLib.PrintContextLog(context, "## TD_LOG : All Wave Done")
--ScriptLib.CauseDungeonFail(context)
return 0
end
ScriptLib.CreateGroupTimerEvent(context, defs.group_id, "delay", 3)
Reset_Cards_Effect(context)
--ScriptLib.StartSceneMultiStagePlayStage(context, 999, 30, Multistage.MechanicusFlipCard,"card"..ScriptLib.GetGroupVariableValue(context, "wave_ptr"),{})
return 0
end
function action_END_DELAY(context, evt)
--ScriptLib.SetSceneMultiStagePlayValue(context, 999, "building_stage_seconds",defs.build_time or 123, true)
Set_Cards_Effect(context)
ScriptLib.ExecuteGroupLua(context, monster_group, "synchronization_card_num", {ScriptLib.GetGroupVariableValue(context, "challenge_active_93"),ScriptLib.GetGroupVariableValue(context, "challenge_active_94")})
--ScriptLib.SetSceneMultiStagePlayValue(context, 999, "round",ScriptLib.GetGroupVariableValue(context, "wave_ptr"), true)
add_route_guide_points(context)
ScriptLib.ExecuteGroupLua(context, monster_group, "set_monster_number_req", {ScriptLib.GetGroupVariableValue(context, "wave_ptr")})
ScriptLib.SetSceneMultiStagePlayValues(context, 999, {round=ScriptLib.GetGroupVariableValue(context, "wave_ptr"),rounds=#challenge_programme[ScriptLib.GetGroupVariableValue(context, "planNum")],left_monsters=ScriptLib.GetGroupVariableValue(context, "left_monsters"),max_escapable_monsters=ScriptLib.GetGroupVariableValue(context, "max_escapable_monsters"),escaped_monsters=ScriptLib.GetGroupVariableValue(context, "escaped_monsters"),stage_bonus_building_points=0}, true)
ScriptLib.StartSceneMultiStagePlayStage(context, 999, defs.build_time or 123, Multistage.ChessBuild,"build"..ScriptLib.GetGroupVariableValue(context, "wave_ptr"),{})
if defs.trapGroups~=nil then
for i=1,#defs.trapGroups do
ScriptLib.RefreshGroup(context, { group_id = defs.trapGroups[i], suite = 1, refresh_level_revise = 0, is_force_random_suite = false})
end
end
return 0
end
--怪物到达终点,涨分
function monster_escaped(context, prev_context, param1, param2, param3)
if ScriptLib.GetGroupVariableValue(context, "GM_Ignore_Monster_Escape") ~=0 then
return 0
end
local max_escapable_monsters=ScriptLib.GetGroupVariableValue(context, "max_escapable_monsters")
local escaped_monsters=ScriptLib.GetGroupVariableValue(context, "escaped_monsters")
if param1==1 then
escaped_monsters=escaped_monsters+1
ScriptLib.SetSceneMultiStagePlayValue(context, 999, "escaped_monsters",escaped_monsters, true)
if escaped_monsters>=max_escapable_monsters then
ScriptLib.EndSceneMultiStagePlay(context, 999, false)
return 0
end
ScriptLib.SetGroupVariableValue(context, "escaped_monsters", escaped_monsters)
return 0
end
escaped_monsters=escaped_monsters+1
escaped_monsters=escaped_monsters+ScriptLib.GetGroupVariableValue(context, "challenge_active_95")
ScriptLib.SetSceneMultiStagePlayValue(context, 999, "escaped_monsters",escaped_monsters, true)
if escaped_monsters>=max_escapable_monsters then
ScriptLib.EndSceneMultiStagePlay(context, 999, false)
return 0
end
ScriptLib.SetGroupVariableValue(context, "escaped_monsters", escaped_monsters)
return 0
end
function action_EVENT_SCENE_MULTISTAGE_PLAY_STAGE_END(context, evt)
if evt.param2==Multistage.ChessBuild then
stop_route_guide_points(context)
ScriptLib.ExecuteGroupLua(context, monster_group, "start_tide", {defs.group_id,ScriptLib.GetGroupVariableValue(context, "wave_ptr")})
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : 战斗阶段开始:"..ScriptLib.GetGroupVariableValue(context, "wave_ptr").."monstergroup="..monster_group)
ScriptLib.StartSceneMultiStagePlayStage(context, 999, 0, Multistage.ChessKill,"battle"..ScriptLib.GetGroupVariableValue(context, "wave_ptr"),{})
end
return 0
end
--tide_group_defs[ScriptLib.GetGroupVariableValue(context, "wave_ptr")].group
LF_Init_Challenge_Group()

View File

@@ -0,0 +1,118 @@
--[[
setmetatable(_ENV,{__index=function() return {} end })
--]]
local define = {
group_id = defs.group_id or 250030001,
gear_list = --[[defs.gear_list or]] {70350107,70350099,70350100,70350101,70350102,70350103,70350129,70350111,70350108},
option_list = --[[defs.option_list or]] {41,42,43,44,45,48,49,50,46},
option_revert = 46,
option_points = --[[defs.option_points or]] {20,20,20,20,20,20,20,20,20},
monster_points = defs.monster_points or 10,
max_points = defs.max_points or 100
}
local extraTriggers={
{ config_id = 8000001, name = "GROUP_LOAD", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_EVENT_GROUP_LOAD", trigger_count = 0},
{ config_id = 8000002, name = "GADGET_CREATE", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "", action = "action_GADGET_CREATE", trigger_count = 0},
{ config_id = 8000003, name = "GADGET_DIE", event = EventType.EVENT_ANY_GADGET_DIE, source = "", condition = "", action = "action_GADGET_DIE", trigger_count = 0},
{ config_id = 8000004, name = "SELECT_OPTION", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_EVENT_SELECT_OPTION", trigger_count = 0,forbid_guest = false },
{ config_id = 8000005,name = "TIMER_EVENT_CD", event = EventType.EVENT_TIMER_EVENT, source = "cd", condition = "", action = "action_USE_CD", trigger_count = 0 }
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables, { config_id=50000001,name = "gateway_one", value = 0})
table.insert(variables, { config_id=50000002,name = "gateway_two", value = 0})
table.insert(variables, { config_id=50000003,name = "use_cd", value = 0})
end
function action_USE_CD(context, evt)
ScriptLib.SetGroupVariableValue(context, "use_cd", 0)
return 0
end
function action_GADGET_CREATE(context, evt)
if evt.param2 == 70330045 then
if ScriptLib.GetGroupVariableValue(context, "gateway_one")==0 then
ScriptLib.SetGroupVariableValue(context, "gateway_one", evt.param1)
ScriptLib.SetWorktopOptionsByGroupId(context, 0, evt.param1, {4005})
return 0
elseif ScriptLib.GetGroupVariableValue(context, "gateway_two")==0 then
ScriptLib.SetGroupVariableValue(context, "gateway_two", evt.param1)
ScriptLib.SetWorktopOptionsByGroupId(context, 0, evt.param1, {4005})
return 0
end
end
return 0
end
function action_EVENT_SELECT_OPTION(context, evt)
if ScriptLib.GetGroupVariableValue(context, "use_cd")==1 then
ScriptLib.ShowReminder(context, 400027)
return 0
end
if evt.param1==ScriptLib.GetGroupVariableValue(context, "gateway_one") then
if (ScriptLib.GetGroupVariableValue(context, "gateway_one")==0) or (ScriptLib.GetGroupVariableValue(context, "gateway_two")==0) then
return 0
end
for i=1,#points do
if points[i].config_id==ScriptLib.GetGroupVariableValue(context, "gateway_two") then
ScriptLib.TransPlayerToPos(context, {uid_list ={context.uid}, pos = points[i].pos, radius = 2, rot = points[i].rot,is_skip_ui=false})
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, evt.param1, GadgetState.GearStart)
ScriptLib.SetGroupVariableValue(context, "use_cd", 1)
ScriptLib.CreateGroupTimerEvent(context, defs.group_id, "cd", 5)
return 0
end
end
elseif evt.param1==ScriptLib.GetGroupVariableValue(context, "gateway_two") then
if (ScriptLib.GetGroupVariableValue(context, "gateway_one")==0) or (ScriptLib.GetGroupVariableValue(context, "gateway_two")==0) then
return 0
end
for i=1,#points do
if points[i].config_id==ScriptLib.GetGroupVariableValue(context, "gateway_one") then
ScriptLib.TransPlayerToPos(context, {uid_list ={context.uid}, pos = points[i].pos, radius = 2, rot = points[i].rot,is_skip_ui=false})
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, evt.param1, GadgetState.GearStart)
ScriptLib.SetGroupVariableValue(context, "use_cd", 1)
ScriptLib.CreateGroupTimerEvent(context, defs.group_id, "cd", 5)
return 0
end
end
end
return 0
end
function action_GADGET_DIE(context, evt)
if evt.param1==ScriptLib.GetGroupVariableValue(context, "gateway_one") then
ScriptLib.SetGroupVariableValue(context, "gateway_one", 0)
return 0
elseif evt.param1==ScriptLib.GetGroupVariableValue(context, "gateway_two") then
ScriptLib.SetGroupVariableValue(context, "gateway_two", 0)
return 0
end
return 0
end
function action_EVENT_GROUP_LOAD(context, evt)
ScriptLib.PrintContextLog(context, "## ================ INITIALIZE FUNDATIONS ==============")
--Initialize_Fundations(context, evt)
return 0
end
function Initialize_Fundations(context, prev_context, param1, param2, param3)
local fundationTable={}
local uidList=ScriptLib.GetSceneUidList(context)
for i=1,math.min(#gadgets,#points) do
if gadgets[i].gadget_id == defs.fundation_id then
fundationTable[gadgets[i].config_id]=points[i].config_id
end
end
--ScriptLib.CreateFoundations(context, gadgets[i].config_id, points[i].config_id,defs.challange_group_id,999)
ScriptLib.CreateFoundations(context, fundationTable ,defs.challange_group_id,999)
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,962 @@
-----------------------
-----------------------
-------阵容配置---------
---------单路----------
-----------------------
-----------------------
--第一波
-----无属性阵容
wave01_noelement_oneway={
[1]={{monster_package={16001,16002,16003},count=30,max=5,min=5,route={1}}},
}
--第二波
-----无属性阵容
wave02_noelement_oneway={
[1]={{monster_package={16011},count=20,max=5,min=5,route={1}}},
}
-----冰属性阵容
wave02_ice_oneway={
[1]={{monster_package={16020},count=30,max=5,min=5,route={1}}},
}
-----火属性阵容
wave02_fire_oneway={
[1]={{monster_package={16017},count=10,max=5,min=5,route={1}}},
}
-----雷属性阵容
wave02_electricity_oneway={
[1]={{monster_package={16021},count=30,max=5,min=5,route={1}}},
}
--第三波
-----无属性阵容
wave03_noelement_oneway={
[1]={{monster_package={16033,16034,16035},count=20,max=5,min=5,route={1}}},
}
-----冰属性阵容
wave03_ice_oneway={
[1]={{monster_package={16031},count=30,max=5,min=5,route={1}}},
}
-----火属性阵容
wave03_fire_oneway={
[1]={{monster_package={16030},count=30,max=5,min=5,route={1}}},
}
-----雷属性阵容
wave03_electricity_oneway={
[1]={{monster_package={16032},count=30,max=5,min=5,route={1}}},
}
--第四波
-----无属性阵容
wave04_noelement_oneway={
[1]={{monster_package={16044,16045},count=30,max=5,min=5,route={1}}},
}
-----小宝
wave04_defender_oneway={
[1]={{monster_package={16043},count=3,max=1,min=1,route={1}}},
}
-----冰属性阵容
wave04_ice_oneway={
[1]={{monster_package={16042},count=30,max=5,min=5,route={1}}},
}
-----火属性阵容
wave04_fire_oneway={
[1]={{monster_package={16040},count=30,max=5,min=5,route={1}}},
}
-----雷属性阵容
wave04_electricity_oneway={
[1]={{monster_package={16041},count=30,max=5,min=5,route={1}}},
}
--第五波
--小宝输出校验几乎百搭所有炮台build
wave05_boss_defender_oneway={
[1]={{monster_package={16050},count=3,max=1,min=1,route={1}}},
}
--龙蜥:远程炮台,需要玩家提升炮台射程
wave05_boss_dragon_oneway={
[1]={{monster_package={16051},count=3,max=1,min=1,route={1}}},
}
--追猎者:需要玩家提升控制炮台的能力
wave05_boss_hunter_oneway={
[1]={{monster_package={16052},count=3,max=1,min=1,route={1}}},
}
--霜铠王:需要玩家提升对冰能力
wave05_boss_iceking_oneway={
[1]={{monster_package={16053},count=3,max=1,min=1,route={1}}},
}
--岩盔王:需要玩家提升对火能力、破岩能力
wave05_boss_rockking_oneway={
[1]={{monster_package={16054},count=3,max=1,min=1,route={1}}},
}
--雷暴王:需要玩家提升对雷能力
wave05_boss_electricking_oneway={
[1]={{monster_package={16055},count=3,max=1,min=1,route={1}}},
}
-----------------------
---------单路----------
-----------------------
-----无属性小宝阵容
local stage_defender_oneway={
[1]=wave01_noelement_oneway,
[2]=wave02_noelement_oneway,
[3]=wave03_noelement_oneway,
[4]=wave04_defender_oneway,
}
-----无属性龙蜥阵容
local stage_dragon_oneway={
[1]=wave01_noelement_oneway,
[2]=wave02_noelement_oneway,
[3]=wave03_noelement_oneway,
[4]=wave04_noelement_oneway,
[5]=wave05_boss_dragon_oneway,
}
-----无属性猎者阵容
local stage_hunter_oneway={
[1]=wave01_noelement_oneway,
[2]=wave02_noelement_oneway,
[3]=wave03_noelement_oneway,
[4]=wave04_noelement_oneway,
[5]=wave05_boss_hunter_oneway,
}
-----冰属性阵容
local stage_iceking_oneway={
[1]=wave01_noelement_oneway,
[2]=wave02_ice_oneway,
[3]=wave03_ice_oneway,
[4]=wave04_ice_oneway,
[5]=wave05_boss_iceking_oneway,
}
-----火属性阵容
local stage_rockking_oneway={
[1]=wave01_noelement_oneway,
[2]=wave02_fire_oneway,
[3]=wave03_fire_oneway,
[4]=wave04_fire_oneway,
[5]=wave05_boss_rockking_oneway,
}
-----雷属性阵容
local stage_electricking_oneway={
[1]=wave01_noelement_oneway,
[2]=wave02_electricity_oneway,
[3]=wave03_electricity_oneway,
[4]=wave04_electricity_oneway,
[5]=wave05_boss_electricking_oneway,
}
-----教学
local stage_teachstage_oneway={
[1]=wave01_noelement_oneway,
[2]=wave02_fire_oneway,
}
-----------------------
-----------------------
-------阵容配置---------
---------双路----------
-----------------------
-----------------------
--第一波
-----无属性阵容
wave01_noelement_twoway={
[1]={{monster_package={16001,16002,16003},count=15,max=5,min=5,route={1,2}}},
}
--第二波
-----无属性阵容
wave02_noelement_twoway={
[1]={{monster_package={16010,16011,16012,16013,16014,16015},count=15,max=5,min=5,route={1,2}}},
}
-----冰属性阵容
wave02_ice_twoway={
[1]={{monster_package={16020},count=15,max=5,min=5,route={1,2}}},
}
-----火属性阵容
wave02_fire_twoway={
[1]={{monster_package={16017},count=15,max=5,min=5,route={1,2}}},
}
-----雷属性阵容
wave02_electricity_twoway={
[1]={{monster_package={16021},count=15,max=5,min=5,route={1,2}}},
}
--第三波
-----无属性阵容
wave03_noelement_twoway={
[1]={{monster_package={16033,16034,16035},count=15,max=5,min=5,route={1,2}}},
}
-----冰属性阵容
wave03_ice_twoway={
[1]={{monster_package={16031},count=15,max=5,min=5,route={1,2}}},
}
-----火属性阵容
wave03_fire_twoway={
[1]={{monster_package={16030},count=15,max=5,min=5,route={1,2}}},
}
-----雷属性阵容
wave03_electricity_twoway={
[1]={{monster_package={16032},count=15,max=5,min=5,route={1,2}}},
}
-----[双色]雷属性阵容+冰属性阵容
wave03_electricity_ice_twoway={
[1]={{monster_package={16032},count=15,max=5,min=5,route={1}},{monster_package={16031},count=15,max=5,min=5,route={2} }},
}
-----[双色]雷属性阵容+火属性阵容
wave03_electricity_fire_twoway={
[1]={{monster_package={16032},count=15,max=5,min=5,route={1}},{monster_package={16030},count=15,max=5,min=5,route={2} }},
}
-----[双色]冰属性阵容+火属性阵容
wave03_ice_fire_twoway={
[1]={{monster_package={16031},count=15,max=5,min=5,route={1}},{monster_package={16030},count=15,max=5,min=5,route={2} }},
}
--第四波
-----无属性阵容
wave04_noelement_twoway={
[1]={{monster_package={16044,16045},count=15,max=5,min=5,route={1,2}}},
}
-----无属性阵容
wave04_defender_twoway={
[1]={{monster_package={16043},count=3,max=1,min=1,route={1,2}}},
}
-----冰属性阵容
wave04_ice_twoway={
[1]={{monster_package={16042},count=15,max=5,min=5,route={1,2}}},
}
-----火属性阵容
wave04_fire_twoway={
[1]={{monster_package={16040},count=15,max=5,min=5,route={1,2}}},
}
-----雷属性阵容
wave04_electricity_twoway={
[1]={{monster_package={16041},count=15,max=5,min=5,route={1,2}}},
}
-----[双色]雷属性阵容+冰属性阵容
wave04_electricity_ice_twoway={
[1]={{monster_package={16041},count=15,max=5,min=5,route={1}},{monster_package={16042},count=15,max=5,min=5,route={2} }},
}
-----[双色]雷属性阵容+火属性阵容
wave04_electricity_fire_twoway={
[1]={{monster_package={16041},count=15,max=5,min=5,route={1}},{monster_package={16040},count=15,max=5,min=5,route={2} }},
}
-----[双色]冰属性阵容+火属性阵容
wave04_ice_fire_twoway={
[1]={{monster_package={16042},count=15,max=5,min=5,route={1}},{monster_package={16040},count=15,max=5,min=5,route={2} }},
}
--第五波
--小宝输出校验几乎百搭所有炮台build
wave05_boss_defender_twoway={
[1]={{monster_package={16050},count=3,max=1,min=1,route={1,2}}},
}
--龙蜥:远程炮台,需要玩家提升炮台射程
wave05_boss_dragon_twoway={
[1]={{monster_package={16051},count=3,max=1,min=1,route={1,2}}},
}
--追猎者:需要玩家提升控制炮台的能力
wave05_boss_hunter_twoway={
[1]={{monster_package={16052},count=3,max=1,min=1,route={1,2}}},
}
--霜铠王:需要玩家提升对冰能力
wave05_boss_iceking_twoway={
[1]={{monster_package={16053},count=3,max=1,min=1,route={1,2}}},
}
--岩盔王:需要玩家提升对火能力、破岩能力
wave05_boss_rockking_twoway={
[1]={{monster_package={16054},count=3,max=1,min=1,route={1,2}}},
}
--雷暴王:需要玩家提升对雷能力
wave05_boss_electricking_twoway={
[1]={{monster_package={16055},count=3,max=1,min=1,route={1,2}}},
}
--[双色]雷暴王+霜铠王
wave05_boss_electricking_iceking_twoway={
[1]={{monster_package={16055},count=3,max=1,min=1,route={1}},{monster_package={16053},count=3,max=1,min=1,route={2}}},
}
--[双色]雷暴王+岩盔王
wave05_boss_electricking_rockking_twoway={
[1]={{monster_package={16055},count=3,max=1,min=1,route={1}},{monster_package={16054},count=3,max=1,min=1,route={2}}},
}
--[双色]霜铠王+岩盔王
wave05_boss_iceking_rockking_twoway={
[1]={{monster_package={16053},count=3,max=1,min=1,route={1}},{monster_package={16054},count=3,max=1,min=1,route={2}}},
}
--暴徒
wave05_boss_thug_twoway={
[1]={{monster_package={16056},count=15,max=5,min=5,route={1,2}}},
}
--雷暴王+小怪
wave05_boss_electricking_hil_twoway={
[1]={{monster_package={16057},count=10,max=5,min=5,route={1,2}}},
}
--岩盔王+小怪
wave05_boss_rockking_hil_twoway={
[1]={{monster_package={16058},count=10,max=5,min=5,route={1,2}}},
}
--霜铠王+小怪
wave05_boss_iceking_hil_twoway={
[1]={{monster_package={16059},count=10,max=5,min=5,route={1,2}}},
}
-----------------------
---------双路----------
-----------------------
-----无属性小宝阵容
local stage_defender_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_noelement_twoway,
[4]=wave04_defender_twoway,
[5]=wave05_boss_defender_twoway,
ban_card_tag_list={6,7},
}
-----无属性龙蜥阵容
local stage_dragon_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_noelement_twoway,
[4]=wave04_noelement_twoway,
[5]=wave05_boss_dragon_twoway,
ban_card_tag_list={1,4},
}
-----无属性猎者阵容
local stage_hunter_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_noelement_twoway,
[4]=wave04_noelement_twoway,
[5]=wave05_boss_hunter_twoway,
ban_card_tag_list={4,6},
}
-----冰属性阵容
local stage_iceking_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_ice_twoway,
[3]=wave03_ice_twoway,
[4]=wave04_ice_twoway,
[5]=wave05_boss_iceking_twoway,
ban_card_tag_list={1,3},
}
-----火属性阵容
local stage_rockking_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_fire_twoway,
[3]=wave03_fire_twoway,
[4]=wave04_fire_twoway,
[5]=wave05_boss_rockking_twoway,
ban_card_tag_list={2,5},
}
-----雷属性阵容
local stage_electricking_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_electricity_twoway,
[3]=wave03_electricity_twoway,
[4]=wave04_electricity_twoway,
[5]=wave05_boss_electricking_twoway,
ban_card_tag_list={1,5},
}
-----[双色]雷+冰属性阵容
local stage_electricking_iceking_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_electricity_ice_twoway,
[4]=wave04_electricity_ice_twoway,
[5]=wave05_boss_electricking_iceking_twoway,
ban_card_tag_list={1,4},
}
-----[双色]雷+火属性阵容
local stage_electricking_rockking_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_electricity_fire_twoway,
[4]=wave04_electricity_fire_twoway,
[5]=wave05_boss_electricking_rockking_twoway,
ban_card_tag_list={4,6},
}
-----[双色]冰+火属性阵容
local stage_iceking_rockking_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_ice_fire_twoway,
[4]=wave04_ice_fire_twoway,
[5]=wave05_boss_iceking_rockking_twoway,
ban_card_tag_list={5,6},
}
-----无属性暴徒阵容
local stage_thug_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_noelement_twoway,
[4]=wave04_noelement_twoway,
[5]=wave05_boss_thug_twoway,
ban_card_tag_list={1,5},
}
-----嘲讽雷暴王+小怪阵容
local stage_electricking_hil_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_noelement_twoway,
[4]=wave04_noelement_twoway,
[5]=wave05_boss_electricking_hil_twoway,
ban_card_tag_list={3,6},
}
-----嘲讽岩盔王+小怪阵容
local stage_rockking_hil_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_noelement_twoway,
[4]=wave04_noelement_twoway,
[5]=wave05_boss_rockking_hil_twoway,
ban_card_tag_list={1,4},
}
-----嘲讽霜铠王+小怪阵容
local stage_iceking_hil_twoway={
[1]=wave01_noelement_twoway,
[2]=wave02_noelement_twoway,
[3]=wave03_noelement_twoway,
[4]=wave04_noelement_twoway,
[5]=wave05_boss_iceking_hil_twoway,
ban_card_tag_list={1,3},
}
-----------------------
-----------------------
-------阵容配置---------
---------三路----------
-----------------------
-----------------------
--第一波
-----无属性阵容
wave01_noelement_threeway={
[1]={{monster_package={16001,16002,16003},count=10,max=5,min=5,route={1,2,3}}},
}
--第二波
-----无属性阵容
wave02_noelement_threeway={
[1]={{monster_package={16010,16011,16012,16013,16014,16015},count=10,max=5,min=5,route={1,2,3}}},
}
-----冰属性阵容
wave02_ice_threeway={
[1]={{monster_package={16020},count=10,max=5,min=5,route={1,2,3}}},
}
-----火属性阵容
wave02_fire_threeway={
[1]={{monster_package={16017},count=10,max=5,min=5,route={1,2,3}}},
}
-----雷属性阵容
wave02_electricity_threeway={
[1]={{monster_package={16021},count=10,max=5,min=5,route={1,2,3}}},
}
--第三波
-----无属性阵容
wave03_noelement_threeway={
[1]={{monster_package={16033,16034,16035},count=10,max=5,min=5,route={1,2,3}}},
}
-----冰属性阵容
wave03_ice_threeway={
[1]={{monster_package={16031},count=10,max=5,min=5,route={1,2,3}}},
}
-----火属性阵容
wave03_fire_threeway={
[1]={{monster_package={16030},count=10,max=5,min=5,route={1,2,3}}},
}
-----雷属性阵容
wave03_electricity_threeway={
[1]={{monster_package={16032},count=10,max=5,min=5,route={1,2,3}}},
}
--第四波
-----无属性阵容
wave04_noelement_threeway={
[1]={{monster_package={16044,16045},count=10,max=5,min=5,route={1,2,3}}},
}
-----无属性阵容
wave04_defender_threeway={
[1]={{monster_package={16043},count=2,max=1,min=1,route={1,2}},{monster_package={16043},count=2,max=1,min=1,route={3}}},
}
-----冰属性阵容
wave04_ice_threeway={
[1]={{monster_package={16042},count=10,max=5,min=5,route={1,2,3}}},
}
-----火属性阵容
wave04_fire_threeway={
[1]={{monster_package={16040},count=10,max=5,min=5,route={1,2,3}}},
}
-----雷属性阵容
wave04_electricity_threeway={
[1]={{monster_package={16041},count=10,max=5,min=5,route={1,2,3}}},
}
--第五波
--小宝输出校验几乎百搭所有炮台build
wave05_boss_defender_threeway={
[1]={{monster_package={16050},count=2,max=1,min=1,route={1,2,3}}},
}
--龙蜥:远程炮台,需要玩家提升炮台射程
wave05_boss_dragon_threeway={
[1]={{monster_package={16051},count=2,max=1,min=1,route={1,2,3}}},
}
--追猎者:需要玩家提升控制炮台的能力
wave05_boss_hunter_threeway={
[1]={{monster_package={16052},count=2,max=1,min=1,route={1,2,3}}},
}
--霜铠王:需要玩家提升对冰能力
wave05_boss_iceking_threeway={
[1]={{monster_package={16053},count=2,max=1,min=1,route={1,2,3}}},
}
--岩盔王:需要玩家提升对火能力、破岩能力
wave05_boss_rockking_threeway={
[1]={{monster_package={16054},count=2,max=1,min=1,route={1,2,3}}},
}
--雷暴王:需要玩家提升对雷能力
wave05_boss_electricking_threeway={
[1]={{monster_package={16055},count=2,max=1,min=1,route={1,2,3}}},
}
--[二色]霜铠王+雷暴王
wave05_boss_rockking_iceking_threeway={
[1]={{monster_package={16054},count=2,max=1,min=1,route={1}},{monster_package={16053},count=2,max=1,min=1,route={2}},{monster_package={16053},count=2,max=1,min=1,route={3}}},
}
--暴徒
wave05_boss_thug_threeway={
[1]={{monster_package={16056},count=10,max=5,min=5,route={1,2,3}}},
}
--雷暴王+小怪
wave05_boss_electricking_hil_threeway={
[1]={{monster_package={16057},count=6,max=4,min=4,route={1,2,3}}},
}
--岩盔王+小怪
wave05_boss_rockking_hil_threeway={
[1]={{monster_package={16058},count=6,max=4,min=4,route={1,2,3}}},
}
--霜铠王+小怪
wave05_boss_iceking_hil_threeway={
[1]={{monster_package={16059},count=6,max=4,min=4,route={1,2,3}}},
}
-----------------------
---------三路----------
-----------------------
-----无属性小宝阵容
local stage_defender_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_noelement_threeway,
[3]=wave03_noelement_threeway,
[4]=wave04_defender_threeway,
[5]=wave05_boss_defender_threeway,
ban_card_tag_list={6,7},
}
-----无属性龙蜥阵容
local stage_dragon_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_noelement_threeway,
[3]=wave03_noelement_threeway,
[4]=wave04_noelement_threeway,
[5]=wave05_boss_dragon_threeway,
ban_card_tag_list={1,4},
}
-----无属性猎者阵容
local stage_hunter_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_noelement_threeway,
[3]=wave03_noelement_threeway,
[4]=wave04_noelement_threeway,
[5]=wave05_boss_hunter_threeway,
ban_card_tag_list={4,6},
}
-----冰属性阵容
local stage_iceking_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_ice_threeway,
[3]=wave03_ice_threeway,
[4]=wave04_ice_threeway,
[5]=wave05_boss_iceking_threeway,
ban_card_tag_list={1,3},
}
-----火属性阵容
local stage_rockking_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_fire_threeway,
[3]=wave03_fire_threeway,
[4]=wave04_fire_threeway,
[5]=wave05_boss_rockking_threeway,
ban_card_tag_list={2,5},
}
-----雷属性阵容
local stage_electricking_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_electricity_threeway,
[3]=wave03_electricity_threeway,
[4]=wave04_electricity_threeway,
[5]=wave05_boss_electricking_threeway,
ban_card_tag_list={1,5},
}
-----[三色]火+冰属性阵容
local stage_iceking_rockking_electricking_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_noelement_threeway,
[3]=wave03_noelement_threeway,
[4]=wave04_noelement_threeway,
[5]=wave05_boss_rockking_iceking_threeway,
ban_card_tag_list={1,4},
}
-----无属性暴徒阵容
local stage_thug_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_noelement_threeway,
[3]=wave03_noelement_threeway,
[4]=wave04_noelement_threeway,
[5]=wave05_boss_thug_threeway,
ban_card_tag_list={1,5},
}
-----嘲讽雷暴王+小怪阵容
local stage_electricking_hil_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_noelement_threeway,
[3]=wave03_noelement_threeway,
[4]=wave04_noelement_threeway,
[5]=wave05_boss_electricking_hil_threeway,
ban_card_tag_list={3,6},
}
-----嘲讽岩盔王+小怪阵容
local stage_rockking_hil_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_noelement_threeway,
[3]=wave03_noelement_threeway,
[4]=wave04_noelement_threeway,
[5]=wave05_boss_rockking_hil_threeway,
ban_card_tag_list={1,4},
}
-----嘲讽霜铠王+小怪阵容
local stage_iceking_hil_threeway={
[1]=wave01_noelement_threeway,
[2]=wave02_noelement_threeway,
[3]=wave03_noelement_threeway,
[4]=wave04_noelement_threeway,
[5]=wave05_boss_iceking_hil_threeway,
ban_card_tag_list={1,3},
}
-----------------------
-----------------------
-------阵容配置---------
---------四路----------
-----------------------
-----------------------
--第一波
-----无属性阵容
wave01_noelement_fourway={
[1]={{monster_package={16001,16002,16003},count=10,max=5,min=5,route={1,2}},{monster_package={16001,16002,16003},count=5,max=2,min=2,route={3,4}}},
}
--第二波
-----无属性阵容
wave02_noelement_fourway={
[1]={{monster_package={16010,16011,16012,16013,16014,16015},count=10,max=5,min=5,route={1,2}},{monster_package={16010,16011,16012,16013,16014,16015},count=5,max=2,min=2,route={3,4}}},
}
-----冰属性阵容
wave02_ice_fourway={
[1]={{monster_package={16020},count=10,max=5,min=5,route={1,2}},{monster_package={16020},count=5,max=2,min=2,route={3,4}}},
}
-----火属性阵容
wave02_fire_fourway={
[1]={{monster_package={16017},count=10,max=5,min=5,route={1,2}},{monster_package={16017},count=5,max=2,min=2,route={3,4}}},
}
-----雷属性阵容
wave02_electricity_fourway={
[1]={{monster_package={16021},count=10,max=5,min=5,route={1,2}},{monster_package={16021},count=5,max=2,min=2,route={3,4}}},
}
-----[四色]冰+火属性阵容
wave02_ice_fire_fourway={
[1]={{monster_package={16020},count=10,max=5,min=5,route={1,2}},{monster_package={16017},count=5,max=2,min=2,route={3,4}}},
}
--第三波
-----无属性阵容
wave03_noelement_fourway={
[1]={{monster_package={16033,16034,16035},count=10,max=5,min=5,route={1,2}},{monster_package={16033,16034,16035},count=5,max=2,min=2,route={3,4}}},
}
-----冰属性阵容
wave03_ice_fourway={
[1]={{monster_package={16031},count=10,max=5,min=5,route={1,2}},{monster_package={16031},count=5,max=2,min=2,route={3,4}}},
}
-----火属性阵容
wave03_fire_fourway={
[1]={{monster_package={16030},count=10,max=5,min=5,route={1,2}},{monster_package={16030},count=5,max=2,min=2,route={3,4}}},
}
-----雷属性阵容
wave03_electricity_fourway={
[1]={{monster_package={16032},count=10,max=5,min=5,route={1,2}},{monster_package={16032},count=5,max=2,min=2,route={3,4}}},
}
-----[四色]冰+火属性阵容
wave03_ice_fire_fourway={
[1]={{monster_package={16031},count=10,max=5,min=5,route={1,2}},{monster_package={16030},count=5,max=2,min=2,route={3,4}}},
}
--第四波
-----无属性阵容
wave04_noelement_fourway={
[1]={{monster_package={16044,16045},count=10,max=5,min=5,route={1,2}},{monster_package={16044,16045},count=5,max=2,min=2,route={3,4}}},
}
-----无属性阵容
wave04_defender_fourway={
[1]={{monster_package={16043},count=2,max=1,min=1,route={1,2}},{monster_package={16043},count=2,max=1,min=1,route={3,4}}},
}
-----冰属性阵容
wave04_ice_fourway={
[1]={{monster_package={16042},count=10,max=5,min=5,route={1,2}},{monster_package={16042},count=5,max=2,min=2,route={3,4}}},
}
-----火属性阵容
wave04_fire_fourway={
[1]={{monster_package={16040},count=10,max=5,min=5,route={1,2}},{monster_package={16040},count=5,max=2,min=2,route={3,4}}},
}
-----雷属性阵容
wave04_electricity_fourway={
[1]={{monster_package={16041},count=10,max=5,min=5,route={1,2}},{monster_package={16041},count=5,max=2,min=2,route={3,4}}},
}
-----[四色]冰+火属性阵容
wave04_ice_fire_fourway={
[1]={{monster_package={16042},count=10,max=5,min=5,route={1,2}},{monster_package={16040},count=5,max=2,min=2,route={3,4}}},
}
--第五波
--小宝输出校验几乎百搭所有炮台build
wave05_boss_defender_fourway={
[1]={{monster_package={16050},count=2,max=1,min=1,route={1,2}},{monster_package={16050},count=2,max=1,min=1,route={3,4}}},
}
--龙蜥:远程炮台,需要玩家提升炮台射程
wave05_boss_dragon_fourway={
[1]={{monster_package={16051},count=2,max=1,min=1,route={1,2}},{monster_package={16051},count=2,max=1,min=1,route={3,4}}},
}
--追猎者:需要玩家提升控制炮台的能力
wave05_boss_hunter_fourway={
[1]={{monster_package={16052},count=2,max=1,min=1,route={1,2}},{monster_package={16052},count=2,max=1,min=1,route={3,4}}},
}
--霜铠王:需要玩家提升对冰能力
wave05_boss_iceking_fourway={
[1]={{monster_package={16053},count=2,max=1,min=1,route={1,2}},{monster_package={16053},count=2,max=1,min=1,route={3,4}}},
}
--岩盔王:需要玩家提升对火能力、破岩能力
wave05_boss_rockking_fourway={
[1]={{monster_package={16054},count=2,max=1,min=1,route={1,2}},{monster_package={16054},count=2,max=1,min=1,route={3,4}}},
}
--雷暴王:需要玩家提升对雷能力
wave05_boss_electricking_fourway={
[1]={{monster_package={16055},count=2,max=1,min=1,route={1,2}},{monster_package={16055},count=2,max=1,min=1,route={3,4}}},
}
-----[四色]霜铠王+岩盔王
wave05_boss_iceking_rockking_fourway={
[1]={{monster_package={16053},count=2,max=1,min=1,route={1,2}},{monster_package={16054},count=2,max=1,min=1,route={3,4}}},
}
-----------------------
---------四路----------
-----------------------
-----无属性小宝阵容
local stage_defender_fourway={
[1]=wave01_noelement_fourway,
[2]=wave02_noelement_fourway,
[3]=wave03_noelement_fourway,
[4]=wave04_defender_fourway,
[5]=wave05_boss_defender_fourway,
ban_card_tag_list={6,7},
}
-----无属性龙蜥阵容
local stage_dragon_fourway={
[1]=wave01_noelement_fourway,
[2]=wave02_noelement_fourway,
[3]=wave03_noelement_fourway,
[4]=wave04_noelement_fourway,
[5]=wave05_boss_dragon_fourway,
ban_card_tag_list={1,4},
}
-----无属性猎者阵容
local stage_hunter_fourway={
[1]=wave01_noelement_fourway,
[2]=wave02_noelement_fourway,
[3]=wave03_noelement_fourway,
[4]=wave04_noelement_fourway,
[5]=wave05_boss_hunter_fourway,
ban_card_tag_list={4,6},
}
-----冰属性阵容
local stage_iceking_fourway={
[1]=wave01_noelement_fourway,
[2]=wave02_ice_fourway,
[3]=wave03_ice_fourway,
[4]=wave04_ice_fourway,
[5]=wave05_boss_iceking_fourway,
ban_card_tag_list={1,3},
}
-----火属性阵容
local stage_rockking_fourway={
[1]=wave01_noelement_fourway,
[2]=wave02_fire_fourway,
[3]=wave03_fire_fourway,
[4]=wave04_fire_fourway,
[5]=wave05_boss_rockking_fourway,
ban_card_tag_list={2,5},
}
-----雷属性阵容
local stage_electricking_fourway={
[1]=wave01_noelement_fourway,
[2]=wave02_electricity_fourway,
[3]=wave03_electricity_fourway,
[4]=wave04_electricity_fourway,
[5]=wave05_boss_electricking_fourway,
ban_card_tag_list={1,5},
}
-----[四色]冰+火属性阵容
local stage_iceking_rockking_fourway={
[1]=wave01_noelement_fourway,
[2]=wave02_ice_fire_fourway,
[3]=wave03_ice_fire_fourway,
[4]=wave04_ice_fire_fourway,
[5]=wave05_boss_iceking_rockking_fourway,
ban_card_tag_list={4,5}
}

View File

@@ -0,0 +1,330 @@
--s1为空,s2往后自动引用为怪物潮
--[[
--怪物
--route_points配置默认值
--路径点的默认配置
local route_map={
[1]={route_points={1,2,3,4,5,6,7,8},tags=2},
[2]={route_points={1,2,3,4,5,6,7,8,9,10},tags=4}
}
local entrance_point_map={
[1]=2,
[2]=7,
[3]=8,
}
local entrance_map={
[2]=8,
[4]=9,
[8]=9
}
local exit_point_list={4,5}
--对应的刷怪策略
local monster_programme={
[1]=stage_defs_01,
[2]=stage_defs_02,
[3]=stage_defs_03,
}
--刷怪阶段对应的怪物波次
local stage_defs_01={
[1]=wave_01,
[2]=wave_05,
[3]=wave_06,
[4]=wave_02,
},
local stage_defs_02={
[1]=wave_01,
[2]=wave_02,
[3]=wave_03,
[4]=wave_04,
},
local stage_defs_03={
[1]=wave_01,
[2]=wave_02,
[3]=wave_03,
[4]=wave_04,
},
--每个波次的配置
local wave_01={
--[1]={monster_package={16002},route=1,route_points={1,2,3,4,5,6,7,8},tags=2,count=12,max=5,min=5}
--自定义配置项route_points,tags
[1]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[2]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[3]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[4]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
},
local wave_02={
[1]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[2]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[3]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[4]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
},
local wave_03={
[1]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[2]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[3]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[4]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
},
local wave_04={
[1]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[2]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[3]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
[4]={{monster_package=slime_package,count=12,route={1,2}},{monster_package=hili_package,route={1}}},
},
--史莱姆
slime_package={monster_package={16002,16004},max=5,min=5}
hili_package={monster_package={16002,16004},max=5,min=5}
]]--
function LF_Init_Monster_Group()
t1 = { config_id = 8000001, name = "monster_die", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "", action = "action_monster_die", trigger_count = 0 }
t2 = { config_id = 8000002,name = "TIMER_EVENT_DELAY", event = EventType.EVENT_TIMER_EVENT, source = "delay", condition = "", action = "action_END_DELAY", trigger_count = 0 }
t3 = { config_id = 8000003,name = "MONSTER_WILL_LEAVE_SCENE", event = EventType.EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE, source = "", condition = "", action = "action_MONSTER_DIE_BEFORE_LEAVE_SCENE", trigger_count = 0 }
t4 = { config_id = 8000004,name = "EVENT_ANY_MONSTER_LIVE", event = EventType.EVENT_ANY_MONSTER_LIVE, source = "", condition = "", action = "action_ANY_MONSTER_LIVE", trigger_count = 0 }
for i,v in ipairs(suites) do
table.insert(v.triggers, t1.name)
table.insert(v.triggers, t2.name)
table.insert(v.triggers, t3.name)
table.insert(v.triggers, t4.name)
end
table.insert(triggers, t1)
table.insert(triggers, t2)
table.insert(triggers, t3)
table.insert(triggers, t4)
table.insert(variables, { config_id=50000001,name = "tide_ptr", value = 0})
table.insert(variables, { config_id=50000002,name = "challenge_group", value = 0})
table.insert(variables, { config_id=50000003,name = "left_monsters", value = 0})
table.insert(variables, { config_id=50000004,name = "monster_tide_index", value = 1})
table.insert(variables, { config_id=50000005,name = "monster_kill_count", value = 0})
table.insert(variables, { config_id=50000006,name = "planNum", value = 1,no_refresh = true})
table.insert(variables, { config_id=50000007,name = "monster_wave_ptr", value = 1})
table.insert(variables, { config_id=50000008,name = "challenge_active_93", value = 0})
table.insert(variables, { config_id=50000009,name = "challenge_active_94", value = 0})
end
local gear_group_id = defs.gear_group_id or 0
function action_monster_die(context, evt)
ScriptLib.ExecuteGroupLua(context, ScriptLib.GetGroupVariableValue(context, "challenge_group"), "del_monster_number", {0})
local monster_kill_count=ScriptLib.GetGroupVariableValue(context, "monster_kill_count")
monster_kill_count=monster_kill_count+1
if monster_kill_count >= ScriptLib.GetGroupVariableValue(context, "left_monsters") then
monster_tide_over(context)
end
ScriptLib.SetGroupVariableValue(context, "monster_kill_count", monster_kill_count)
return 0
end
function action_ANY_MONSTER_LIVE(context, evt)
ScriptLib.SetEntityServerGlobalValueByConfigId(context,evt.param1, "SGV_TD_AdditionalHP_Layers", ScriptLib.GetGroupVariableValue(context, "challenge_active_93"))
ScriptLib.SetEntityServerGlobalValueByConfigId(context, evt.param1, "SGV_TD_AdditionalDefence_Layers", ScriptLib.GetGroupVariableValue(context, "challenge_active_94"))
return 0
end
function action_MONSTER_DIE_BEFORE_LEAVE_SCENE(context, evt)
local challenge_group=ScriptLib.GetGroupVariableValue(context, "challenge_group")
local stepValue = ScriptLib.GetMonsterAbilityFloatValue(context, defs.group_id, evt.param1, "GV_ExtraBuildPoint")
local stepValueMark = ScriptLib.GetMonsterAbilityFloatValue(context, defs.group_id, evt.param1, "GV_ExtraMarkBuildPoint")
local stepValueSum = stepValue + stepValueMark
if stepValueSum > 0 then
local uidList=ScriptLib.GetSceneUidList(context)
--local addScore=math.ceil(stepValue/#uidList)
for i=1,#uidList do
ScriptLib.AddChessBuildingPoints(context, challenge_group, 999, uidList[i], stepValueSum)
end
end
return 0
end
function MonsterArrive(context)
local entityId=context.target_entity_id
ScriptLib.PrintContextLog(context, "TowerDefenseMonsterArrive"..context.target_entity_id)
for k,v in pairs(points) do
if ScriptLib.GetEntityIdByConfigId(context, v.config_id)==entityId then
local affixList=ScriptLib.GetMonsterAffixListByConfigId(context,defs.group_id, v.config_id)
for i=1,#affixList do
if affixList[i]==4130 then
ScriptLib.ExecuteGroupLua(context, ScriptLib.GetGroupVariableValue(context, "challenge_group"), "monster_escaped", {1})
break
end
end
ScriptLib.ExecuteGroupLua(context, ScriptLib.GetGroupVariableValue(context, "challenge_group"), "monster_escaped", {0})
ScriptLib.ExecuteGroupLua(context, ScriptLib.GetGroupVariableValue(context, "challenge_group"), "del_monster_number", {0})
ScriptLib.RemoveEntityByConfigId(context, defs.group_id, EntityType.MONSTER, v.config_id)
local monster_kill_count=ScriptLib.GetGroupVariableValue(context, "monster_kill_count")
monster_kill_count=monster_kill_count+1
if monster_kill_count >= ScriptLib.GetGroupVariableValue(context, "left_monsters") then
monster_tide_over(context)
end
ScriptLib.SetGroupVariableValue(context, "monster_kill_count", monster_kill_count)
return 0
end
end
return 0
end
function set_monster_number_req(context, prev_context, param1, param2, param3)
local wave_ptr=param1
local monstersLeft=0
local planNumber=ScriptLib.GetGroupVariableValue(context, "planNum")
for i=1,#monster_programme[planNumber][wave_ptr] do
for j=1,#monster_programme[planNumber][wave_ptr][i] do
monstersLeft=monstersLeft+(monster_programme[planNumber][wave_ptr][i][j].count*#monster_programme[planNumber][wave_ptr][i][j].route)
end
end
ScriptLib.ExecuteGroupLua(context, ScriptLib.GetGroupVariableValue(context, "challenge_group"), "set_monster_number", {monstersLeft})
ScriptLib.SetGroupVariableValue(context, "left_monsters", monstersLeft)
return 0
end
function synchronization_card_num(context, prev_context, param1, param2, param3)
ScriptLib.SetGroupVariableValue(context, "challenge_active_93", param1)
ScriptLib.SetGroupVariableValue(context, "challenge_active_94", param2)
return 0
end
--启动此波的初始怪物潮
function start_tide(context, prev_context, param1, param2, param3)
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : start_tide"..param1.."|"..param2)
ScriptLib.SetGroupVariableValue(context, "monster_kill_count", 0)
ScriptLib.SetGroupVariableValue(context, "challenge_group", param1)
ScriptLib.SetGroupVariableValue(context, "monster_wave_ptr", param2)
local monster_pool_table=ScriptLib.GetChessMonsterPoolIdVecByRound(context, ScriptLib.GetGroupVariableValue(context, "challenge_group"), 999, ScriptLib.GetGroupVariableValue(context, "monster_wave_ptr"))
if #monster_pool_table==0 or monster_pool_table==nil then
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : monster_pool_table没取到")
else
for i=1,#monster_pool_table do
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : monster_pool_table="..monster_pool_table[i])
end
end
local affix={}
ScriptLib.SetGroupVariableValue(context, "tide_ptr", 1)
for i=1,#affix do
ScriptLib.PrintContextLog(context, "## TD_LOG : AFFIX TABLE"..affix[i])
end
local index=1
local curPlanNum=ScriptLib.GetGroupVariableValue(context, "planNum")
for i=1,#monster_programme[curPlanNum][param2][1] do
for j=1,#monster_programme[curPlanNum][param2][1][i].route do
ScriptLib.AutoPoolMonsterTide(context, index, defs.group_id, {monster_pool_table[index]},monster_programme[curPlanNum][param2][1][i].route[j], route_map[monster_programme[curPlanNum][param2][1][i].route[j]].route_points, affix, {total_count=monster_programme[curPlanNum][param2][1][i].count, min_count=monster_programme[curPlanNum][param2][1][i].min, max_count=monster_programme[curPlanNum][param2][1][i].max, tag=route_map[monster_programme[curPlanNum][param2][1][i].route[j]].tags,fill_time=5,fill_count=5})
index=index+1
end
end
ScriptLib.SetGroupVariableValue(context, "monster_tide_index", index)
return 0
end
--给主控提供ban_tag_list
function req_ban_tag(context, prev_context, param1, param2, param3)
local tag1=999
local tag2=999
local tag3=999
if monster_programme[param1].ban_card_tag_list~=nil then
if monster_programme[param1].ban_card_tag_list[1]~=nil then
tag1=monster_programme[param1].ban_card_tag_list[1]
end
if monster_programme[param1].ban_card_tag_list[2]~=nil then
tag2=monster_programme[param1].ban_card_tag_list[2]
end
if monster_programme[param1].ban_card_tag_list[3]~=nil then
tag3=monster_programme[param1].ban_card_tag_list[3]
end
end
ScriptLib.ExecuteGroupLua(context, param2, "add_ban_tag", {tag1,tag2,tag3})
return 0
end
--推送给主控怪物预览信息
function set_monster_preview(context, prev_context, param1, param2, param3)
--设置方案
ScriptLib.SetGroupVariableValue(context, "planNum", param2)
--设置挑战groupid
ScriptLib.SetGroupVariableValue(context, "challenge_group", param1)
math.randomseed(ScriptLib.GetServerTime(context))
local randomidx=0
local monster_preview_table={}
monster_preview_table.entrance_point_map=entrance_point_map
monster_preview_table.exit_point_id_list=exit_point_list
monster_preview_table.entrance_detail_list={}
--monster_preview_table.ban_card_tag_list={}
--if monster_programme[param2].ban_card_tag_list~=nil then
--monster_preview_table.ban_card_tag_list=monster_programme[param2].ban_card_tag_list
--end
--i,总阶段数j,每个阶段怪物波次数,k每一波的路数
for i=1,#monster_programme[param2] do
local currentRoundDetailList={round=i,pool_info_list={}}
for j=1,#monster_programme[param2][i] do
for k=1,#monster_programme[param2][i][j] do
randomidx=math.random(#monster_programme[param2][i][j][k].monster_package)
for n=1,#monster_programme[param2][i][j][k].route do
local tempTbl={pool_id=monster_programme[param2][i][j][k].monster_package[randomidx],entrance_point_id=entrance_map[route_map[monster_programme[param2][i][j][k].route[n]].tags]}
table.insert(currentRoundDetailList.pool_info_list,tempTbl)
end
end
end
table.insert(monster_preview_table.entrance_detail_list,currentRoundDetailList)
end
if 0~=ScriptLib.SetChessMystery(context, ScriptLib.GetGroupVariableValue(context, "challenge_group"), 999, monster_preview_table) then
ScriptLib.PrintContextLog(context, "## TD2.0_LOG : monster_pool_table设置失败:"..monster_preview_table.entrance_detail_list[1].round.."|"..monster_preview_table.entrance_detail_list[1].pool_info_list[1].pool_id.."|"..monster_preview_table.entrance_detail_list[1].pool_info_list[1].entrance_point_id)
end
return 0
end
function action_END_DELAY(context, evt)
local challenge_group = ScriptLib.GetGroupVariableValue(context, "challenge_group")
ScriptLib.PrintContextLog(context, "## challenge_group = "..challenge_group)
ScriptLib.ExecuteGroupLua(context, challenge_group, "tide_done", {0})
ScriptLib.PrintContextLog(context, "## TD_LOG : Group Monster Tide End -> "..defs.group_id)
return 0
end
function monster_tide_over(context)
local curPlanNum=ScriptLib.GetGroupVariableValue(context, "planNum")
local param2=ScriptLib.GetGroupVariableValue(context, "monster_wave_ptr")
ScriptLib.PrintContextLog(context, "## monster_tide_over")
local tide = ScriptLib.GetGroupVariableValue(context, "tide_ptr")
if tide >= #monster_programme[curPlanNum][param2] then
local challenge_group = ScriptLib.GetGroupVariableValue(context, "challenge_group")
ScriptLib.PrintContextLog(context, "## challenge_group = "..challenge_group)
ScriptLib.ExecuteGroupLua(context, challenge_group, "tide_done", {0})
ScriptLib.PrintContextLog(context, "## TD_LOG : Group Monster Tide End -> "..defs.group_id)
return 0
end
--tide自然结束,开启下一tide
tide = tide+1
local index=ScriptLib.GetGroupVariableValue(context, "monster_tide_index")
local monster_pool_table=ScriptLib.GetChessMonsterPoolIdVecByRound(context, ScriptLib.GetGroupVariableValue(context, "challenge_group"), 999, ScriptLib.GetGroupVariableValue(context, "monster_wave_ptr"))
local affix={}
for i=1,#monster_programme[curPlanNum][param2][tide] do
for j=1,#monster_programme[curPlanNum][param2][tide][i].route do
ScriptLib.AutoPoolMonsterTide(context, index, defs.group_id, {monster_pool_table[index]},monster_programme[curPlanNum][param2][tide][i].route[j], route_map[monster_programme[curPlanNum][param2][tide][i].route[j]].route_points, affix, {total_count=monster_programme[curPlanNum][param2][tide][i].count, min_count=monster_programme[curPlanNum][param2][tide][i].min, max_count=monster_programme[curPlanNum][param2][tide][i].max, tag=route_map[monster_programme[curPlanNum][param2][tide][i].route[j]].tags,fill_time=5,fill_count=5})
index=index+1
end
end
ScriptLib.SetGroupVariableValue(context, "monster_tide_index", index)
ScriptLib.SetGroupVariableValue(context, "tide_ptr", tide)
return 0
end
function fix_gear(context, prev_context, param1, param2, param3)
ScriptLib.ExecuteGroupLua(context, defs.gear_group_id, "fix_gear", {param1})
end
LF_Init_Monster_Group()

View File

@@ -0,0 +1,35 @@
local extraTriggers={
{ config_id = 8000001, name = "GROUP_LOAD", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_EVENT_GROUP_LOAD", trigger_count = 0 },
{ config_id = 8000002, name = "GENERAL_REWARD_TAKEN", event = EventType.EVENT_GENERAL_REWARD_TAKEN, source = "", condition = "", action = "action_EVENT_GENERAL_REWARD_TAKEN", trigger_count = 0 }
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables, { config_id=51100001,name = "Created", value = 0,no_refresh = true })
end
function action_EVENT_GROUP_LOAD(context, evt)
if ScriptLib.GetGroupVariableValue(context, "Created") == 0 then
ScriptLib.PrintContextLog(context,"DIG: DIG POINT GROUP LOADED")
for i=1,#gadgets do
if gadgets[i].gadget_id == 70220069 then
ScriptLib.CreateTreasureMapSpotRewardGadget(context, gadgets[i].config_id)
end
end
end
return 0
end
function action_EVENT_GENERAL_REWARD_TAKEN(context, evt)
ScriptLib.SetGroupVariableValue(context, "Created", 1)
ScriptLib.PrintContextLog(context,"DIG: AWARD HAS BEEN TAKEN")
return ScriptLib.CreateMonstersFromMonsterPool(context,"盗宝团")
end
LF_Initialize_Group(triggers, suites)