forked from Dienofail/BoL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lucian.lua
754 lines (656 loc) · 23.4 KB
/
Lucian.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
local version = "1.14"
--[[
Free Lucian!
by Dienofail
Changelog:
v0.01 - release
v0.02 - Fixed farm toggles
v0.03 - Fixes to W usage
v0.04 - Now should reset properly
v0.05 - Bug fixes
v0.06 - Fixes to spellweave
v0.07 - Further fixes to spellweave
v0.08 - Github
v0.09 - Moved minion update to Q function
v1.00 - Fixed spellweaving logic a bit, fixed SAC compatibility, added killsteal, improved minion Q cast
v1.01 - Futher fixes to spellweaving
v1.02 - Added mana manager
v1.03 - Sepearated mana manager for harass and combo
v1.04 - Rewrote all of spellweave
v1.05 - Changed minion collision for Q a bit
v1.06 - Minor fixes to Q farm
v1.07 - Minor fixes to Q target selection
v1.08 - Fixes to aa canceling
v1.09 - Fixes to autoupdater
v1.10 - Fixes to spellweaving
v1.11 - Q range adjustment
v1.12 - Turned collision for W off
v1.13 - Fixed harass mana manager
v1.14 - SoW
]]
if myHero.charName ~= "Lucian" then return end
require 'VPrediction'
--Honda7
local AUTOUPDATE= true
local UPDATE_SCRIPT_NAME = "Lucian"
local UPDATE_NAME = "Lucian"
local UPDATE_HOST = "raw.github.com"
local UPDATE_PATH = "/Dienofail/BoL/master/Lucian.lua".."?rand="..math.random(1,10000)
local UPDATE_FILE_PATH = SCRIPT_PATH..GetCurrentEnv().FILE_NAME
local UPDATE_URL = "https://"..UPDATE_HOST..UPDATE_PATH
function AutoupdaterMsg(msg) print("<font color=\"#6699ff\"><b>"..UPDATE_NAME..":</b></font> <font color=\"#FFFFFF\">"..msg..".</font>") end
if AUTOUPDATE then
local ServerData = GetWebResult(UPDATE_HOST, UPDATE_PATH, "", 5)
if ServerData then
local ServerVersion = string.match(ServerData, "local version = \"%d+.%d+\"")
ServerVersion = string.match(ServerVersion and ServerVersion or "", "%d+.%d+")
if ServerVersion then
ServerVersion = tonumber(ServerVersion)
if tonumber(version) < ServerVersion then
AutoupdaterMsg("New version available"..ServerVersion)
AutoupdaterMsg("Updating, please don't press F9")
DownloadFile(UPDATE_URL, UPDATE_FILE_PATH, function () AutoupdaterMsg("Successfully updated. ("..version.." => "..ServerVersion.."), press F9 twice to load the updated version.") end)
else
AutoupdaterMsg("You have got the latest version ("..ServerVersion..")")
end
end
else
AutoupdaterMsg("Error downloading version info")
end
end
--end Honda7
local Config = nil
local VP = VPrediction()
local SpellQ = {Speed = math.huge, Range = 585, Delay = 0.320, Width = 65, ExtendedRange = 1100}
local SpellW = {Speed = 1600, Range = 1000, Delay = 0.300, Width = 55}
local SpellR = {Range = 1400, Width = 110, Speed = 2800, Delay= 0}
local QReady, WReady, EReady, RReady = nil, nil, nil, nil
local RObject = nil
local REndPos = nil
local rendname = 'lucianrdisable'
local isBuffed = false
local LastSpellCast = 0
local isPressedR = false
local target = nil
local lastAttack = 0
local lastWindUpTime = 0
local lastAttackCD = 0
local animation_time = 0
function OnLoad()
DelayAction(checkOrbwalker,2)
DelayAction(Menu,4)
DelayAction(Init,4)
end
function Init()
ts = TargetSelector(TARGET_LESS_CAST_PRIORITY, 1100, DAMAGE_PHYSICAL)
ts.name = "Ranged Main"
Config:addTS(ts)
EnemyMinions = minionManager(MINION_ENEMY, 1100, myHero, MINION_SORT_MAXHEALTH_DEC)
-- print('Dienofail Lucian ' .. tostring(version) .. ' loaded!')
-- if _G.MMA_Loaded then
-- print('MMA detected, using MMA compatibility')
-- elseif _G.AutoCarry.Orbwalker then
-- print('SAC detected, using SAC compatibility')
-- end
initDone = true
end
function checkOrbwalker()
if _G.MMA_Loaded ~= nil and _G.MMA_Loaded then
IsMMALoaded = true
print('MMA detected')
elseif _G.AutoCarry then
IsSACLoaded = true
print('SAC detected')
elseif FileExist(LIB_PATH .."SOW.lua") then
require "SOW"
SOWi = SOW(VP)
IsSowLoaded = true
SOWi:RegisterAfterAttackCallback(AutoAttackReset)
print('SOW loaded')
else
print('Please use SAC, MMA, or SOW for your orbwalker')
end
end
function Menu()
Config = scriptConfig("Lucian", "Lucian")
Config:addParam("Combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
Config:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('C'))
Config:addParam("Farm", "Farm", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('V'))
Config:addSubMenu("Combo options", "ComboSub")
Config:addSubMenu("Harass options", "HarassSub")
Config:addSubMenu("Farm", "FarmSub")
Config:addSubMenu("KS", "KS")
Config:addSubMenu("Extra Config", "Extras")
Config:addSubMenu("Draw", "Draw")
--Combo
Config.ComboSub:addParam("useQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("useW", "Use W", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("lockR", "Lock on R (not functional)", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("mManager", "Mana Slider", SCRIPT_PARAM_SLICE, 0, 0, 100, 0)
--Harass
Config.HarassSub:addParam("useQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
Config.HarassSub:addParam("useW", "Use W", SCRIPT_PARAM_ONOFF, false)
Config.HarassSub:addParam("mManager", "Mana Slider", SCRIPT_PARAM_SLICE, 0, 0, 100, 0)
--Farm
Config.FarmSub:addParam("useQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
Config.FarmSub:addParam("useW", "Use W", SCRIPT_PARAM_ONOFF, true)
--Draw
Config.Draw:addParam("DrawQ", "Draw Q Range", SCRIPT_PARAM_ONOFF, true)
Config.Draw:addParam("DrawW", "Draw W Range", SCRIPT_PARAM_ONOFF, true)
--Extras
Config.Extras:addParam("Debug", "Debug", SCRIPT_PARAM_ONOFF, false)
Config.Extras:addParam("ExtendE", "Extend E to mouse direction", SCRIPT_PARAM_ONOFF, true)
Config.Extras:addParam("ESlows", "E Slows", SCRIPT_PARAM_ONOFF, true)
Config.Extras:addParam("CheckQ", "Check Q Using Minions", SCRIPT_PARAM_ONOFF, true)
Config.Extras:addParam("AoEQ", "Check AoE Q", SCRIPT_PARAM_ONOFF, true)
--Permashow
Config:permaShow("Combo")
Config:permaShow("Farm")
Config:permaShow("Harass")
if IsSowLoaded then
Config:addSubMenu("Orbwalker", "SOWiorb")
SOWi:LoadToMenu(Config.SOWiorb)
end
end
function IsMyManaLow()
if myHero.mana < (myHero.maxMana * ( Config.ComboSub.mManager / 100)) then
return true
else
return false
end
end
function IsMyManaLowHarass()
if myHero.mana < (myHero.maxMana * ( Config.HarassSub.mManager / 100)) then
return true
else
return false
end
end
--Credit Trees
function GetCustomTarget()
ts:update()
if _G.MMA_Target and _G.MMA_Target.type == myHero.type then return _G.MMA_Target end
if _G.AutoCarry and _G.AutoCarry.Crosshair and _G.AutoCarry.Attack_Crosshair and _G.AutoCarry.Attack_Crosshair.target and _G.AutoCarry.Attack_Crosshair.target.type == myHero.type then return _G.AutoCarry.Attack_Crosshair.target end
return ts.target
end
--End Credit Trees
function OnTick()
if initDone then
Check()
target = GetCustomTarget()
Qtarget = ts.target
if Config.Combo and Qtarget ~= nil then
Combo(Qtarget)
end
if Config.Harass and Qtarget ~= nil then
Harass(Qtarget)
end
if Config.Farm then
Farm()
end
end
end
function OnWndMsg(msg,key)
if key == string.byte("E") and msg == KEY_DOWN and EReady and Config.Extras.ExtendE then
-- mark Q key is release
if Config.Extras.Debug then
print('E key override enabled')
end
CastE()
end
end
function Combo(Target)
if QReady and Config.ComboSub.useQ and not IsMyManaLow() and GetDistance(Target) > 580 + VP:GetHitBox(Target) then
-- if Config.Extras.Debug then
-- print('Cast Q called')
-- end
CastQ(Target)
end
if WReady and Config.ComboSub.useW and not IsMyManaLow() and GetDistance(Target) > 580 + VP:GetHitBox(Target) then
CastW(Target)
end
if isPressedR and Config.ComboSub.lockR then
--LockR(Target)
end
end
function Harass(Target)
if QReady and Config.HarassSub.useQ and not IsMyManaLowHarass() and GetDistance(Target) > 580 + VP:GetHitBox(Target) then
CastQ(Target)
end
if WReady and Config.HarassSub.useW and not IsMyManaLowHarass() and GetDistance(Target) > 580 + VP:GetHitBox(Target) then
CastW(Target)
end
end
function CastQ(Target)
EnemyMinions:update()
if Config.Extras.Debug then
print('CastQ called')
end
-- print(CountEnemyNearPerson(Target,800))
-- print(ValidTarget(Target, 1300))
if ValidTarget(Target, 1300) and not Target.dead and GetDistance(Target) > 550 + VP:GetHitBox(Target) and GetDistance(Target) < SpellQ.ExtendedRange then
local CastPosition = FindBestCastPosition(Target)
if CastPosition ~= nil and GetDistance(CastPosition) < SpellQ.Range + 100 then
CastSpell(_Q, CastPosition)
if Config.Extras.Debug then
print('CastQ casted')
end
end
-- if Config.Extras.Debug then
-- print('Returning CastQ2')
-- end
--elseif ValidTarget(Target, 1300) and not Target.dead and GetDistance(Target) < 550 + VP:GetHitBox(Target) and ShouldCast(Target) then
elseif ValidTarget(Target, 1300) and not Target.dead and GetDistance(Target) < 550 + VP:GetHitBox(Target) then
-- if Config.Extras.Debug then
-- print('Returning CastQ1')
-- end
CastSpell(_Q, Target)
if Config.Extras.Debug then
print('CastQ casted')
end
end
end
function LockR(Target)
if isPressedR then
local _, _, TargetPos = VP:GetLineCastPosition(enemy, SpellR.Delay, SpellR.Width, SpellR.Range, SpellR.Speed, myHero, false)
local UnitVector1 = Vector(myHero) + Vector(REndPos):perpendicular()*650
local UnitVector2 = Vector(myHero) + Vector(REndPos):perpendicular2()*650
local pointSegment1, pointLine1, isOnSegment = VectorPointProjectionOnLineSegment(Vector(myHero), Vector(UnitVector1), Vector(TargetPos))
local pointSegment2, pointLine2, isOnSegment2 = VectorPointProjectionOnLineSegment(Vector(myHero), Vector(UnitVector1), Vector(TargetPos))
local pointSegment13D = {x=pointSegment1.x, y= myHero.y, z=pointSegment1.y}
local pointSegment23D = {x=pointSegment2.x, y= myHero.y, z=pointSegment2.y}
if GetDistance(pointLine23D) >= GetDistance(pointLine13D) then
OrbwalkToPosition(pointLine13D)
else
OrbwalkToPosition(pointLine23D)
end
else
OrbwalkToPosition(nil)
end
end
function CastE()
if EReady then
local CastPoint = Vector(myHero) + Vector(Vector(mousePos) - Vector(myHero)):normalized()*445
CastSpell(_E, CastPoint.x, CastPoint.z)
end
end
function CastW(Target)
if WReady then
local CastPoint, HitChance, pos = VP:GetCircularCastPosition(Target, SpellW.Delay, SpellW.Width, SpellW.Range, SpellW.Speed, myHero, false)
if GetDistance(CastPoint) < SpellW.Range and HitChance >= 1 then
CastSpell(_W, CastPoint.x, CastPoint.z)
end
end
end
function OnAnimation(unit, animation)
if unit.isMe and animation:lower():find("attack") and target ~= nil then
if Config.Extras.Debug then
print(animation)
end
--[[
if (Config.Combo or Config.Harass) and ((Config.ComboSub.useQ or Config.HarassSub.useQ) and QReady) and target.type == myHero.type and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLow() then
DelayAction(function() CastQ(target) end, animation_time + 0.1)
if Config.Extras.Debug then
print('QChained')
end
elseif (Config.Combo or Config.Harass) and ((Config.ComboSub.useW or Config.HarassSub.useW) and WReady) and target.type == myHero.type and not QReady and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLow() then
DelayAction(function() CastW(target) end, animation_time + 0.1)
if Config.Extras.Debug then
print('WChained')
end
end
]]
if Config.Combo then
if (Config.ComboSub.useQ and QReady) and target.type == myHero.type and not isBuffed and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLow() then -- Q combo
DelayAction(function() CastQ(target) end, animation_time + 0.1)
if Config.Extras.Debug then
print('QChainedCombo')
end
elseif (Config.ComboSub.useW and WReady) and target.type == myHero.type and not isBuffed and not QReady and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLow() then -- W combo
DelayAction(function() CastW(target) end, animation_time + 0.1)
if Config.Extras.Debug then
print('WChainedCombo')
end
end
elseif Config.Harass then
if (Config.HarassSub.useQ and QReady) and target.type == myHero.type and not isBuffed and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLowHarass() then -- Q Harass
DelayAction(function() CastQ(target) end, animation_time + 0.1)
if Config.Extras.Debug then
print('QChainedHarass')
end
elseif (Config.HarassSub.useW and WReady) and target.type == myHero.type and not isBuffed and not QReady and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLowHarass() then -- W Harass
DelayAction(function() CastW(target) end, animation_time + 0.1)
if Config.Extras.Debug then
print('WChainedHarass')
end
end
end
end
end
function AutoAttackReset()
if target ~= nil and IsSowLoaded then
if Config.Combo then
if (Config.ComboSub.useQ and QReady) and target.type == myHero.type and not isBuffed and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLow() then -- Q combo
CastQ(target)
if Config.Extras.Debug then
print('QChainedCombo')
end
elseif (Config.ComboSub.useW and WReady) and target.type == myHero.type and not isBuffed and not QReady and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLow() then -- W combo
CastW(target)
if Config.Extras.Debug then
print('WChainedCombo')
end
end
elseif Config.Harass then
if (Config.HarassSub.useQ and QReady) and target.type == myHero.type and not isBuffed and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLowHarass() then -- Q Harass
CastQ(target)
if Config.Extras.Debug then
print('QChainedHarass')
end
elseif (Config.HarassSub.useW and WReady) and target.type == myHero.type and not isBuffed and not QReady and target ~= nil and GetDistance(target) < 550 + VP:GetHitBox(target) + 50 and not IsMyManaLowHarass() then -- W Harass
CastW(target)
if Config.Extras.Debug then
print('WChainedHarass')
end
end
end
end
end
function Farm()
EnemyMinions:update()
if Config.FarmSub.useQ then
FarmQ()
end
if Config.FarmSub.useW then
FarmW()
end
end
function GetEnemiesHitByQ(startpos, endpos)
if startpos ~= nil and endpos ~= nil then
local count = 0
local HitMainTarget = false
local Enemies = GetEnemyHeroes()
--print(endpos)
local realendpos = Vector(myHero) + Vector(Vector(endpos)-Vector(myHero)):normalized()*SpellQ.ExtendedRange
if Config.Extras.Debug then
print('Printing realendpos')
print(realendpos)
end
for idx, enemy in ipairs(Enemies) do
if enemy ~= nil and ValidTarget(enemy, 1600) and not enemy.dead and GetDistance(enemy, startpos) < SpellQ.ExtendedRange then
local throwaway, HitChance, PredictedPos = VP:GetLineCastPosition(enemy, SpellQ.Delay, SpellQ.Width, SpellQ.ExtendedRange, SpellQ.Speed, myHero, false)
local pointSegment, pointLine, isOnSegment = VectorPointProjectionOnLineSegment(Vector(startpos), Vector(realendpos), Vector(PredictedPos))
local pointSegment3D = {x=pointSegment.x, y=enemy.y, z=pointSegment.y}
if isOnSegment and pointSegment3D ~= nil and GetDistance(pointSegment3D, PredictedPos) < VP:GetHitBox(enemy) + SpellQ.Width - 30 and HitChance >= 2 then
count = count + 1
if enemy.networkID == target.networkID then
HitMainTarget = true
end
end
end
end
if Config.Extras.Debug then
print('Returning GetEnemiesByQ with ' .. tostring(count))
end
return count, HitMainTarget
end
end
function FindBestCastPosition(Target)
if QReady then
if Config.Extras.Debug then
print('FindBestCastPosition called')
end
if Config.Extras.Debug then
print('EnemyMinions called ' .. tostring(#EnemyMinions.objects))
end
local Enemies = GetEnemyHeroes()
local BestPosition = nil
local BestHit = 0
for idx, enemy in ipairs(Enemies) do
if not enemy.dead and ValidTarget(enemy) and GetDistance(enemy) < SpellQ.Range then
local position, hitchance = VP:GetPredictedPos(enemy, SpellQ.Delay, math.huge, myHero, false)
--print(position)
local count, hitmain = GetEnemiesHitByQ(myHero, position)
if hitmain and hitchance >= 1 then
if count > BestHit then
BestHit = count
BestPosition = enemy
end
end
end
end
if BestPosition ~= nil then
return BestPosition
end
if #EnemyMinions.objects >= 1 then
if Config.Extras.Debug then
print('EnemyMinions called 2')
end
for i, minion in ipairs(EnemyMinions.objects) do
if GetDistance(minion) < SpellQ.Range then
local position, hitchance = VP:GetPredictedPos(minion, SpellQ.Delay, math.huge, myHero, false)
-- local waypoints = VP:GetCurrentWayPoints(minion)
-- local MPos, CastPosition = #waypoints == 1 and Vector(minion.visionPos) or VP:CalculateTargetPosition(minion, SpellQ.Delay, SpellQ.Width, SpellQ.Speed, myHero, "line")
local count, hitmain = GetEnemiesHitByQ(myHero, Vector(position))
if Config.Extras.Debug then
print('Minions iterating ' .. tostring(count))
end
if hitmain and hitchance >= 1 and count > BestHit then
BestHit = count
BestPosition = minion
end
end
end
end
if BestPosition ~= nil then
return BestPosition
end
end
end
--Credit AWA
function KillSteal()
local Enemies = GetEnemyHeroes()
for i, enemy in pairs(Enemies) do
if getDmg("Q", enemy, myHero) > enemy.health and Config.KS.useQ and GetDistance(enemy) < SpellQ.Range then
CastQ(enemy)
end
if getDmg("W", enemy, myHero) > enemy.health and Config.KS.useW and GetDistance(enemy) < SpellW.Range then
CastW(enemy)
end
end
end
function Reset(Target)
if GetDistance(Target) > 550 + VP:GetHitBox(Target) then
return true
elseif _G.MMA_Loaded and _G.MMA_NextAttackAvailability < 0.6 then
return true
elseif _G.AutoCarry and (_G.AutoCarry.shotFired or _G.AutoCarry.Orbwalker:IsAfterAttack()) then
if Config.Extras.Debug then
print('SAC shot fired')
end
return true
else
return false
end
end
function OnDraw()
if Config.Extras.Debug and Qtarget ~= nil then
DrawText3D("Current IsPressedR status is " .. tostring(isPressedR), myHero.x+200, myHero.y, myHero.z+200, 25, ARGB(255,255,0,0), true)
DrawText3D("Current isBuffed status is " .. tostring(isBuffed), myHero.x, myHero.y, myHero.z, 25, ARGB(255,255,0,0), true)
DrawText3D("Current isReset status is " .. tostring(Reset(Qtarget)), myHero.x-100, myHero.y, myHero.z-100, 25, ARGB(255,255,0,0), true)
DrawText3D("Current ShouldCast status is " .. tostring(ShouldCast(Qtarget)), myHero.x-150, myHero.y, myHero.z-159, 25, ARGB(255,255,0,0), true)
DrawText3D("Current time since last cast is " .. tostring(animation_time), myHero.x-250, myHero.y, myHero.z-259, 25, ARGB(255,255,0,0), true)
DrawCircle3D(Qtarget.x, Qtarget.y, Qtarget.z, 150, 1, ARGB(255, 0, 255, 255))
end
if Config.Draw.DrawQ then
DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellQ.Range, 1, ARGB(255, 0, 255, 255))
DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellQ.ExtendedRange, 1, ARGB(255, 0, 255, 255))
end
if Config.Draw.DrawW then
DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellW.Range, 1, ARGB(255, 0, 255, 255))
end
end
function OnGainBuff(unit, buff)
if unit.isMe and buff.name == 'lucianpassivebuff' then
isBuffed = true
end
if unit.isMe and buff.name == 'LucianR' then
isPressedR = true
end
if unit.isMe and (buff.type == 5 or buff.type == 10 or buff.type == 11) and EReady and Config.Extras.ESlows then
CastE()
end
end
function OnLoseBuff(unit, buff)
if unit.isMe and buff.name == 'lucianpassivebuff' then
isBuffed = false
end
if unit.isMe and buff.name == 'LucianR' then
isPressedR = true
end
end
function OrbwalkToPosition(position)
if position ~= nil then
if _G.AutoCarry.Orbwalker then
_G.AutoCarry.Orbwalker:OverrideOrbwalkLocation(position)
elseif _G.MMA_Loaded then
moveToCursor(position.x, position.z)
end
else
if _G.AutoCarry.Orbwalker then
_G.AutoCarry.Orbwalker:OverrideOrbwalkLocation(nil)
elseif _G.MMA_Loaded then
moveToCursor()
end
end
end
function OnProcessSpell(unit, spell)
if unit == myHero then
if spell.name:lower():find("attack") then
lastAttack = GetTickCount() - GetLatency()/2
lastWindUpTime = spell.windUpTime*1000
lastAttackCD = spell.animationTime*1000
animation_time = spell.windUpTime
end
end
if unit.isMe and spell.name == 'LucianQ' then
LastSpellCast = GetTickCount()
end
if unit.isMe and spell.name == 'LucianW' then
LastSpellCast = GetTickCount()
end
if unit.isMe and spell.name == 'LucianE' then
LastSpellCast = GetTickCount()
end
if unit.isMe and spell.name == 'LucianR' then
LastSpellCast = GetTickCount()
RTempEndPos = {x=spell.endPos.x, y=myHero.y, z=spell.endPos.z}
REndPos = Vector(Vector(RTempEndPos) - Vector(myHero)):normalized()
isPressedR = true
end
end
function ShouldCast(Target)
if not isBuffed and Reset(Target) then
return true
else
return false
end
end
function Check()
QReady = (myHero:CanUseSpell(_Q) == READY)
WReady = (myHero:CanUseSpell(_W) == READY)
EReady = (myHero:CanUseSpell(_E) == READY)
RReady = (myHero:CanUseSpell(_R) == READY)
if not RReady then
QEndPos = nil
LastDistance = nil
isPressedR = false
RendPos = nil
end
end
function GetBestQPositionFarm()
local MaxQ = 0
local MaxQPos
for i, minion in pairs(EnemyMinions.objects) do
if GetDistance(minion) < SpellQ.Range then
local hitQ = countminionshitQ(minion)
if hitQ > MaxQ or MaxQPos == nil then
MaxQPos = minion
MaxQ = hitQ
end
end
end
if MaxQPos then
return MaxQPos
else
return nil
end
end
function countminionshitQ(pos)
local n = 0
local ExtendedVector = Vector(myHero) + Vector(Vector(pos) - Vector(myHero)):normalized()*SpellQ.ExtendedRange
for i, minion in ipairs(EnemyMinions.objects) do
local MinionPointSegment, MinionPointLine, MinionIsOnSegment = VectorPointProjectionOnLineSegment(Vector(myHero), Vector(ExtendedVector), Vector(minion))
local MinionPointSegment3D = {x=MinionPointSegment.x, y=pos.y, z=MinionPointSegment.y}
if MinionIsOnSegment and GetDistance(MinionPointSegment3D, pos) < SpellQ.Width + 30 then
n = n +1
-- if Config.Extras.Debug then
-- print('count minions W returend ' .. tostring(n))
-- end
end
end
return n
end
function GetBestWPositionFarm()
local MaxW = 0
local MaxWPos
for i, minion in pairs(EnemyMinions.objects) do
local hitW = countminionshitW(minion)
if hitW > MaxW or MaxWPos == nil then
MaxWPos = minion
MaxW = hitW
end
end
if MaxWPos then
return MaxWPos
else
return nil
end
end
function countminionshitW(pos)
local n = 0
for i, minion in ipairs(EnemyMinions.objects) do
if GetDistance(minion, pos) < SpellW.Width then
n = n +1
end
end
return n
end
function FarmW()
if WReady and #EnemyMinions.objects > 0 then
local WPos = GetBestWPositionFarm()
if WPos then
CastSpell(_W, WPos.x, WPos.z)
end
end
end
function FarmQ()
if QReady and #EnemyMinions.objects > 0 then
local QPos = GetBestQPositionFarm()
if QPos then
CastSpell(_Q, QPos)
end
end
end
--Credit Xetrok
function CountEnemyNearPerson(person,vrange)
count = 0
for i=1, heroManager.iCount do
currentEnemy = heroManager:GetHero(i)
if currentEnemy.team ~= myHero.team then
if GetDistance(currentEnemy, person) <= vrange and not currentEnemy.dead then count = count + 1 end
end
end
return count
end
--End Credit Xetrok