【战斗】修复灵兽释放技能顺序错误

dev_chengFeng
gaoxin 2020-11-02 21:23:16 +08:00
parent 8b9276f6a2
commit 9779a99414
1 changed files with 18 additions and 2 deletions

View File

@ -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
-- 加入技能释放对列
-- 加入技能排序对列
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
end)
end
end