Repository navigation
Expand file tree
/
Copy pathJayce.lua
More file actions
1179 lines (1054 loc) · 46.1 KB
/
Copy pathJayce.lua
File metadata and controls
1179 lines (1054 loc) · 46.1 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
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
local version = "0.17"
--[[
Jayce, Hammer Time
by Dienofail
Changelog:
v0.01 - release
v0.02 - some fixes to form swapping.
v0.03 - updated some delay values
v0.04 - removed some bugsplatting code for now...
v0.05 - Added option to do Q then E combo (Force E before Q = false in Extra configs, turn to true to have v0.04 settings), Fixed Q gap closing bug (now will do so at full range), Added better form swapping logic. Added slider to set distance to enemy to swap to melee (was 650, now user-dictated)
v0.06 - Forces target to be in range for ranged W to activate (600)
v0.07 - added hammer Q+E killtext, maybe fixed some stuff for non-VIP usage
v0.08 - added W as an auto-attack reset (MMA/Reborn compatible, not sure about revamped)
v0.09 - Further fixes to non-VIP
v0.10 - Further fixes to non-VIP
v0.11 - Farm beta included (may not be working)
v0.12 - Typo fixed
v0.13 - Now will no longer cast hammer E if W status is active if consume W config setting is true
v0.14 - Added Ignite KS.
v0.15 - Added compatibility to vpred 2.404
v0.16 - Github
v0.17 - Fixes to CD calculations
]]
if myHero.charName ~= "Jayce" then return end
if VIP_USER then
require 'VPrediction'
end
local autoupdateenabled = true
local UPDATE_SCRIPT_NAME = "Jayce"
local UPDATE_HOST = "raw.github.com"
local UPDATE_PATH = "/Dienofail/BoL/master/Jayce.lua"
local UPDATE_FILE_PATH = SCRIPT_PATH..GetCurrentEnv().FILE_NAME
local UPDATE_URL = "https://"..UPDATE_HOST..UPDATE_PATH
local ServerData
if autoupdateenabled then
GetAsyncWebResult(UPDATE_HOST, UPDATE_PATH, function(d) ServerData = d end)
function update()
if ServerData ~= nil then
local ServerVersion
local send, tmp, sstart = nil, string.find(ServerData, "local version = \"")
if sstart then
send, tmp = string.find(ServerData, "\"", sstart+1)
end
if send then
ServerVersion = tonumber(string.sub(ServerData, sstart+1, send-1))
end
if ServerVersion ~= nil and tonumber(ServerVersion) ~= nil and tonumber(ServerVersion) > tonumber(version) then
DownloadFile(UPDATE_URL.."?nocache"..myHero.charName..os.clock(), UPDATE_FILE_PATH, function () print("<font color=\"#FF0000\"><b>"..UPDATE_SCRIPT_NAME..":</b> successfully updated. Reload (double F9) Please. ("..version.." => "..ServerVersion..")</font>") end)
elseif ServerVersion then
print("<font color=\"#FF0000\"><b>"..UPDATE_SCRIPT_NAME..":</b> You have got the latest version: <u><b>"..ServerVersion.."</b></u></font>")
end
ServerData = nil
end
end
AddTickCallback(update)
end
--Start Vadash Credit
class 'Kalman' -- {
function Kalman:__init()
self.current_state_estimate = 0
self.current_prob_estimate = 0
self.Q = 1
self.R = 15
end
function Kalman:STEP(control_vector, measurement_vector)
local predicted_state_estimate = self.current_state_estimate + control_vector
local predicted_prob_estimate = self.current_prob_estimate + self.Q
local innovation = measurement_vector - predicted_state_estimate
local innovation_covariance = predicted_prob_estimate + self.R
local kalman_gain = predicted_prob_estimate / innovation_covariance
self.current_state_estimate = predicted_state_estimate + kalman_gain * innovation
self.current_prob_estimate = (1 - kalman_gain) * predicted_prob_estimate
return self.current_state_estimate
end
--[[ Velocities ]]
local kalmanFilters = {}
local velocityTimers = {}
local oldPosx = {}
local oldPosz = {}
local oldTick = {}
local velocity = {}
local lastboost = {}
local velocity_TO = 10
local CONVERSATION_FACTOR = 975
local MS_MIN = 500
local MS_MEDIUM = 750
--End Vadash Credit
local SpellRangedQ1 = {Range = 1150, Speed = 1300, Delay = 0.1515, Width = 70}
local SpellRangedQ2 = {Range = 1750, Speed = 2350, Delay = 0.1515, Width = 70}
local SpellHammerQ = {Range = 600, Speed = math.huge, Delay = 0.250, Width = 0}
local SpellRangedW = {Range = math.huge, Speed = math.huge, Delay = 0.250, Width = 0}
local SpellHammerW = {Range = 350, Speed = math.huge, Delay = 0.264, Width = 0}
local SpellRangedE = {Range = 600, Speed = math.huge, Delay = 0.100, Width = 120}
local SpellHammerE = {Range = 240, Speed = math.huge, Delay = 0.250, Width = 80}
local RangedQReady, RangedWReady, RangedEReady = false, false, false
local HammerQReady, HammerWReady, HammerEready = false, false, false
local isHammer = true
local RangedTrueQcd = 8000
local HammerTrueQcd = {16000, 14000, 12000, 10000, 8000}
local RangedTrueWcd = {14000, 12000, 10000, 8000, 6000}
local HammerTrueWcd = 10000
local RangedTrueEcd = 16000
local HammerTrueEcd = {14000, 12000, 12000, 11000, 10000}
local RTruecd = 6000
local smoothness = 50
local RangedAllReady, RangedCombatReady = nil, nil
local HammerAllReady, HammerCombatReady = nil, nil
local HammerQcd, HammerWcd, HammerEcd = 0, 0, 0
local RangedQcd, RangedWcd, RangedEcd, Rcd = 0, 0, 0, 0
local initDone, target1, target2, target3 = false, nil, nil, nil
local lastAnimation = nil
local lastAttack = 0
local lastAttackCD = 0
local ignite
local lastWindUpTime = 0
local Target
local eneplayeres = {}
local Config
local QReady, WReady, EReady, RReady = false, false, false, false
local GateObject = nil
local JayceWBuffed = false
local informationTable = {}
local spellExpired = true
local ignite, igniteReady = nil, nil
if VIP_USER then
VP = VPrediction()
if VP.version < 2.404 then
print('You need latest version of VPREDICTION (2.404 or above) for this script to function')
end
else
tp1 = TargetPrediction(1150, 1.3, 151, 70, 50)
tp2 = TargetPrediction(1750, 2.35, 151, 70, 50)
end
function Init()
--print('Init called')
--Start Vadash Credit
for i = 1, heroManager.iCount do
local hero = heroManager:GetHero(i)
if hero.team ~= player.team then
table.insert(eneplayeres, hero)
kalmanFilters[hero.networkID] = Kalman()
velocityTimers[hero.networkID] = 0
oldPosx[hero.networkID] = 0
oldPosz[hero.networkID] = 0
oldTick[hero.networkID] = 0
velocity[hero.networkID] = 0
lastboost[hero.networkID] = 0
end
end
--End Vadash Credit
ts = TargetSelector(TARGET_LESS_CAST_PRIORITY, 650, DAMAGE_PHYSICAL)
ts2 = TargetSelector(TARGET_LESS_CAST_PRIORITY, 1750, DAMAGE_PHYSICAL)
ts3 = TargetSelector(TARGET_LESS_CAST_PRIORITY, 600, DAMAGE_PHYSICAL)
ts.name = "Ranged Main"
ts2.name = "Ranged Q"
ts3.name = "Hammer Main"
Config:addTS(ts3)
Config:addTS(ts2)
Config:addTS(ts)
EnemyMinions = minionManager(MINION_ENEMY, 1200, myHero, MINION_SORT_MAXHEALTH_DEC)
JungleMinions = minionManager(MINION_JUNGLE, 1200, myHero, MINION_SORT_MAXHEALTH_DEC)
initDone = true
print('Dienofail Jayce ' .. tostring(version) .. ' loaded!')
-- if VIP_USER then
-- AdvancedCallback:bind('OnGainBuff', function(unit, buff) OnGainBuff(unit, buff) end)
-- AdvancedCallback:bind('OnLoseBuff', function(unit, buff) OnLoseBuff(unit, buff) end)
-- end
end
function Menu()
Config = scriptConfig("Jayce", "Jayce")
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:addParam("CastQ", "Cast Q to mouse cursor", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('T'))
Config:addParam("Escape", "Emergency Escape", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('X'))
--Config:addParam("ManualQSplit", "QSplit", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('T'))
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 options
Config.ComboSub:addParam("useRangedQ", "Use Ranged Q", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("useRangedW", "Use Ranged W", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("useRangedE", "Use Ranged E", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("useHammerQ", "Use Hammer Q", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("useHammerW", "Use Hammer W", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("useHammerE", "Use Hammer E", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("useHammerEKnockback", "Only use Hammer E before Transform", SCRIPT_PARAM_ONOFF, false)
Config.ComboSub:addParam("ConsumeW", "Consume W in range beforeswap", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("MinEnemies", "Min enemies for always Hammer", SCRIPT_PARAM_SLICE, 3, 0, 5, 0)
Config.ComboSub:addParam("MaxDistance", "Distance before Hammer Swap", SCRIPT_PARAM_SLICE, 500, 100, 600, 0)
Config.ComboSub:addParam("useR", "Use R (auto transform)", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("useWReset", "Use W as auto reset", SCRIPT_PARAM_ONOFF, true)
Config.ComboSub:addParam("Orbwalk", "Orbwalk", SCRIPT_PARAM_ONOFF, false)
--Farm
Config.FarmSub:addParam("useQ", "Use Q both forms", SCRIPT_PARAM_ONOFF, true)
Config.FarmSub:addParam("useW", "Use W both forms", SCRIPT_PARAM_ONOFF, true)
Config.FarmSub:addParam("useR", "Use R (auto transform)", SCRIPT_PARAM_ONOFF, true)
--Harass
Config.HarassSub:addParam("Orbwalk", "Orbwalk", SCRIPT_PARAM_ONOFF, false)
--KS
Config.KS:addParam("useRangedQ", "Use Ranged Q", SCRIPT_PARAM_ONOFF, true)
Config.KS:addParam("useHammerQ", "Use Hammer Q", SCRIPT_PARAM_ONOFF, true)
Config.KS:addParam("useHammerE", "Use Hammer E", SCRIPT_PARAM_ONOFF, true)
Config.KS:addParam("useR", "Swap form to KS", SCRIPT_PARAM_ONOFF, true)
Config.KS:addParam("Ignite", "Use Ignite", SCRIPT_PARAM_ONOFF, true)
--Draw
Config.Draw:addParam("DrawQ", "Draw Ranged Q Normal Range", SCRIPT_PARAM_ONOFF, true)
Config.Draw:addParam("DrawQ2", "Draw Ranged Q Boosted Range", SCRIPT_PARAM_ONOFF, true)
Config.Draw:addParam("DrawQ3", "Draw Hammer Q Range", SCRIPT_PARAM_ONOFF, false)
Config.Draw:addParam("DrawTarget", "Draw Ranged Q Target", SCRIPT_PARAM_ONOFF, true)
Config.Draw:addParam("DrawTarget2", "Draw Orbwalker Target", SCRIPT_PARAM_ONOFF, true)
Config.Draw:addParam("DrawCDCircles", "Draw CD Circles", SCRIPT_PARAM_ONOFF, false)
Config.Draw:addParam("DrawCDText", "Draw CD Text", SCRIPT_PARAM_ONOFF, true)
Config.Draw:addParam("DrawKSText", "Draw Hammer KS Text", SCRIPT_PARAM_ONOFF, true)
--Extras
Config.Extras:addParam("Debug", "Debug", SCRIPT_PARAM_ONOFF, false)
Config.Extras:addParam("GateDistance", "Gate Distance", SCRIPT_PARAM_SLICE, 275, 50, 600, 0)
Config.Extras:addParam("EGapClosers", "E Gapclosers(Hammer only)", SCRIPT_PARAM_ONOFF, false)
Config.Extras:addParam("MinHitchance", "Minimum Hit Chance", SCRIPT_PARAM_SLICE, 1, 0, 5, 0)
Config.Extras:addParam("mManager", "W and E mana slider", SCRIPT_PARAM_SLICE, 0, 0, 100, 0)
Config.Extras:addParam("ForceE", "Force Gate before Q", SCRIPT_PARAM_ONOFF, false)
Config.Extras:addParam("CheckAOE", "Check for AOE with ranged EQ", SCRIPT_PARAM_ONOFF, true)
--Permashow
Config:permaShow("Combo")
Config:permaShow("Farm")
Config:permaShow("Harass")
end
--Credit Trees
function GetCustomTarget()
ts:update()
ts2:update()
ts3: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
if isHammer then
return ts3.target
else
return ts.target
end
end
--End Credit Trees
function OnLoad()
Menu()
Init()
end
function WReset()
if Config.ComboSub.useWReset then
if _G.MMA_Target ~= nil and _G.MMA_AbleToMove and not _G.MMA_AttackAvailable 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
else
return true
end
end
function OnTick()
if initDone then
CheckSpellState()
CheckStatesReady()
CheckForm()
UpdateSpeed()
Checks()
target = GetCustomTarget()
Qtarget = ts2.target
KillSteal()
EnemyMinions:update()
JungleMinions:update()
if Config.CastQ then
CastRangedQMouse()
end
if Config.Combo then
if target ~= nil and ValidTarget(target) then
if ValidTarget(target) and target ~= nil then
Combo(target)
end
if Config.ComboSub.Orbwalk and ValidTarget(target) and target ~= nil then
OrbWalking(target)
end
end
if Qtarget ~= nil and ValidTarget(Qtarget) and not Qtarget.dead then
if GetDistance(Qtarget) > 600 and isHammer and HammerAllReady and RangedAllReady and Config.ComboSub.useR and Config.ComboSub.MinEnemies >= CountEnemyNearPerson(myHero, 750) then
CastR('Ranged')
end
if ValidTarget(Qtarget) and Config.ComboSub.useRangedQ and Qtarget ~= nil and ValidTarget(Qtarget, 1750) then
CastRangedQ(Qtarget)
end
else
if isHammer and HammerAllReady and RangedAllReady and Config.ComboSub.useR and Config.ComboSub.MinEnemies >= CountEnemyNearPerson(myHero, 750) then
CastR('Ranged')
end
end
end
if Config.Harass then
if Qtarget ~= nil and ValidTarget(Qtarget) then
Harass(Qtarget)
if Config.HarassSub.Orbwalk and ValidTarget(target) and target ~= nil then
OrbWalking(Qtarget)
end
end
end
if Config.Farm then
Farm()
end
if Config.Escape then
Escape()
end
-- if Config.Extras.EGapClosers then
-- if not spellExpired and (GetTickCount() - informationTable.spellCastedTick) <= (informationTable.spellRange/informationTable.spellSpeed)*1000 then
-- local spellDirection = (informationTable.spellEndPos - informationTable.spellStartPos):normalized()
-- local spellStartPosition = informationTable.spellStartPos + spellDirection
-- local spellEndPosition = informationTable.spellStartPos + spellDirection * informationTable.spellRange
-- local heroPosition = Point(myHero.x, myHero.z)
-- local lineSegment = LineSegment(Point(spellStartPosition.x, spellStartPosition.y), Point(spellEndPosition.x, spellEndPosition.y))
-- --lineSegment:draw(ARGB(255, 0, 255, 0), 70)
-- if lineSegment:distance(heroPosition) <= 200 and HammerEReady and isHammer then
-- --print('Dodging dangerous spell with E')
-- CastSpell(_E, spellSource)
-- end
-- else
-- spellExpired = true
-- informationTable = {}
-- end
-- end
end
end
function CheckWBuffStatus()
if JayceWBuffed and Config.ComboSub.ConsumeW then
return true
else
return false
end
end
function Combo(Target)
if isHammer then
if Config.ComboSub.useHammerQ then
CastHammerQ(Target)
end
if Config.ComboSub.useHammerW then
CastHammerW(Target)
end
if Config.ComboSub.useHammerE then
if not Config.ComboSub.useHammerEKnockback and not CheckWBuffStatus() then
CastHammerE(Target)
elseif Config.ComboSub.useHammerEKnockback and RangedCombatReady then
CastHammerE(Target)
end
end
if Config.ComboSub.useR then
if not HammerAllReady and RangedCombatReady and Config.ComboSub.MinEnemies >= CountEnemyNearPerson(myHero, 750) then
CastR('Ranged')
end
end
else
if Config.ComboSub.useRangedQ then
CastRangedQ(Target)
end
if Config.ComboSub.useRangedW and GetDistance(Target) < 600 and WReset() then
CastRangedW()
end
if Config.ComboSub.useR then
if not RangedAllReady and HammerAllReady and not CheckWBuffStatus() and GetDistance(Target) < Config.ComboSub.MaxDistance then
CastR('Hammer')
elseif CountEnemyNearPerson(myHero, 750) > Config.ComboSub.MinEnemies and not RangedAllReady and not CheckWBuffStatus() and GetDistance(Target) < Config.ComboSub.MaxDistance then
CastR('Hammer')
elseif not RangedCombatReady and HammerCombatReady and not CheckWBuffStatus and GetDistance(Target) < 300 then
CastR('Hammer')
end
end
end
end
function Harass(Target)
if isHammer then
CastR('Ranged')
end
if not isHammer and HaveLowVelocity(Target, 750) then
CastRangedQ(Target)
end
end
function Escape()
if isHammer then
if HammerEReady and EReady and target ~= nil then
CastSpell(_E, target)
else
CastR('Ranged')
end
else
CastSpell(_E, myHero.x, myHero.z)
end
end
function OnGainBuff(unit, buff)
if unit.isMe and buff.name == 'jaycehypercharge' then
JayceWBuffed = true
end
end
function OnLoseBuff(unit, buff)
if unit.isMe and buff.name == 'jaycehypercharge' then
JayceWBuffed = false
end
end
function Farm()
if Config.FarmSub.useQ then
FarmQ()
end
if Config.FarmSub.useW then
CastSpell(_W)
end
if Config.FarmSub.useR then
if isHammer and not HammerCombatReady and RangedCombatReady then
CastR('Ranged')
elseif not isHammer and HammerCombatReady and not RangedCombatReady then
CastR('Hammer')
end
end
end
function FarmQ()
if QReady and #EnemyMinions.objects > 0 then
local QPos = GetBestQPositionFarm()
if QPos then
if not isHammer then
CastEQFarm(QPos)
else
CastSpell(_Q, QPos.x, QPos.z)
end
end
end
end
--Honda7
function GetBestQPositionFarm()
local MaxQ = 0
local MaxQPos
if Config.Extras.Debug then
print('GetBestQPositionFarm')
end
for i, minion in pairs(EnemyMinions.objects) do
local hitQ = countminionshitQ(minion)
if hitQ ~= nil and hitQ > MaxQ or MaxQPos == nil then
MaxQPos = minion
MaxQ = hitQ
end
end
if MaxQPos then
local CastPosition = MaxQPos
return CastPosition
else
return nil
end
end
function countminionshitQ(pos)
local n = 0
for i, minion in ipairs(EnemyMinions.objects) do
if GetDistance(minion, pos) < SpellRangedQ1.Width then
n = n +1
end
end
return n
end
function CastEQFarm(pos)
if not isHammer and RangedQReady then
if Config.Extras.Debug then
print('Generating Gate Vector')
end
local GateVector = Vector(myHero) + Vector(Vector(pos) - Vector(myHero)):normalized()*Config.Extras.GateDistance
if Config.Extras.Debug then
print(GateVector)
end
if Config.Extras.ForceE then
CastSpell(_E, GateVector.x, GateVector.z)
if GateObject ~= nil then
CastSpell(_Q, pos.x, pos.z)
end
else
CastSpell(_Q, pos.x, pos.z)
CastSpell(_E, GateVector.x, GateVector.z)
end
end
end
function KillSteal()
local Enemies = GetEnemyHeroes()
for idx, champ in ipairs(Enemies) do
if champ.health < getDmg("QM", champ, myHero) and Config.KS.useHammerQ and not champ.dead and ValidTarget(champ, 1500) then
if isHammer and GetDistance(champ) < SpellHammerQ.Range then
CastSpell(_Q, champ)
elseif not isHammer and GetDistance(champ) < 600 and Config.KS.useR then
CastR('Hammer')
end
end
if champ.health < getDmg("EM", champ, myHero) and Config.KS.useHammerE and not champ.dead and ValidTarget(champ, 1500) then
if isHammer and GetDistance(champ) < SpellHammerE.Range and Config.KS.useHammerE then
CastSpell(_E, champ)
elseif not isHammer and GetDistance(champ) < 400 and Config.KS.useR and Config.KS.useHammerE then
CastR('Hammer')
end
end
if champ.health < getDmg("Q", champ, myHero) and Config.KS.useRangedQ and not champ.dead and ValidTarget(champ, 1500) then
if isHammer and GetDistance(champ) < SpellRangedQ1.Range-150 and Config.KS.useR then
CastR('Ranged')
elseif not isHammer and GetDistance(champ) < SpellRangedQ1.Range then
CastRangedQ(champ)
end
end
end
if Config.KS.Ignite then
IgniteKS()
end
end
function IgniteKS()
if igniteReady then
local Enemies = GetEnemyHeroes()
for idx,val in ipairs(Enemies) do
if ValidTarget(val, 600) then
if getDmg("IGNITE", val, myHero) > val.health and GetDistance(val) <= 600 then
CastSpell(ignite, val)
end
end
end
end
end
function CastRangedQ(Target)
if VIP_USER and QReady and not isHammer and (EReady or GateObject ~= nil) and Target ~= nil then
local targetpos, hitchance, realpos = VP:GetLineCastPosition(Target, SpellRangedQ2.Delay, SpellRangedQ2.Width, SpellRangedQ2.Range, SpellRangedQ2.Speed, myHero, true)
if hitchance >= Config.Extras.MinHitchance then
local GateVector = Vector(myHero) + Vector(Vector(targetpos) - Vector(myHero)):normalized()*Config.Extras.GateDistance
--double check
local col1 = VP:CheckMinionCollision(myHero, GateVector, SpellRangedQ1.Delay, SpellRangedQ1.Delay, GetDistance(myHero, GateVector), SpellRangedQ1.Delay, myHero, false)
if not col1 then
local additional_delay = GetDistance(GateVector)/SpellRangedQ1.Speed + SpellRangedQ1.Delay + 0.250
local Final_Vector, Final_Hitchance, Final_Pos = VP:GetLineCastPosition(Target, additional_delay, SpellRangedQ2.Width, SpellRangedQ2.Range, SpellRangedQ2.Speed, GateVector, true)
if Final_Vector ~= nil and Final_Hitchance ~= nil and EReady and GetDistance(Final_Vector) < SpellRangedQ2.Range and Final_Hitchance >= Config.Extras.MinHitchance then
local GateVector2 = Vector(myHero) + Vector(Vector(Final_Vector) - Vector(myHero)):normalized()*Config.Extras.GateDistance
CastSpell(_E, GateVector2.x, GateVector2.z)
end
if not Config.Extras.ForceE then
CastSpell(_Q, Final_Vector.x, Final_Vector.z)
end
if GateObject ~= nil and GetDistance(Final_Vector) < SpellRangedQ2.Range and Config.Extras.ForceE then
CastSpell(_Q, Final_Vector.x, Final_Vector.z)
end
end
end
elseif not VIP_USER and QReady and not isHammer and (EReady or GateObject ~= nil) and Target ~= nil then
local Predicted_Pos, a, b = tp2:GetPrediction(Target)
if EReady and GetDistance(Predicted_Pos) < SpellRangedQ2.Range then
local GateVector2 = Vector(myHero) + Vector(Vector(Predicted_Pos) - Vector(myHero)):normalized()*Config.Extras.GateDistance
if not Config.Extras.ForceE then
CastSpell(_Q, Predicted_Pos.x, Predicted_Pos.z)
end
CastSpell(_E, GateVector2.x, GateVector2.z)
end
if GateObject ~= nil and GetDistance(Predicted_Pos) < SpellRangedQ2.Range then
CastSpell(_Q, Predicted_Pos.x, Predicted_Pos.z)
end
end
if VIP_USER and QReady and not EReady and GateObject == nil and not isHammer then
local predicted_pos, predicted_hitchance, predicted_loc = VP:GetLineCastPosition(Target, SpellRangedQ1.Delay, SpellRangedQ1.Width, SpellRangedQ1.Range, SpellRangedQ1.Speed, myHero, true)
if predicted_hitchance >= Config.Extras.MinHitchance and GetDistance(predicted_pos) < SpellRangedQ1.Range then
CastSpell(_Q, predicted_pos.x, predicted_pos.z)
end
elseif not VIP_USER and QReady and not EReady and GateObject == nil and not isHammer then
local Predicted_Pos, a, b = tp1:GetPrediction(Target)
if GetDistance(Predicted_Pos) < SpellRangedQ1.Range then
CastSpell(_Q, Predicted_Pos.x, Predicted_Pos.z)
end
end
end
function CastRangedQMouse()
-- if Config.Extras.Debug then
-- print('Cast Ranged Q mouse called')
-- end
if isHammer and RangedQReady then
CastR('Ranged')
if Config.Extras.Debug then
print('Cast Ranged Q mouse conversion called')
end
end
if not isHammer and RangedQReady then
if Config.Extras.Debug then
print('Generating Gate Vector')
end
local GateVector = Vector(myHero) + Vector(Vector(mousePos) - Vector(myHero)):normalized()*Config.Extras.GateDistance
if Config.Extras.Debug then
print(GateVector)
end
if Config.Extras.ForceE then
CastSpell(_E, GateVector.x, GateVector.z)
if GateObject ~= nil then
CastSpell(_Q, mousePos.x, mousePos.z)
end
else
CastSpell(_Q, mousePos.x, mousePos.z)
CastSpell(_E, GateVector.x, GateVector.z)
end
end
end
function CastRangedW()
if WReady and not isHammer and not IsMyManaLow() then
CastSpell(_W)
end
end
function CastHammerQ(Target)
if QReady and isHammer and GetDistance(Target) < 600 and not IsMyManaLow() then
CastSpell(_Q, Target)
end
end
function CastHammerW(Target)
if WReady and isHammer and GetDistance(Target) < 300 and not IsMyManaLow() then
CastSpell(_W)
end
end
function CastHammerE(Target)
if EReady and isHammer and GetDistance(Target) < 250 and not IsMyManaLow() then
CastSpell(_E, Target)
end
end
function round(num, idp)
return string.format("%." .. (idp or 0) .. "f", num)
end
function OnDraw()
if Config.Extras.Debug then
DrawText3D("Current JayceWBuffed status is " .. tostring(JayceWBuffed), myHero.x+200, myHero.y, myHero.z+200, 25, ARGB(255,255,0,0), true)
DrawText('Hammer Q ready is ' .. tostring(HammerQReady) .. ' ' .. tostring(RangedQReady) .. ' ' .. tostring(HammerWReady) .. ' ' .. tostring(RangedWReady) .. ' ' .. tostring(HammerEReady) .. ' ' .. tostring(RangedEReady) .. ' RReady ' .. tostring(RReady), 15, 300, 300, ARGB(255,0,255,0))
DrawText('RangedCombatReady ' .. tostring(RangedCombatReady) .. ' Hammer Combat Status ' .. tostring(HammerAllReady) .. ' ' .. tostring(CountEnemyNearPerson(myHero, 750)), 25, 200, 200, ARGB(255,0,255,0))
-- DrawText(tostring(GetTickCount()), 25, 450, 450, ARGB(255,0,255,0))
DrawText('HammerQcd ' .. tostring(HammerQcd) .. ' ' .. tostring(HammerWcd), 25, 350, 350, ARGB(255,0,255,0))
DrawText('RangedQcd ' .. tostring(RangedQcd) .. ' ' .. tostring(RangedWcd), 25, 400, 400, ARGB(255,0,255,0))
if GateObject ~= nil then
DrawCircle3D(GateObject.x, GateObject.y, GateObject.z, 100, 1, ARGB(255, 0, 255, 255))
end
end
if Config.Draw.DrawCDCircles then
for i = 0, 30 do
if isHammer then
if RangedQReady then
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,0,255,0) )
else
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,255,0,0) )
end
else
if HammerQReady then
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,0,255,0) )
else
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,255,0,0) )
end
end
end
for i = 31, 60 do
if isHammer then
if RangedWReady then
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,0,255,0) )
else
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,255,0,0) )
end
else
if HammerWReady then
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,0,255,0) )
else
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,255,0,0) )
end
end
end
for i = 61, 90 do
if isHammer then
if RangedEReady then
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,0,255,0) )
else
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,255,0,0) )
end
else
if HammerEReady then
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,0,255,0) )
else
DrawCircle(myHero.x, myHero.y, myHero.z, 100+i, ARGB(255,255,0,0) )
end
end
end
end
if Config.Draw.DrawCDText then
local current_tick = GetTickCount()
if isHammer then
if RangedQReady then
DrawText3D('QReady', myHero.x-100, myHero.y, myHero.z, 15, ARGB(255,0,255,0), true)
else
local remaining_cd = (RangedQcd - current_tick)/1000
DrawText3D(round(remaining_cd, 1), myHero.x-100, myHero.y, myHero.z, 15, ARGB(255,255,0,0), true)
end
if RangedWReady then
DrawText3D('WReady', myHero.x, myHero.y, myHero.z, 15, ARGB(255,0,255,0), true)
else
local remaining_cd = (RangedWcd - current_tick)/1000
DrawText3D(round(remaining_cd, 1), myHero.x, myHero.y, myHero.z, 15, ARGB(255,255,0,0), true)
end
if RangedEReady then
DrawText3D('EReady', myHero.x+100, myHero.y, myHero.z, 15, ARGB(255,0,255,0), true)
else
local remaining_cd = (RangedEcd - current_tick)/1000
DrawText3D(round(remaining_cd, 1), myHero.x+100, myHero.y, myHero.z, 15, ARGB(255,255,0,0), true)
end
else
if HammerQReady then
DrawText3D('QReady', myHero.x-100, myHero.y, myHero.z, 15, ARGB(255,0,255,0), true)
else
local remaining_cd = (HammerQcd - current_tick)/1000
DrawText3D(round(remaining_cd, 1), myHero.x-100, myHero.y, myHero.z, 15, ARGB(255,255,0,0), true)
end
if HammerWReady then
DrawText3D('WReady', myHero.x, myHero.y, myHero.z, 15, ARGB(255,0,255,0), true)
else
local remaining_cd = (HammerWcd - current_tick)/1000
DrawText3D(round(remaining_cd, 1), myHero.x, myHero.y, myHero.z, 15, ARGB(255,255,0,0), true)
end
if HammerEReady then
DrawText3D('EReady', myHero.x+100, myHero.y, myHero.z, 15, ARGB(255,0,255,0), true)
else
local remaining_cd = (HammerEcd - current_tick)/1000
DrawText3D(round(remaining_cd, 1), myHero.x+100, myHero.y, myHero.z, 15, ARGB(255,255,0,0), true)
end
end
end
if Config.Draw.DrawKSText then
local Enemies = GetEnemyHeroes()
for idx, champ in ipairs(Enemies) do
if champ.health < getDmg("QM", champ, myHero) + getDmg("EM", champ, myHero) and not champ.dead and ValidTarget(champ, 1500) then
DrawText3D('Killable with Hammer Q+E', champ.x, champ.y, champ.z, 15, ARGB(255,255,0,0), true)
end
end
end
if Config.Draw.DrawQ then
DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellRangedQ1.Range, 1, ARGB(255, 0, 255, 255))
end
if Config.Draw.DrawQ2 then
DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellRangedQ2.Range, 1, ARGB(255, 0, 255, 255))
end
if Config.Draw.DrawQ3 then
DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellHammerQ.Range, 1, ARGB(255, 0, 255, 255))
end
if Config.DrawTarget and ValidTarget(target) then
DrawCircle3D(target.x, target.y, target.z, 50, 1, ARGB(255, 255, 255, 255))
end
if Config.DrawTarget2 and ValidTarget(Qtarget) then
DrawCircle3D(Qtarget.x, Qtarget.y, Qtarget.z, 50, 1, ARGB(255, 255, 255, 255))
end
end
function OnCreateObj(obj)
if obj.name == 'jayce_accel_gate_start.troy' and obj.team ~= TEAM_ENEMY and GetDistance(obj) < 700 then
GateObject = obj
end
end
function OnDeleteObj(obj)
if obj.name == 'jayce_accel_gate_start.troy' and obj.team ~= TEAM_ENEMY then
GateObject = nil
end
end
function CheckStatesReady()
if myHero.level == 1 or myHero.level == 2 then
if HammerQReady or HammerWReady or HammerEReady then
HammerCombatReady = true
HammerAllReady = true
else
HammerCombatReady = false
HammerAllReady = false
end
if RangedQReady or RangedWReady or RangedEReady then
RangedCombatReady = true
RangedAllReady = true
else
RangedCombatReady = false
RangedAllReady = false
end
else
if HammerQReady and (HammerWReady or HammerEReady) then
HammerCombatReady = true
else
HammerCombatReady = false
end
if HammerQReady and HammerWReady and HammerEReady then
HammerAllReady = true
else
HammerAllReady = false
end
if RangedQReady and (RangedWReady or RangedEReady) then
RangedCombatReady = true
else
RangedCombatReady = false
end
if RangedQReady and RangedWReady and RangedEReady then
RangedAllReady = true
else
RangedAllReady = false
end
end
end
function CalculateRealCD(total_cd)
current_cd = myHero.cdr
real_cd = total_cd - total_cd * current_cd
return real_cd
end
function Checks()
QReady = (myHero:CanUseSpell(_Q) == READY)
WReady = (myHero:CanUseSpell(_W) == READY)
EReady = (myHero:CanUseSpell(_E) == READY)
RReady = (myHero:CanUseSpell(_R) == READY)
if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then
ignite = SUMMONER_1
elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then
ignite = SUMMONER_2
end
igniteReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
end
function CastR(form)
if RReady and form == 'Hammer' then
if not isHammer then
CastSpell(_R)
end
elseif RReady and form == 'Ranged' then
if isHammer then
CastSpell(_R)
if Config.Extras.Debug then
print('Calling transform to ranged')
end
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
end
end
if isHammer then
if unit.isMe and spell.name == 'JayceToTheSkies' then
HammerQcd = GetTickCount() + CalculateRealCD(HammerTrueQcd[myHero:GetSpellData(_Q).level])
end
if unit.isMe and spell.name == 'JayceStaticField' then
HammerWcd = GetTickCount() + CalculateRealCD(HammerTrueWcd)
--print('Hammer W Cast')
end
if unit.isMe and spell.name =='JayceThunderingBlow' then
HammerEcd = GetTickCount() + CalculateRealCD(HammerTrueEcd[myHero:GetSpellData(_E).level])
end
if unit.isMe and spell.name == 'Jayce StanceHTG' then
Rcd = GetTickCount() + CalculateRealCD(RTruecd)
end
elseif not isHammer then
if unit.isMe and spell.name =='jayceshockblast' then
RangedQcd = GetTickCount() + CalculateRealCD(RangedTrueQcd)
end
if unit.isMe and spell.name == 'jaycehypercharge' then
--print('Ranged W Cast')
JayceWBuffed = true
RangedWcd = GetTickCount() + CalculateRealCD(RangedTrueWcd[myHero:GetSpellData(_W).level])
end
if unit.isMe and spell.name == 'jayceaccelerationgate' then
RangedEcd = GetTickCount() + CalculateRealCD(RangedTrueEcd)
--print(CalculateRealCD(RangedTrueEcd[myHero:GetSpellData(_E).level]))
end
if unit.isMe and spell.name == 'jaycestancegth' then
Rcd = GetTickCount() + CalculateRealCD(RTruecd)
end
end
--Mancusizz
-- if Config.Extras.EGapClosers then
-- local jarvanAddition = unit.charName == "JarvanIV" and unit:CanUseSpell(_Q) ~= READY and _R or _Q -- Did not want to break the table below.
-- local isAGapcloserUnit = {
-- -- ['Ahri'] = {true, spell = _R, range = 450, projSpeed = 2200},
-- ['Aatrox'] = {true, spell = _Q, range = 1000, projSpeed = 1200, },
-- ['Akali'] = {true, spell = _R, range = 800, projSpeed = 2200, }, -- Targeted ability
-- ['Alistar'] = {true, spell = _W, range = 650, projSpeed = 2000, }, -- Targeted ability
-- ['Diana'] = {true, spell = _R, range = 825, projSpeed = 2000, }, -- Targeted ability
-- ['Gragas'] = {true, spell = _E, range = 600, projSpeed = 2000, },
-- ['Hecarim'] = {true, spell = _R, range = 1000, projSpeed = 1200, },
-- ['Irelia'] = {true, spell = _Q, range = 650, projSpeed = 2200, }, -- Targeted ability
-- ['JarvanIV'] = {true, spell = jarvanAddition, range = 770, projSpeed = 2000, }, -- Skillshot/Targeted ability
-- ['Jax'] = {true, spell = _Q, range = 700, projSpeed = 2000, }, -- Targeted ability
-- ['Jayce'] = {true, spell = 'JayceToTheSkies', range = 600, projSpeed = 2000, }, -- Targeted ability
-- ['Khazix'] = {true, spell = _E, range = 900, projSpeed = 2000, },
-- ['Leblanc'] = {true, spell = _W, range = 600, projSpeed = 2000, },
-- ['LeeSin'] = {true, spell = 'blindmonkqtwo', range = 1300, projSpeed = 1800, },
-- ['Leona'] = {true, spell = _E, range = 900, projSpeed = 2000, },
-- ['Malphite'] = {true, spell = _R, range = 1000, projSpeed = 1500 + unit.ms},
-- ['Maokai'] = {true, spell = _Q, range = 600, projSpeed = 1200, }, -- Targeted ability
-- ['MonkeyKing'] = {true, spell = _E, range = 650, projSpeed = 2200, }, -- Targeted ability
-- ['Pantheon'] = {true, spell = _W, range = 600, projSpeed = 2000, }, -- Targeted ability
-- ['Poppy'] = {true, spell = _E, range = 525, projSpeed = 2000, }, -- Targeted ability
-- --['Quinn'] = {true, spell = _E, range = 725, projSpeed = 2000, }, -- Targeted ability
-- ['Renekton'] = {true, spell = _E, range = 450, projSpeed = 2000, },