From 9779a99414f2da5fd0279f7f74201901740ba16d Mon Sep 17 00:00:00 2001 From: gaoxin Date: Mon, 2 Nov 2020 21:23:16 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=88=98=E6=96=97=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=81=B5=E5=85=BD=E9=87=8A=E6=94=BE=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Logic/Monster/MonsterSkill/MTrigger.lua | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MTrigger.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MTrigger.lua index c80e7e0afd..4bf2664d25 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MTrigger.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MTrigger.lua @@ -104,6 +104,8 @@ end function this.InitListener() for triggerId, config in pairs(_TriggerConfig) do BattleLogic.Event:AddEvent(config.event, function(...) + -- 用于排序 + local sortList = {} -- 判断是否有需要触发的技能 local triggerSkill = this.TriggerList[triggerId] if not triggerSkill then @@ -118,12 +120,26 @@ function this.InitListener() if config.triggerFunc(skill, ... ) then -- 检测是否符合子条件 if MCondition.CheckCondition(skill, condition) then - -- 加入技能释放对列 - SkillManager.AddMonsterSkill(skill) + -- 加入技能排序对列 + table.insert(sortList, skill) end end end end + -- 对技能进行排序 + table.sort(sortList, function(a, b) + -- 同阵营按位置排序 + if a.owner.camp == b.owner.camp then + return a.owner.position < b.owner.position + else + -- 不同阵营的根据先手阵营排序 + return a.owner.camp == BattleLogic.FirstCamp + end + end) + -- 依次加入技能管理 + for _, skill in ipairs(sortList) do + SkillManager.AddMonsterSkill(skill) + end end) end end