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