【战斗】==========选择对位目标逻辑修改

dev_chengFeng
wangzhenxing 2021-03-30 17:17:10 +08:00
parent 9faf244e40
commit cda352d46e
1 changed files with 32 additions and 1 deletions

View File

@ -294,14 +294,45 @@ function this.GetAggroHero(role,arr)
local startPos = role.position
local targetList={}
startPos = startPos > 3 and startPos - 3 or startPos
local smallRole=nil
local smallPos=0
local bigRole=nil
local bigPos=0
for _, v in ipairs(arr) do
local pos= v.position>3 and v.position -3 or v.position
if pos==startPos then
table.insert(targetList,v)
break
elseif pos<startPos then
if smallRole then
if pos>smallPos then
smallRole=v
smallPos=pos
end
else
smallRole=v
smallPos=pos
end
elseif pos>startPos then
if bigRole then
if pos<bigPos then
bigRole=v
bigPos=pos
end
else
bigRole=v
bigPos=pos
end
end
end
if #targetList==0 then
table.insert(targetList,arr[1])
if smallRole then
table.insert(targetList,smallRole)
else
if bigRole then
table.insert(targetList,bigRole)
end
end
end
return targetList
end