forked from BilbaoGotoxy/BoL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SimpleOrbwalker.lua
52 lines (44 loc) · 1.16 KB
/
SimpleOrbwalker.lua
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
52
-------Orbwalk info-------
local lastAttack, lastWindUpTime, lastAttackCD = 0, 0, 0
local myTrueRange = 0
local myTarget = nil
-------/Orbwalk info-------
function OnLoad()
myTrueRange = myHero.range + GetDistance(myHero.minBBox)
end
function OnTick()
_OrbWalk()
end
function OnProcessSpell(object, spell)
if object == myHero then
if spell.name:lower():find("attack") then
lastAttack = GetTickCount() - GetLatency()/2
lastWindUpTime = spell.windUpTime*1000
lastAttackCD = spell.animationTime*1000
end
end
end
function _OrbWalk()
myTarget = GetTarget()
if myTarget ~=nil and GetDistance(myTarget ) <= myTrueRange then
if timeToShoot() then
myHero:Attack(myTarget )
elseif heroCanMove() then
moveToCursor()
end
else
moveToCursor()
end
end
function heroCanMove()
return (GetTickCount() + GetLatency()/2 > lastAttack + lastWindUpTime + 20)
end
function timeToShoot()
return (GetTickCount() + GetLatency()/2 > lastAttack + lastAttackCD)
end
function moveToCursor()
if GetDistance(mousePos) > 1 then
local moveToPos = myHero + (Vector(mousePos) - myHero):normalized()*300
myHero:MoveTo(moveToPos.x, moveToPos.z)
end
end