forked from weepoko/scripts-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleDariusRelease.lua
More file actions
148 lines (132 loc) · 3.98 KB
/
Copy pathSimpleDariusRelease.lua
File metadata and controls
148 lines (132 loc) · 3.98 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
if myHero.charName ~= "Darius" then return end
------------------- ONLY COMBO WITH ORBWALK
local version = "0.1"
local myPlayer = GetMyHero()
local Target = nil
local lastAttack = 0
local lastWindUpTime = 0
local lastAttackCD = 0
-------------------
local function MenuCombo()
menu:addSubMenu("[Combo Settings]", "combo")
menu.combo:addParam("q", "Use (Q) in Combo", SCRIPT_PARAM_ONOFF, true)
menu.combo:addParam("w", "Use (W) in Combo", SCRIPT_PARAM_ONOFF, true)
menu.combo:addParam("e", "Use (E) in Combo", SCRIPT_PARAM_ONOFF, true)
menu.combo:addParam("r", "Use (R) in Combo", SCRIPT_PARAM_ONOFF, true)
menu.combo:addParam("key", "Combo key", SCRIPT_PARAM_ONKEYDOWN, false, 32)
end
function OnLoad()
menu = scriptConfig("Darius by Jus", "DariusJus")
MenuCombo() -- Combo Settings
end
local function CastQ(myTarget)
if GetDistance(myTarget) <= 425 then
CastSpell(_Q)
end
end
local function CastW(myTarget)
if GetDistance(myTarget) <= myPlayer.range then
CastSpell(_W)
end
end
local function CastE(myTarget)
if GetDistance(myTarget) <= 540 then
CastSpell(_E, myTarget.x, myTarget.z)
end
end
local function CastR(myTarget)
local rDmg = getDmg("R", myTarget, myPlayer)
if GetDistance(myTarget) <= 460 and myTarget.health <= rDmg then
CastSpell(_R, myTarget)
end
end
function Combo(myTarget)
if ValidTarget(myTarget) then
CastQ(myTarget)
CastW(myTarget)
CastE(myTarget)
CastR(myTarget)
end
OrbWalk(myTarget)
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) >= 260 then
local moveToPos = myPlayer + (Vector(mousePos) - myPlayer):normalized()* 260
myPlayer:MoveTo(moveToPos.x, moveToPos.z)
end
end
function OnProcessSpell(unit, spell)
if unit.isMe then
if spell.name:lower():find("attack") then
--[[orbwalk]]
lastAttack = GetTickCount() - GetLatency() / 2
lastWindUpTime = spell.windUpTime * 1000
lastAttackCD = spell.animationTime * 1000
end
end
end
function OrbWalk(myTarget)
if ValidTarget(myTarget) and GetDistance(myTarget) <= myPlayer.range then
if timeToShoot() then
myPlayer:Attack(myTarget)
elseif heroCanMove() then
moveToCursor()
end
else
moveToCursor()
end
end
local function GetMyTarget()
local selectedTarget = GetTarget()
local Found = false
local inimigos = nil
local Enemy = nil
local finalTarget = nil
if range_ == 0 then range_ = 850 end
if ValidTarget(selectedTarget) and selectedTarget.type == myPlayer.type then
return selectedTarget
end
if not selectedTarget then
inimigos = GetEnemyHeroes()
for i, Enemy in pairs(inimigos) do
local basedmg = 100
local myDmg = (myPlayer:CalcDamage(Enemy, 200) or 0)
if ValidTarget(Enemy) and GetDistance(Enemy) <= 800 then
local finalDmg = Enemy.health / myDmg
if finalDmg < basedmg then
Found = true
return Enemy
end
else
Found = false
end
end
end
if not selectedTarget and not Found then
local mouseTarget = nil
inimigos = GetEnemyHeroes()
for i, Enemy in pairs(inimigos) do
local distancMouse = GetDistance(mousePos, Enemy)
if ValidTarget(Enemy) and distancMouse <= 150 then
return Enemy
end
end
end
finalTarget = selectedTarget or Enemy
return finalTarget
end
function OnTick()
local RealTarget = nil
local ComboOn = menu.combo.key
Target = GetMyTarget()
if ValidTarget(Target) and Target.type == myPlayer.type then
RealTarget = Target
end
if ComboOn then Combo(RealTarget) end
end