-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmalskarthus.lua
1485 lines (1269 loc) · 45.6 KB
/
malskarthus.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
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
require "Utils"
require 'spell_damage'
print=printtext
printtext("\nShopping for Kills with the Kart\n")
printtext("\nBy Malbert\n")
printtext("\nVersion 3.3\n")
local target
local targetE
local miniontarget
local minionDamage = 0
local areaMinions = {}
local miniontargetHealth=0
local minionDamageTimer = 0
local ghosttarget
local lastHitSpot = { x = 0, y = 0, z = 0, single = 0 }
local minions={}
local minionRadius = 100
local spellRadius = 100
local closestArc
local ignitedamage=0
local IGN
local EXH
local Etoggle = false
local LEMIA={}
local LowEnemyRecalling={}
local enemiesAll={}
local QSpot = { x = 0, y = 0, z = 0}
local tqfx,tqfy,tqfz
local tqfa
local Ghost=false
local ghostultTimer=0
local tfdiedtimer=0
local tfdied=false
local textflashtimer=0
local colorCheck = 0
local colorCheck2 = 0
local SpawnturretR={}
local SpawnturretB={}
local TurretsR={}
local TurretsB={}
local allyTurrets={}
local allySpawn={}
local map = nil
local QRDY=0
local WRDY=0
local ERDY=0
local RRDY=0
local CLOCK=0
local qdelay=5
printtext("\n" ..GetMap() .. "\n")
if GetMap()==1 then
map = "SummonersRift"
SpawnturretR = {"Turret_ChaosTurretShrine_A"}
SpawnturretB = {"Turret_OrderTurretShrine_A"}
TurretsR = {"Turret_T1_C_01_A","Turret_T1_C_02_A","Turret_T1_C_03_A","Turret_T1_C_04_A","Turret_T1_C_05_A","Turret_T1_C_06_A","Turret_T1_C_07_A","Turret_T1_L_02_A","Turret_T1_L_03_A","Turret_T1_R_02_A","Turret_T1_R_03_A"}
TurretsB = {"Turret_T2_C_01_A","Turret_T2_C_02_A","Turret_T2_C_03_A","Turret_T2_C_04_A","Turret_T2_C_05_A","Turret_T2_L_01_A","Turret_T2_L_02_A","Turret_T2_L_03_A","Turret_T2_R_01_A","Turret_T2_R_02_A","Turret_T2_R_03_A"}
elseif GetMap()==2 then
map = "CrystalScar"
SpawnturretR = {"Turret_ChaosTurretShrine_A","Turret_ChaosTurretShrine1_A"}
SpawnturretB = {"Turret_OrderTurretShrine_A","Turret_OrderTurretShrine1_A"}
TurretsR = {"OdinNeutralGuardian"}
TurretsB = {"OdinNeutralGuardian"}
elseif GetMap()==3 then
map = "TwistedTreeline"
SpawnturretR = {"Turret_ChaosTurretShrine_A"}
SpawnturretB = {"Turret_OrderTurretShrine_A"}
TurretsR = {"Turret_T1_R_02_A","Turret_T1_C_07_A","Turret_T1_C_06_A","Turret_T1_C_01_A","Turret_T1_L_02_A"}
TurretsB = {"Turret_T2_L_01_A","Turret_T2_C_01_A","Turret_T2_L_02_A","Turret_T2_R_01_A","Turret_T2_R_02_A"}
elseif GetMap()==0 then
map = "ProvingGrounds"
SpawnturretR = {"Turret_ChaosTurretShrine_A"}
SpawnturretB = {"Turret_OrderTurretShrine_A"}
TurretsR = {"Turret_T1_C_07_A","Turret_T1_C_08_A","Turret_T1_C_09_A","Turret_T1_C_010_A"}
TurretsB = {"Turret_T2_L_01_A","Turret_T2_L_02_A","Turret_T2_L_03_A","Turret_T2_L_04_A"}
end
local _registry = {}
local turret = {}
local runeverycc=0
KarthConfig = scriptConfig('Karth Config', 'KarthConfig')
KarthConfig:addParam('QDD', 'QwithDoubleDamage', SCRIPT_PARAM_ONKEYDOWN, false, 65)
KarthConfig:addParam('doingcombo', 'Combo', SCRIPT_PARAM_ONKEYDOWN, false, 88)
KarthConfig:addParam('teamfight', 'TeamFight', SCRIPT_PARAM_ONKEYDOWN, false, 84)
KarthConfig:addParam('farm', 'AutoCreepFarm', SCRIPT_PARAM_ONKEYTOGGLE, false, 189)
KarthConfig:addParam('dfarm', 'DefendFarm', SCRIPT_PARAM_ONKEYTOGGLE, true, 187)
KarthConfig:addParam('autoQ', 'AutoQ', SCRIPT_PARAM_ONKEYTOGGLE, false, 55)
KarthConfig:addParam('autoE', 'AutoDefile', SCRIPT_PARAM_ONKEYTOGGLE, false, 56)
KarthConfig:addParam('autoR', 'AutoSafeULT', SCRIPT_PARAM_ONKEYTOGGLE, false, 57)
KarthConfig:addParam('deathR', 'UltB4Death', SCRIPT_PARAM_ONKEYTOGGLE, false, 48)
KarthConfig:addParam('qd', "Q Delay", SCRIPT_PARAM_NUMERICUPDOWN, 5, 219,2,8,0.2)
KarthConfig:addParam('warn', 'EnemyLowWarning', SCRIPT_PARAM_ONOFF, true)
KarthConfig:addParam('dokillsteal', 'Killsteal', SCRIPT_PARAM_ONOFF, true)
KarthConfig:permaShow('farm')
KarthConfig:permaShow('dfarm')
KarthConfig:permaShow('autoQ')
KarthConfig:permaShow('autoE')
KarthConfig:permaShow('autoR')
KarthConfig:permaShow('deathR')
KarthConfig:permaShow('dokillsteal')
function Run()
if myHero.SpellLevelE > 0 then
EManaCost = 30+(myHero.SpellLevelE-1)*12
end
qdelay=KarthConfig.qd
if myHero.SpellTimeQ > 1.0 and myHero.SpellLevelQ > 0 then
QRDY = 1
else QRDY = 0
end
if myHero.SpellTimeW > 1.0 and myHero.SpellLevelW > 0 then
WRDY = 1
else WRDY = 0
end
if myHero.SpellTimeE > 1.0 and myHero.SpellLevelE > 0 then
ERDY = 1
else ERDY = 0
end
if myHero.SpellTimeR > 1.0 and myHero.SpellLevelR > 0 then
RRDY = 1
else RRDY = 0 end
--------------------------
CLOCK=os.clock()
for i=1, objManager:GetMaxHeroes(), 1 do
hero = objManager:GetHero(i)
if hero~=nil and hero.team~=myHero.team and enemiesAll[hero]==nil then
table.insert(enemiesAll,hero)
end
end
targetE=GetWeakEnemy('MAGIC',475)
target=GetWeakEnemy('MAGIC',1050)
if target~=nil then
tqfx,tqfy,tqfz = GetFireahead(target,qdelay,0)
tqfa={x=tqfx,y=tqfy,z=tqfz}
end
--igniteExh()
if Ghost==true and (ghosttarget==nil or ghosttarget.dead==1) then
local th=nil
for i=1, objManager:GetMaxHeroes(), 1 do
hero = objManager:GetHero(i)
local hqfx,hqfy,hqfz
local hqfa
hqfx,hqfy,hqfz = GetFireahead(hero,qdelay,0)
hqfa={x=hqfx,y=hqfy,z=hqfz}
if hero~=nil and hero.team~=myHero.team and hero.dead~=1 and GetD(hqfa)<975 and (th==nil or th.dead==1) then
th=hero
elseif hero~=nil and hero.team~=myHero.team and hero.dead~=1 and GetD(hqfa)<975 and GetD(hero)<GetD(th) then
th=hero
end
end
ghosttarget=th
elseif Ghost==false then
ghosttarget=nil
end
if IsChatOpen()==0 and KarthConfig.QDD and target~=nil then qDoubleDmg(target) elseif IsChatOpen()==0 and KarthConfig.QDD then MoveToMouse() end
if KarthConfig.autoQ and not KarthConfig.teamfight and not KarthConfig.doingcombo then autoQ() end
if KarthConfig.warn then LowWarn() end
if KarthConfig.dokillsteal then killsteal() end
if not KarthConfig.teamfight and not KarthConfig.deathR and tfdied==true then
if tfdiedtimer+3<os.clock() and tfdiedtimer+4>os.clock() then
deathR()
tfdied=false
end
end
if KarthConfig.deathR then deathR() end
if KarthConfig.autoE and not KarthConfig.teamfight and not KarthConfig.doingcombo then autoE() end
if KarthConfig.autoR and not KarthConfig.doingcombo and not KarthConfig.teamfight then autoR() end
if KarthConfig.farm and not KarthConfig.doingcombo and not KarthConfig.teamfight then
UpdateMinionTable()
FindBestMinion()
autofarm()
end
if IsChatOpen()==0 and KarthConfig.doingcombo then harass() end
if IsChatOpen()==0 and KarthConfig.teamfight then Teamfight() end
if runeverycc<10 then
run_every(1,findTurret)
end
if myHero.dead==1 then
Etoggle=false
end
if EManaCost ~= nil and myHero.mana < EManaCost and Etoggle==true and myHero.dead~=1 then
Etoggle=false
end
end
function OnProcessSpell(unit, spell)
if unit.team==myHero.team and GetD(unit,myHero)<10 then
local s=spell.name
--printtext("\n".. s .."\n")
if (s ~= nil) and string.find(s,"efile") ~= nil then
--and (not KarthConfig.autoE or not KarthConfig.doingcombo or not KarthConfig.teamfight)
if Etoggle==false then Etoggle=true
elseif Etoggle==true then Etoggle=false end
end
end
if unit.team~=myHero.team and unit.selflevel~=nil and unit.selflevel>0 then
local s=spell.name
if (s ~= nil) and string.find(s,"Recall") ~= nil then
LowEnemyRecalling[unit.name]={timestarted=os.clock()}
end
end
end
function OnCreateObj(obj)
if GetD(obj,myHero) <10 then
--printtext("\n"..obj.charName.."\n")
local s = obj.charName
if (s ~= nil) and string.find(s,"DeathExplo") ~= nil then
Ghost=true
ghostultTimer=os.clock()+2.3
if KarthConfig.teamfight then
tfdied=true
tfdiedtimer=os.clock()
end
end
end
end
--------------CALLBACKS START-----------------------------
--[[
function igniteExh()
if myHero.SummonerD == 'SummonerDot' then
ignitedamage = ((myHero.selflevel*20)+50)*IsSpellReady('D')
IGN='D'
elseif myHero.SummonerF == 'SummonerDot' then
ignitedamage = ((myHero.selflevel*20)+50)*IsSpellReady('F')
IGN='F'
else
ignitedamage=0
IGN=nil
end
if myHero.SummonerD == 'SummonerExhaust' and IsSpellReady('D')==1 then
EXH='D'
elseif myHero.SummonerF == 'SummonerExhaust' and IsSpellReady('F')==1 then
EXH='F'
else
EXH=nil
end
end--]]
function CheckMultiHitMinion(targ)
local t,t2,t3 = GetFireahead(targ,qdelay,0)
local targC={x=t,y=t2,z=t3}
for i,minion in ipairs(minions) do
local m,m2,m3=GetFireahead(minion,qdelay,0)
local minionC={x=m,y=m2,z=m3}
if targ~=nil and minion ~= nil and minion.x~=targ.x and minion.z~=targ.z and minion.team ~= 0 and minion.team ~= myHero.team and GetD(targC, minionC) <= (minionRadius + spellRadius) then
return true
end
end
return false
end
function CheckMultiHitMinionFA(targ)
for i,minion in ipairs(minions) do
local m,m2,m3=GetFireahead(minion,qdelay,0)
local minionC={x=m,y=m2,z=m3}
if targ~=nil and minion ~= nil and minion.x~=targ.x and minion.z~=targ.z and minion.team ~= 0 and minion.team ~= myHero.team and GetD(targ, minionC) <= (minionRadius + spellRadius) then
return true
end
end
return false
end
function CheckMultiHitHero(targ)
local t1,t2,t3=GetFireahead(targ,qdelay,0)
local targC={x=t1,y=t2,z=t3}
for i=1, objManager:GetMaxHeroes(), 1 do
hero = objManager:GetHero(i)
local h1,h2,h3=GetFireahead(hero,qdelay,0)
local heroC={x=h1,y=h2,z=h3}
if hero~=nil and targ~=nil and hero.team ~= 0 and hero.x~=targ.x and hero.z~=targ.z and hero.team ~= myHero.team and GetD(targC, heroC) <= (minionRadius + spellRadius) then
return true
end
end
return false
end
function CheckMultiHitHeroFA(targ)
for i=1, objManager:GetMaxHeroes(), 1 do
hero = objManager:GetHero(i)
local h1,h2,h3=GetFireahead(hero,qdelay,0)
local heroC={x=h1,y=h2,z=h3}
if hero~=nil and targ~=nil and hero.team ~= 0 and hero.x~=targ.x and hero.z~=targ.z and hero.team ~= myHero.team and GetD(targ, heroC) <= (minionRadius + spellRadius) then
return true
end
end
return false
end
function runningAway(slowtarget,me)
if me==nil then
me=myHero
end
local d1 = GetD(slowtarget,me)
local x, y, z = GetFireahead(slowtarget,5,0)
local d2 = GetD({x=x, y=y, z=z},me)
local d3 = GetD({x=x, y=y, z=z},slowtarget)
local angle = math.acos((d2*d2-d3*d3-d1*d1)/(-2*d3*d1))
return angle%(2*math.pi)>math.pi/2 and angle%(2*math.pi)<math.pi*3/2
end
function UpdateMinionTable()
if miniontarget ~= nil and (miniontarget.dead == 1 or miniontarget.visible==0 or GetD(miniontarget)>900) then
miniontarget = nil
end
for i,minion in ipairs(minions) do
if minion.dead == 1 or minion.team == myHero.team or minion == nil or minion.visible==0 or minion.x==nil then
table.remove(minions,i)
end
end
for i=1, objManager:GetMaxNewObjects(), 1 do
object = objManager:GetNewObject(i)
if object and object ~= nil and object.team ~= 0 and object.charName ~= nil and object.team ~= myHero.team and object.dead~=1 and object.visible==1 and string.find(object.charName,"inion_") then
table.insert(minions,object)
end
end
end
function FindBestMinion()
if #minions > 0 then
for i,minion in ipairs(minions) do
if minion.team ~= 0 and minion.team ~= myHero.team and GetD(minion, myHero) <= 975 then
if minion~=nil and minion.dead~=1 and minion.visible==1 and (miniontarget == nil or miniontarget.health==nil or (minion.health~=nil and minion.health < miniontarget.health)) then
miniontarget = minion
miniontargetHealth = minion.health
minionDamage = 0
minionDamageTimer = CLOCK
end
end
end
end
if miniontarget~=nil and (CLOCK - minionDamageTimer) >= 0.1 and miniontarget.health~=nil and miniontargetHealth > miniontarget.health then
minionDamage = miniontargetHealth - miniontarget.health
miniontargetHealth = miniontarget.health
minionDamageTimer = CLOCK
end
end
function BestSpotMinion()
local mtfax,mtfay,mtfaz
local mtfa = {}
local mfa = {}
areaMinions={}
if miniontarget~=nil and miniontarget.visible==1 and miniontarget.dead~=1 then
mtfax,mtfay,mtfaz=GetFireahead(miniontarget,qdelay,0)
mtfa = {x=mtfax,y=mtfay,z=mtfaz}
for i,minion in ipairs(minions) do
if minion~=nil and minion.dead~=1 and minion.visible==1 and minion.team ~= 0 and minion.team ~= myHero.team and GetD(minion) <900 then
mfax,mfay,mfaz=GetFireahead(minion,qdelay,0)
mfa = {x=mfax,y=mfay,z=mfaz}
if miniontarget~=nil and CheckMultiHitMinion(miniontarget) and GetD(mtfa, mfa) < (minionRadius + spellRadius) and minion.health~=nil and minion.health <= CalcMagicDamage(minion,(20 + (20 * GetSpellLevel('Q')) + (myHero.ap * 0.3))) then
table.insert(areaMinions, minion)
end
end
end
if #areaMinions > 0 then
local totalSpace = { x = 0, y = 0, z = 0 }
table.insert(areaMinions, miniontarget)
local count = table.getn(areaMinions)
for j,minion2 in ipairs(areaMinions) do
mfax2,mfay2,mfaz2=GetFireahead(minion2,qdelay,0)
totalSpace.x = totalSpace.x + mfax2
totalSpace.y = totalSpace.y + mfay2
totalSpace.z = totalSpace.z + mfaz2
end
lastHitSpot.x = totalSpace.x / count
lastHitSpot.y = totalSpace.y / count
lastHitSpot.z = totalSpace.z / count
lastHitSpot.single = 0
else
local spot = { x = 0, y = 0, z = 0 }
local angle = 0
local spotFound = false
for j=0, 360, 10 do
local rads = angle * (math.pi / 180)
spot.x,spot.y,spot.z = GetFireahead(miniontarget,qdelay,0)
spot.x = spot.x + (spellRadius+minionRadius-15) * math.floor(math.cos(rads))
spot.z = spot.z + (spellRadius+minionRadius-15) * math.floor(math.sin(rads))
local spotClear = true
if CheckMultiHitMinionFA(spot)==false and GetD(spot,mtfa)<=(spellRadius+minionRadius-15) then
lastHitSpot.x = spot.x
lastHitSpot.y = spot.y
lastHitSpot.z = spot.z
lastHitSpot.single = 1
spotFound = true
break
end
angle = angle - 10
end
if spotFound == true then
end
if spotFound ~= true then
lastHitSpot.x = mtfax
lastHitSpot.y = mtfay
lastHitSpot.z = mtfaz
lastHitSpot.single = 0
end
end
if CheckMultiHitMinion(miniontarget)==false then
lastHitSpot.x = mtfax
lastHitSpot.y = mtfay
lastHitSpot.z = mtfaz
lastHitSpot.single = 1
end
end
end
------------END OF CALLBACKS--------------------------------
function autofarm()
local Q = (20 + (20 * myHero.SpellLevelQ) + (myHero.ap * 0.3))+lastHitSpot.single*(20 + (20 * myHero.SpellLevelQ) + (myHero.ap * 0.3))
if KarthConfig.dfarm then
if target~= nil and GetD(target)<700 then
local tfax,tfay,tfaz = GetFireahead(target,qdelay,0)
local QSpot={x=tfax,y=tfay,z=tfaz}
if CheckMultiHitMinion(target)==false and CheckMultiHitHero(target)==false then
CastSpellXYZ('Q',QSpot.x,QSpot.y,QSpot.z)
else
local spot = { x = 0, y = 0, z = 0 }
local angle = 0
local spotFound = false
local closestD = { x = 0, y = 0, z = 0 }
local closestDcheck = { x = 0, y = 0, z = 0 }
local angle1 = 0
for j=0, 360, 10 do
local rads = angle1 * (math.pi / 180)
closestDcheck.x,closestDcheck.y,closestDcheck.z = GetFireahead(target,qdelay,0)
closestDcheck.x = closestDcheck.x + (spellRadius+minionRadius-15) * math.floor(math.cos(rads))
closestDcheck.z = closestDcheck.z + (spellRadius+minionRadius-15) * math.floor(math.sin(rads))
if closestD.x==0 then
closestD.x,closestD.y,closestD.z = GetFireahead(target,qdelay,0)
closestD.x = closestD.x + (spellRadius+minionRadius-15) * math.floor(math.cos(rads))
closestD.z = closestD.z + (spellRadius+minionRadius-15) * math.floor(math.sin(rads))
closestArc=j
elseif closestD~=0 and GetD(closestD,myHero)> GetD(closestDcheck,myHero)then
closestD.x,closestD.y,closestD.z = GetFireahead(target,qdelay,0)
closestD.x = closestD.x + (spellRadius+minionRadius-15) * math.floor(math.cos(rads))
closestD.z = closestD.z + (spellRadius+minionRadius-15) * math.floor(math.sin(rads))
closestArc=j
end
angle1 = angle1 - 10
end
for j=closestArc, closestArc+360, 10 do
local rads = angle * (math.pi / 180)
spot.x,spot.y,spot.z = GetFireahead(target,qdelay,0)
spot.x = spot.x + (spellRadius+minionRadius-15) * math.floor(math.cos(rads))
spot.z = spot.z + (spellRadius+minionRadius-15) * math.floor(math.sin(rads))
local spotClear = true
if CheckMultiHitMinionFA(spot)==false and CheckMultiHitHeroFA(spot)==false and GetD(spot,tfa)<=(spellRadius+minionRadius-15) then
QSpot.x = spot.x
QSpot.y = spot.y
QSpot.z = spot.z
spotFound = true
break
end
angle = angle - 10
end
if spotFound ~= true then
QSpot.x,QSpot.y,QSpot.z = GetFireahead(target,qdelay,0)
end
CastSpellXYZ('Q',QSpot.x,QSpot.y,QSpot.z)
end
else
BestSpotMinion()
if miniontarget~=nil and miniontarget.health~=nil and miniontarget.health <= CalcMagicDamage(miniontarget,Q) then
CastSpellXYZ('Q', lastHitSpot.x, lastHitSpot.y, lastHitSpot.z)
end
end
else
BestSpotMinion()
if miniontarget~=nil and miniontarget.health~=nil and miniontarget.health <= CalcMagicDamage(miniontarget,Q) then
CastSpellXYZ('Q', lastHitSpot.x, lastHitSpot.y, lastHitSpot.z)
end
end
end
function qDoubleDmg(tar)
if tar~=nil and tar.dead~=1 and GetD(tar)<920 then
--CastSpellXYZ('Q',GetFireahead(tar,qdelay,0))
if CheckMultiHitMinion(tar)==false and CheckMultiHitHero(tar)==false and QRDY==1 then
CastSpellXYZ('Q',GetFireahead(tar,qdelay,0))
else
local QSpot = { x = 0, y = 0, z = 0}
local spot = { x = 0, y = 0, z = 0 }
local angle = 0
local spotFound = false
local closestD = { x = 0, y = 0, z = 0 }
local closestDcheck = { x = 0, y = 0, z = 0 }
local angle1 = 0
for j=0, 360, 10 do
local rads = angle1 * (math.pi / 180)
closestDcheck.x,closestDcheck.y,closestDcheck.z = GetFireahead(tar,qdelay,0)
closestDcheck.x = closestDcheck.x + (spellRadius+minionRadius-15) * math.floor(math.cos(rads))
closestDcheck.z = closestDcheck.z + (spellRadius+minionRadius-15) * math.floor(math.sin(rads))
if closestD.x==0 then
closestD.x,closestD.y,closestD.z = GetFireahead(tar,qdelay,0)
closestD.x = closestD.x + (spellRadius+minionRadius-15) * math.floor(math.cos(rads))
closestD.z = closestD.z + (spellRadius+minionRadius-15) * math.floor(math.sin(rads))
closestArc=j
elseif closestD~=0 and GetD(closestD,myHero)> GetD(closestDcheck,myHero)then
closestD.x,closestD.y,closestD.z = GetFireahead(tar,qdelay,0)
closestD.x = closestD.x + (spellRadius+minionRadius-15) * math.floor(math.cos(rads))
closestD.z = closestD.z + (spellRadius+minionRadius-15) * math.floor(math.sin(rads))
closestArc=j
end
angle1 = angle1 - 10
end
for j=closestArc, closestArc+360, 10 do
local rads = angle * (math.pi / 180)
spot.x,spot.y,spot.z = GetFireahead(tar,qdelay,0)
spot.x = spot.x + (spellRadius+minionRadius-15) * math.floor(math.cos(rads))
spot.z = spot.z + (spellRadius+minionRadius-15) * math.floor(math.sin(rads))
local spotClear = true
if CheckMultiHitMinionFA(spot)==false and CheckMultiHitHeroFA(spot)==false and GetD(spot,tfa)<=(spellRadius+minionRadius-10) then
QSpot.x = spot.x
QSpot.y = spot.y
QSpot.z = spot.z
spotFound = true
--print("\n2 "..QSpot.x .."\n")
break
end
angle = angle - 10
end
if spotFound ~= true and CheckMultiHitHero(tar)==false then
QSpot.x,QSpot.y,QSpot.z = GetFireahead(tar,qdelay,0)
--print("\n3 "..QSpot.x .."\n")
elseif spotFound~=true and CheckMultiHitHero(tar)==true then
local tfax,tfay,tfaz=GetFireahead(tar,qdelay,0)
local tfa={x=tfax,y=tfay,z=tfaz}
local areaHeroes={}
for i=1, objManager:GetMaxHeroes(), 1 do
hero = objManager:GetHero(i)
if hero ~= nil and hero~=tar and hero.team ~= myHero.team then
local hfax,hfay,hfaz=GetFireahead(hero,qdelay,0)
local hfa={x=hfax,y=hfay,z=hfaz}
if GetD(hfa, tfa) <= (minionRadius + spellRadius) then
table.insert(areaHeroes, hero)
end
end
end
--print("\n4 "..QSpot.x .."\n")
local totalSpace = { x = 0, y = 0, z = 0 }
table.insert(areaHeroes, tar)
local count = table.getn(areaHeroes)
for i,hero in ipairs(areaHeroes) do
if hero~=nil then
local FA1,FA2,FA3 = GetFireahead(hero,qdelay,0)
totalSpace.x = totalSpace.x + FA1
totalSpace.y = totalSpace.y + FA2
totalSpace.z = totalSpace.z + FA3
end
end
QSpot.x = totalSpace.x / count
QSpot.y = totalSpace.y / count
QSpot.z = totalSpace.z / count
--print("\n5 "..QSpot.x .."\n")
else
QSpot.x,QSpot.y,QSpot.z = GetFireahead(tar,qdelay,0)
end
if QRDY==1 then
CastSpellXYZ('Q',QSpot.x,QSpot.y,QSpot.z)
end
--print("\n6 "..QSpot.x .."\n")
end
end
end
function harass()
if target~=nil and target.dead~=1 then
if QRDY==1 and GetD(target)<870 then
qDoubleDmg(target)
end
if WRDY==1 and GetD(target) <1000 and runningAway(target) then
CastSpellXYZ('W',GetFireahead(target,qdelay,0))
end
if ERDY==1 and Etoggle==false and GetD(target)<475 then
CastSpellTarget('E',target)
Etoggle=true
end
if ERDY==1 and Etoggle==true and GetD(target)>475 then
CastSpellTarget('E',target)
Etoggle=false
end
if GetD(target)<600 then
UseAllItems(target)
end
if GetD(target)<500 then
AttackTarget(target)
end
else
MoveToMouse()
if ERDY==1 and Etoggle==true and Ghost==false then
CastSpellTarget('E',myHero)
Etoggle=false
end
end
end
function Teamfight()
local enemiesInsideE={}
local numberEnemies=0
if Ghost==false then
for i,hero in pairs(enemiesAll) do
if hero~=nil and hero.dead~=1 and hero.team~=myHero.team and hero.visible==1 and enemiesInsideE[hero.name]==nil and GetD(hero)<425 then
numberEnemies=numberEnemies+1
enemiesInsideE[hero.name]=hero
elseif hero~=nil and enemiesInsideE[hero.name]~=nil and (hero.dead==1 or GetD(hero)>425) then
numberEnemies=numberEnemies-1
enemiesInsideE[hero.name]=nil
end
end
end
if target~=nil then
if RRDY==1 then
local enemyList ={}
local enemiesInList=0
local save4L8R = {}
local enemiesSaved=0
local safe2R=true
--for i=1, objManager:GetMaxHeroes(), 1 do
-- hero = objManager:GetHero(i)
for i,hero in ipairs(enemiesAll) do
local R = getDmg('R',hero,myHero)*RRDY
if hero~=nil and hero.dead~=1 and hero.team~=myHero.team and hero.health+10+hero.selflevel<R then
save4L8R[hero.name]=hero
enemiesSaved=enemiesSaved+1
elseif hero~=nil and save4L8R[hero.name]~=nil and (hero.dead==1) then
save4L8R[hero.name]=nil
enemiesSaved=enemiesSaved-1
elseif hero~=nil and hero.dead~=1 and hero.team~=myHero.team then
enemyList[hero.name]=hero
enemiesInList=enemiesInList+1
elseif hero~=nil and enemyList[hero.name]~=nil and (hero.dead==1 or hero.visible==0 or GetD(hero,myHero)>975) then
enemyList[hero.name]=nil
enemiesInList=enemiesInList-1
end
end
for i=1, objManager:GetMaxHeroes(), 1 do
hero = objManager:GetHero(i)
if hero~=nil and hero.dead~=1 and hero.team~=myHero.team and Ghost==false and GetD(hero)<1200 then
safe2R =false
break
end
end
if enemiesSaved>0 and enemiesInList==0 and safe2R==true then
CastSpellTarget('R',myHero)
elseif enemiesSaved>0 and enemiesInList==0 and safe2R==false then
for i,herocheckD in pairs(enemiesAll) do
if herocheckD~=nil and herocheckD.dead~=1 and herocheckD.visible==1 and herocheckD.team~=myHero.team and Ghost==false and GetD(herocheckD)<1300 then
for i,tower in ipairs(allySpawn) do
MoveToXYZ(tower.object.x,tower.object.y,tower.object.z)
safe2R=false
stop=true
break
end
else
stop=true
if stop==true then
StopMove()
stop=false
end
safe2R=true
end
end
if safe2R==true then
CastSpellTarget('R',myHero)
end
elseif enemiesSaved>0 and enemiesInList>0 then
local Qd
local QdCompare
for i,enemy in pairs(enemyList) do
if enemy~=nil and enemy.dead~=1 then
if QdCompare==nil and GetD(enemy)<1000 then
target=enemy
QdCompare=(target.health)/(CalcMagicDamage(target,2*(20 + (20 * myHero.SpellLevelQ) + (myHero.ap * 0.3))))
elseif GetD(enemy)<1000 then
Qd=(enemy.health)/(CalcMagicDamage(enemy,2*(20 + (20 * myHero.SpellLevelQ) + (myHero.ap * 0.3))))
if QdCompare>Qd then
QdCompare=nil
target=enemy
end
end
end
end
--if EXH~=nil then
-- CastSpellTarget('EXH',target)
--end
UseAllItems(target)
if QRDY==1 and Ghost==false and GetD(target) <870 then
qDoubleDmg(target)
elseif Ghost==true and ghosttarget~=nil then
qDoubleDmg(ghosttarget)
end
if WRDY==1 and Ghost==false and GetD(target) <1000 then
CastSpellXYZ('W',GetFireahead(target,qdelay,0))
elseif Ghost==true and ghosttarget~=nil then
CastSpellXYZ('W',GetFireahead(ghosttarget,qdelay,0))
end
if ERDY==1 and Etoggle==false and Ghost==false and (GetD(target)<475 or numberEnemies>0) then
CastSpellTarget('E',target)
Etoggle=true
elseif Ghost==true and Etoggle==false and ghosttarget~=nil then
CastSpellTarget('E',ghosttarget)
Etoggle=true
end
if ERDY==1 and Etoggle==true and Ghost==false and GetD(target)>475 and numberEnemies==0 then
CastSpellTarget('E',target)
MoveToXYZ(GetFireahead(target,1,0))
Etoggle=false
end
if Ghost==false and GetD(target)<600 then
UseAllItems(target)
elseif Ghost==true and ghosttarget~=nil then
UseAllItems(ghosttarget)
end
if Ghost==false and GetD(target)<500 then
AttackTarget(target)
end
if Ghost==true then
if ghosttarget~=nil then
CastSpellXYZ('W',GetFireahead(ghosttarget,qdelay,0))
qDoubleDmg(ghosttarget)
end
deathR()
if ghostultTimer<os.clock() then
if RRDY==1 then CastSpellTarget('R',myHero) end
Ghost=false
end
end
elseif enemiesSaved==0 then
--if EXH~=nil then
-- CastSpellTarget('EXH',target)
--end
UseAllItems(target)
if QRDY==1 and Ghost==false and GetD(target) <870 then
qDoubleDmg(target)
elseif Ghost==true and ghosttarget~=nil then
qDoubleDmg(ghosttarget)
end
if WRDY==1 and Ghost==false and GetD(target) <1000 then
CastSpellXYZ('W',GetFireahead(target,qdelay,0))
elseif Ghost==true and ghosttarget~=nil then
CastSpellXYZ('W',GetFireahead(ghosttarget,qdelay,0))
end
if ERDY==1 and Etoggle==false and Ghost==false and (GetD(target)<475 or numberEnemies>0) then
CastSpellTarget('E',target)
Etoggle=true
elseif Ghost==true and ghosttarget~=nil and Etoggle==false then
CastSpellTarget('E',ghosttarget)
end
if ERDY==1 and Etoggle==true and Ghost==false and GetD(target)>475 and numberEnemies==0 then
CastSpellTarget('E',target)
MoveToXYZ(GetFireahead(target,1,0))
Etoggle=false
end
if Ghost==false and GetD(target)<600 then
UseAllItems(target)
elseif Ghost==true and ghosttarget~=nil then
UseAllItems(ghosttarget)
end
if Ghost==false and GetD(target)<500 then
AttackTarget(target)
end
if Ghost==true then
if ghosttarget~=nil then
CastSpellXYZ('W',GetFireahead(ghosttarget,qdelay,0))
qDoubleDmg(ghosttarget)
end
deathR()
if ghostultTimer<os.clock() then
if RRDY==1 then CastSpellTarget('R',myHero) end
Ghost=false
end
end
end
if Ghost==true then
if ghosttarget~=nil then
CastSpellXYZ('W',GetFireahead(ghosttarget,qdelay,0))
qDoubleDmg(ghosttarget)
end
if ghostultTimer<os.clock() then
if RRDY==1 then CastSpellTarget('R',myHero) end
Ghost=false
end
end
else
--if EXH~=nil then
-- CastSpellTarget('EXH',target)
--end
if QRDY==1 and Ghost==false and GetD(target) <970 then
qDoubleDmg(target)
elseif Ghost==true and ghosttarget~=nil then
qDoubleDmg(ghosttarget)
end
if WRDY==1 and Ghost==false and GetD(target) <1000 then
CastSpellXYZ('W',GetFireahead(target,qdelay,0))
elseif Ghost==true and ghosttarget~=nil then
CastSpellXYZ('W',GetFireahead(ghosttarget,qdelay,0))
end
if ERDY==1 and Etoggle==false and Ghost==false and (GetD(target)<475 or numberEnemies>0) then
CastSpellTarget('E',target)
Etoggle=true
elseif Ghost==true and ghosttarget~=nil and Etoggle==false then
CastSpellTarget('E',ghosttarget)
end
if ERDY==1 and Etoggle==true and Ghost==false and GetD(target)>475 and numberEnemies==0 then
CastSpellTarget('E',target)
MoveToXYZ(GetFireahead(target,1,0))
Etoggle=false
end
if Ghost==false and GetD(target)<600 then
UseAllItems(target)
elseif Ghost==true and ghosttarget~=nil then
UseAllItems(ghosttarget)
end
if Ghost==false and GetD(target)<500 then
AttackTarget(target)
end
if Ghost==true then
if ghosttarget~=nil then
CastSpellXYZ('W',GetFireahead(ghosttarget,qdelay,0))
qDoubleDmg(ghosttarget)
end
deathR()
if ghostultTimer<os.clock() then
if RRDY==1 then CastSpellTarget('R',myHero) end
Ghost=false
end
end
end
else
MoveToMouse()
if ERDY==1 and Etoggle==true and Ghost==false then
CastSpellTarget('E',myHero)
Etoggle=false
end
if Ghost==true then
if ghosttarget~=nil then
CastSpellXYZ('W',GetFireahead(ghosttarget,qdelay,0))
qDoubleDmg(ghosttarget)
end
if ghostultTimer<os.clock() then
if RRDY==1 then CastSpellTarget('R',myHero) end
Ghost=false
end
end
end
end
function autoQ()
if target~=nil and GetD(tqfa)<850 then
qDoubleDmg(target)
--elseif target~=nil and GetD(tqfa)>=700 and GetD(tqfa)>875 then
--if QRDY==1 then CastSpellTarget('Q',target) end
end
end
function autoE()
if targetE~=nil then
if ERDY==1 and Etoggle==false then
CastSpellTarget('E',myHero)
Etoggle=true
end
elseif target~=nil then
if ERDY==1 and Etoggle==true and GetD(target,myHero)>=475 then
CastSpellTarget('E',myHero)
Etoggle=false
end
end
end