-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathExtendedQ.cs
165 lines (132 loc) · 5.1 KB
/
ExtendedQ.cs
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
namespace KoreanLucian
{
using System;
using System.Collections.Generic;
using System.Linq;
using KoreanCommon;
using LeagueSharp;
using LeagueSharp.Common;
using SharpDX;
internal static class ExtendedQ
{
private static readonly Spell AdvancedQ = new Spell(SpellSlot.Q, 1100);
private static readonly Func<Obj_AI_Hero, Obj_AI_Base, bool> CheckDistance =
(champ, minion) =>
Math.Abs(
champ.Distance(ObjectManager.Player) - (minion.Distance(ObjectManager.Player) + minion.Distance(champ)))
<= 2;
private static readonly Func<Vector3, Vector3, Vector3, bool> CheckLine = (v1, v2, v3) =>
{
float valor =
Math.Abs(
(v1.X * v2.Y) + (v1.Y * v3.X) + (v2.X * v3.Y) - (v1.Y * v2.X) - (v1.X * v3.Y) - (v2.Y * v3.X));
return valor > 500 && valor <= 2000;
};
public static void Load(CommonChampion lucian)
{
if (KoreanUtils.GetParamKeyBind(lucian.MainMenu, "toggleextendedq"))
{
Game.OnUpdate += AutoExtendedQ;
}
}
public static void AutoExtendedQ(EventArgs args)
{
Program.ChampionLucian.CastExtendedQ(true);
}
private static bool CheckHaras(CommonChampion lucian, Obj_AI_Hero target)
{
if (target == null)
{
return false;
}
return KoreanUtils.GetParamBool(lucian.MainMenu, target.ChampionName.ToLowerInvariant());
}
private static bool ExtendedQIsReady(CommonChampion lucian, bool laneclear = false)
{
Spell q = lucian.Spells.Q;
if (!KoreanUtils.GetParamBool(lucian.MainMenu, "extendedq") || !q.IsReady())
{
return false;
}
List<Obj_AI_Base> minions = MinionManager.GetMinions(AdvancedQ.Range);
if (minions.Count == 0)
{
return false;
}
if (!laneclear)
{
if (lucian.Player.CountEnemiesInRange(AdvancedQ.Range) == 0)
{
return false;
}
}
return true;
}
public static bool CastExtendedQ(this CommonChampion lucian, bool Haras = false)
{
if (!ExtendedQIsReady(lucian))
{
return false;
}
if (Haras && ((Lucian)lucian).core.HaveManaToHaras() == false)
{
return false;
}
Spell q = lucian.Spells.Q;
AdvancedQ.SetSkillshot(0.55f, 75f, float.MaxValue, false, SkillshotType.SkillshotLine);
foreach (Obj_AI_Hero target in lucian.Player.GetEnemiesInRange(AdvancedQ.Range))
{
if (!CheckHaras(lucian, target))
{
continue;
}
List<Vector2> position = new List<Vector2> { target.Position.To2D() };
Obj_AI_Base colisionMinion =
AdvancedQ.GetCollision(lucian.Player.Position.To2D(), position)
.FirstOrDefault(
minion =>
q.CanCast(minion) && q.IsInRange(minion)
&& CheckLine(lucian.Player.Position, minion.Position, target.ServerPosition)
&& CheckDistance(target, minion)
&& target.Distance(lucian.Player) > minion.Distance(lucian.Player)
&& lucian.Player.Distance(minion) + minion.Distance(target)
<= lucian.Player.Distance(target) + 10f);
if (colisionMinion != null)
{
return q.CastOnUnit(colisionMinion);
}
}
return false;
}
public static bool CastExtendedQToLaneClear(this CommonChampion lucian)
{
if (!ExtendedQIsReady(lucian, true) || !lucian.Spells.Q.UseOnLaneClear)
{
return false;
}
AdvancedQ.SetSkillshot(0.55f, 75f, float.MaxValue, false, SkillshotType.SkillshotLine);
List<Obj_AI_Base> minionsBase = MinionManager.GetMinions(
lucian.Player.Position,
AdvancedQ.Range,
MinionTypes.All,
MinionTeam.NotAlly,
MinionOrderTypes.MaxHealth);
if (minionsBase.Count == 0)
{
return false;
}
Spell q = lucian.Spells.Q;
foreach (Obj_AI_Base minion in minionsBase.Where(x => q.IsInRange(x)))
{
if (AdvancedQ.CountHits(minionsBase, minion.Position)
>= KoreanUtils.GetParamSlider(lucian.MainMenu, "qcounthit"))
{
q.CastOnUnit(minion);
Orbwalking.ResetAutoAttackTimer();
return true;
}
}
return false;
}
}
}