【战斗】==========选择对位目标逻辑修改
parent
9faf244e40
commit
cda352d46e
|
@ -294,14 +294,45 @@ function this.GetAggroHero(role,arr)
|
||||||
local startPos = role.position
|
local startPos = role.position
|
||||||
local targetList={}
|
local targetList={}
|
||||||
startPos = startPos > 3 and startPos - 3 or startPos
|
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
|
for _, v in ipairs(arr) do
|
||||||
local pos= v.position>3 and v.position -3 or v.position
|
local pos= v.position>3 and v.position -3 or v.position
|
||||||
if pos==startPos then
|
if pos==startPos then
|
||||||
table.insert(targetList,v)
|
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
|
||||||
end
|
end
|
||||||
if #targetList==0 then
|
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
|
end
|
||||||
return targetList
|
return targetList
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue