-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmode_attack_nevermore.lua
More file actions
51 lines (47 loc) · 1.32 KB
/
mode_attack_nevermore.lua
File metadata and controls
51 lines (47 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
local AttackUtil = require(GetScriptDirectory() .. "/lib/attack_util")
local GeometryUtil = require(GetScriptDirectory() .. "/lib/geometry_util")
function GetClosestEnemy(bot)
local enemies = bot:GetNearbyHeroes(1600, true, BOT_MODE_NONE)
local closestEnemy = nil
for _,enemy in pairs(enemies) do
if not closestEnemy or GetUnitToUnitDistance(enemy, bot) < GetUnitToUnitDistance(closestEnemy, bot) then
--print("Distance: "..GetUnitToUnitDistance(enemy, bot))
closestEnemy = enemy
end
end
return closestEnemy
end
function Think()
function f()
local bot = GetBot()
local enemy = GetClosestEnemy(bot)
if enemy then
print(enemy:GetMovementDirectionStability())
bot:Action_MoveToLocation(enemy:GetLocation() + enemy:GetExtrapolatedLocation(0.55) * enemy:GetMovementDirectionStability())
else
local shrine = GetShrine(GetTeam(), SHRINE_JUNGLE_1)
print(shrine:GetUnitName())
bot:Action_MoveToLocation(shrine:GetLocation())
end
end
local status, err = pcall(f)
if not status then
print(err)
end
end
function GetDesire()
local res = 0
function f()
local bot = GetBot()
local enemy = GetClosestEnemy(bot)
if enemy then
res = 1
end
end
local status,err = pcall(f)
if not status then
print(err)
end
return 0
--return res
end