Riven Script test 1


SUBMITTED BY: Guest

DATE: Dec. 14, 2014, 9:45 p.m.

FORMAT: C#

SIZE: 32.1 kB

HITS: 352698

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using LeagueSharp;
  7. using LeagueSharp.Common;
  8. using SharpDX;
  9. using Color = System.Drawing.Color;
  10. namespace LSharpTest
  11. {
  12. class Program
  13. {
  14. public const string Revision = "1.0b";
  15. private static Obj_AI_Hero myChamp = ObjectManager.Player;
  16. private static Orbwalking.Orbwalker orbwalker;
  17. private static Spell[] Skills = {new Spell(SpellSlot.Q, 260), new Spell(SpellSlot.W, 250), new Spell(SpellSlot.E, 325), new Spell(SpellSlot.R, 900)};
  18. private static Items.Item Tiamat = new Items.Item(3077, 400);
  19. private static Items.Item Hydra = new Items.Item(3074, 400);
  20. private static Items.Item Ghostblade = new Items.Item(3142, 600);
  21. private static Menu Config;
  22. //private static bool ProcessPackets;
  23. private static int qCount;
  24. private static int passive;
  25. private static int lastQCast;
  26. private static bool ultiOn;
  27. private static bool ultiReady;
  28. private static bool ProcessPackets;
  29. private static Spell nextSpell;
  30. private static Spell lastSpell;
  31. private static string lastSpellName;
  32. private static bool UseAttack;
  33. private static bool useTiamat;
  34. private static bool IsKSing;
  35. private static Obj_AI_Base currentTarget;
  36. private static int lastGapClose;
  37. private static bool IsRecalling;
  38. public static void Main(string[] args)
  39. {
  40. CustomEvents.Game.OnGameLoad += OnLoad;
  41. }
  42. private static void OnLoad(EventArgs args)
  43. {
  44. if (myChamp.ChampionName != "Riven")
  45. return;
  46. if (Utility.Map.GetMap()._MapType != Utility.Map.MapType.SummonersRift)
  47. {
  48. Game.PrintChat("Classy Riven is currently for Summoners Rift only. I'm sorry!");
  49. return;
  50. }
  51. Config = new Menu("Classy Riven", "Riven", true);
  52. Config.AddSubMenu(new Menu("Orbwalker", "Orbwalker"));
  53. orbwalker = new Orbwalking.Orbwalker(Config.SubMenu("Orbwalker"));
  54. var tsMenu = new Menu("Target", "Target Selector");
  55. SimpleTs.AddToMenu(tsMenu);
  56. Config.AddSubMenu(tsMenu);
  57. Config.AddToMainMenu();
  58. Config.AddSubMenu(new Menu("Combo Settings", "ComboS"));
  59. Config.AddSubMenu(new Menu("KS(ecure) Settings", "KS"));
  60. Config.AddSubMenu(new Menu("Draw Settings", "Draw"));
  61. Config.SubMenu("ComboS").AddItem(new MenuItem("UseUlti", "Use Ultimate in Combo").SetValue(true));
  62. Config.SubMenu("ComboS").AddItem(new MenuItem("UseQGapClose", "Use Q to gapclose").SetValue(true));
  63. Config.AddItem(new MenuItem("AutoStun", "Auto Stun (ex. Gap Closer)").SetValue(true));
  64. Config.SubMenu("KS").AddItem(new MenuItem("KillSecureRActivate", "Use Ultimate to Secure").SetValue(false));
  65. Config.SubMenu("KS").AddItem(new MenuItem("KillSecureR", "Secure with R2").SetValue(true));
  66. Config.SubMenu("KS").AddItem(new MenuItem("KillSecureQ", "Secure with Q").SetValue(true));
  67. Config.SubMenu("KS").AddItem(new MenuItem("KillSecureW", "Secure with W").SetValue(true));
  68. Config.SubMenu("KS").AddItem(new MenuItem("KillSecureT", "Secure with Tiamat").SetValue(true));
  69. Config.SubMenu("Draw").AddItem(new MenuItem("DrawTarget", "Draw current target").SetValue(new Circle(true, Color.FromKnownColor(System.Drawing.KnownColor.Green))));
  70. Config.SubMenu("Draw").AddItem(new MenuItem("lataaaa", "I'll add some more later"));
  71. Skills[3].SetSkillshot(0.25f, 60f, 2200, false, SkillshotType.SkillshotCone);
  72. Skills[2].SetSkillshot(0, 0, 1450, false, SkillshotType.SkillshotLine);
  73. Orbwalking.BeforeAttack += delegate(Orbwalking.BeforeAttackEventArgs __args)
  74. {
  75. if (!__args.Target.IsMinion)
  76. orbwalker.SetMovement(false);
  77. };
  78. Obj_AI_Base.OnProcessSpellCast += OnProcessSpell;
  79. Obj_AI_Base.OnPlayAnimation += OnAnimation;
  80. Game.OnGameUpdate += OnGameUpdate;
  81. Game.OnGameUpdate += Buffs_GameUpdate;
  82. Game.OnGameProcessPacket += OnGameProcessPacket;
  83. Game.OnWndProc += OnWndProc;
  84. Drawing.OnDraw += OnDraw;
  85. AntiGapcloser.OnEnemyGapcloser += OnEnemyGapCloser;
  86. Game.PrintChat(String.Format("Classy Riven v {0}; TheMarv approves!", Revision));
  87. }
  88. private static void OnDraw(EventArgs args)
  89. {
  90. if (Config.SubMenu("Draw").Item("DrawTarget").GetValue<Circle>().Active)
  91. {
  92. Utility.DrawCircle(currentTarget.ServerPosition, currentTarget.BoundingRadius + 10,
  93. Config.SubMenu("Draw").Item("DrawTarget").GetValue<Circle>().Color, 5);
  94. Utility.DrawCircle(currentTarget.ServerPosition, currentTarget.BoundingRadius + 25,
  95. Config.SubMenu("Draw").Item("DrawTarget").GetValue<Circle>().Color, 6);
  96. Utility.DrawCircle(currentTarget.ServerPosition, currentTarget.BoundingRadius + 45,
  97. Config.SubMenu("Draw").Item("DrawTarget").GetValue<Circle>().Color, 7);
  98. }
  99. }
  100. private static void Buffs_GameUpdate(EventArgs args)
  101. {
  102. bool ulti = false;
  103. bool ulti2 = false;
  104. bool q = false;
  105. BuffInstance[] buffList = myChamp.Buffs;
  106. foreach (BuffInstance buff in buffList)
  107. {
  108. if (buff.Name == "rivenpassiveaaboost")
  109. {
  110. passive = buff.Count;
  111. }
  112. if (buff.Name == "rivenwindslashready")
  113. {
  114. ulti = true;
  115. ultiReady = true;
  116. }
  117. if (buff.Name == "RivenTriCleave")
  118. {
  119. q = true;
  120. qCount = buff.Count;
  121. }
  122. if (buff.Name == "RivenFengShuiEngine")
  123. {
  124. ulti2 = true;
  125. ultiOn = true;
  126. }
  127. }
  128. if (q == false)
  129. qCount = 0;
  130. if (ulti == false)
  131. {
  132. ultiReady = false;
  133. IsKSing = false;
  134. }
  135. if (ulti2 == false)
  136. ultiOn = false;
  137. }
  138. public static void OnEnemyGapCloser(ActiveGapcloser gapcloser)
  139. {
  140. if (Skills[1].IsReady() && gapcloser.Sender.IsValidTarget(Skills[1].Range) &&
  141. Config.Item("AutoStun").GetValue<bool>())
  142. Skills[1].Cast();
  143. }
  144. private static void OnGameUpdate(EventArgs args)
  145. {
  146. bool combo = orbwalker.ActiveMode.ToString().ToLower().Contains("combo");
  147. //KillSecure();
  148. // AutoStun();
  149. if (combo)
  150. {
  151. if (currentTarget == null)
  152. AcquireTarget();
  153. if (currentTarget.IsDead || currentTarget.IsInvulnerable || !currentTarget.IsVisible || currentTarget.IsZombie || !currentTarget.IsValidTarget(Skills[2].Range + Skills[0].Range + myChamp.AttackRange))
  154. AcquireTarget();
  155. if (!currentTarget.IsDead && currentTarget.IsVisible)
  156. {
  157. GapClose(currentTarget);
  158. Combo(currentTarget);
  159. var playerPos = Drawing.WorldToScreen(myChamp.Position);
  160. Drawing.DrawText(playerPos.X - 65, playerPos.Y + 20, System.Drawing.Color.Red, "Target: {0}", currentTarget.BaseSkinName);
  161. }
  162. }
  163. else
  164. {
  165. orbwalker.SetMovement(true);
  166. }
  167. }
  168. private static void AutoStun()
  169. {
  170. foreach (Obj_AI_Hero enemy in ObjectManager.Get<Obj_AI_Hero>().Where(hero => hero.Team != myChamp.Team))
  171. {
  172. if (Skills[1].IsReady() && enemy.IsValidTarget(Skills[1].Range) &&
  173. Config.SubMenu("Misc").SubMenu("AutoStun").Item("Stun" + enemy.ChampionName).GetValue<bool>())
  174. {
  175. Skills[1].Cast();
  176. }
  177. }
  178. }
  179. private static void AcquireTarget()
  180. {
  181. currentTarget = SimpleTs.GetTarget(Skills[2].Range + Skills[0].Range + myChamp.AttackRange, SimpleTs.DamageType.Physical);
  182. }
  183. public static void Combo(Obj_AI_Base target)
  184. {
  185. double noRComboDmg = DamageCalcNoR(target);
  186. if (Skills[3].IsReady() && !ultiReady && noRComboDmg < target.Health && Config.SubMenu("ComboS").Item("UseUlti").GetValue<bool>() && currentTarget is Obj_AI_Hero)
  187. {
  188. Skills[3].Cast();
  189. }
  190. if (!(Tiamat.IsReady() || Hydra.IsReady()) && !Skills[0].IsReady() && Skills[1].IsReady() && currentTarget.IsValidTarget(Skills[1].Range))
  191. Skills[1].Cast();
  192. if (nextSpell == null && useTiamat)
  193. {
  194. if (Tiamat.IsReady())
  195. Tiamat.Cast();
  196. else if (Hydra.IsReady())
  197. Hydra.Cast();
  198. }
  199. if (nextSpell == null && UseAttack)
  200. {
  201. Orbwalking.LastAATick = Environment.TickCount + Game.Ping / 2;
  202. myChamp.IssueOrder(GameObjectOrder.AttackUnit, currentTarget);
  203. }
  204. if (nextSpell == Skills[0])
  205. {
  206. Skills[0].Cast(currentTarget.ServerPosition, true);
  207. nextSpell = null;
  208. }
  209. if (nextSpell == Skills[1])
  210. {
  211. Skills[1].Cast();
  212. nextSpell = null;
  213. }
  214. if (nextSpell == Skills[2])
  215. {
  216. Skills[2].Cast(currentTarget.ServerPosition);
  217. nextSpell = null;
  218. }
  219. }
  220. private static void OnWndProc(WndEventArgs args)
  221. {
  222. if (MenuGUI.IsChatOpen)
  223. return;
  224. }
  225. public static void OnGameProcessPacket(GamePacketEventArgs args)
  226. {
  227. try
  228. {
  229. if (args.PacketData[0] == 0x65)
  230. {
  231. var packet = new GamePacket(args.PacketData);
  232. packet.Position = 1;
  233. int targetId = packet.ReadInteger();
  234. int damageType = packet.ReadByte();
  235. packet.Position = 16;
  236. int sourceId = packet.ReadInteger();
  237. if (myChamp.NetworkId != sourceId)
  238. return;
  239. var target = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(targetId);
  240. if (orbwalker.ActiveMode.ToString() == "Combo")
  241. {
  242. if ((damageType == 3 || damageType == 4) && lastSpellName.Contains("Attack"))
  243. {
  244. if (Tiamat.IsReady() && currentTarget.IsValidTarget(Tiamat.Range))
  245. {
  246. Tiamat.Cast();
  247. }
  248. else if (Hydra.IsReady() && currentTarget.IsValidTarget(Hydra.Range))
  249. {
  250. Hydra.Cast();
  251. }
  252. else if (Skills[1].IsReady() && currentTarget.IsValidTarget(Skills[1].Range) && qCount != 0)
  253. {
  254. nextSpell = Skills[1];
  255. }
  256. else
  257. {
  258. nextSpell = Skills[0];
  259. }
  260. UseAttack = false;
  261. orbwalker.SetMovement(true);
  262. }
  263. }
  264. }
  265. else if (args.PacketData[0] == 0x34)
  266. {
  267. var packet = new GamePacket(args.PacketData);
  268. packet.Position = 9;
  269. int action = packet.ReadByte();
  270. packet.Position = 1;
  271. int sourceId = packet.ReadInteger();
  272. if (action == 17 && sourceId == myChamp.NetworkId)
  273. {
  274. if (ProcessPackets)
  275. {
  276. if (!Config.SubMenu("Misc").Item("DCFix").GetValue<bool>())
  277. CancelAnimation();
  278. Orbwalking.ResetAutoAttackTimer();
  279. }
  280. }
  281. }
  282. else if (args.PacketData[0] == 0x61)
  283. {
  284. var packet = new GamePacket(args.PacketData);
  285. packet.Position = 12;
  286. int sourceId = packet.ReadInteger();
  287. if (sourceId == myChamp.NetworkId)
  288. {
  289. if (currentTarget != null && ProcessPackets && orbwalker.ActiveMode.ToString() == "Combo")
  290. {
  291. Packet.C2S.Move.Encoded(new Packet.C2S.Move.Struct(currentTarget.ServerPosition.To2D().X,
  292. currentTarget.ServerPosition.To2D().Y, 3, currentTarget.NetworkId)).Send();
  293. Orbwalking.ResetAutoAttackTimer();
  294. ProcessPackets = false;
  295. }
  296. if (ProcessPackets)
  297. {
  298. Orbwalking.ResetAutoAttackTimer();
  299. ProcessPackets = false;
  300. }
  301. }
  302. }
  303. else if (args.PacketData[0] == 0x38) //animation2
  304. {
  305. var packet = new GamePacket(args.PacketData);
  306. packet.Position = 1;
  307. int sourceId = packet.ReadInteger();
  308. if (packet.Size() == 9 && sourceId == myChamp.NetworkId)
  309. {
  310. if (ProcessPackets)
  311. {
  312. CancelAnimation(); // wait until recv packet 0x61
  313. Orbwalking.ResetAutoAttackTimer();
  314. }
  315. }
  316. }
  317. else if (args.PacketData[0] == 0xD8)
  318. {
  319. Packet.S2C.Recall.Struct packet = Packet.S2C.Recall.Decoded(args.PacketData);
  320. if (packet.UnitNetworkId == myChamp.NetworkId)
  321. {
  322. if (packet.Status == Packet.S2C.Recall.RecallStatus.RecallStarted)
  323. {
  324. IsRecalling = true;
  325. }
  326. else if (packet.Status == Packet.S2C.Recall.RecallStatus.RecallAborted ||
  327. packet.Status == Packet.S2C.Recall.RecallStatus.RecallFinished)
  328. {
  329. IsRecalling = false;
  330. }
  331. }
  332. }
  333. }
  334. catch (Exception ex)
  335. {
  336. Console.WriteLine(ex.ToString());
  337. }
  338. }
  339. public static void OnAnimation(GameObject unit, GameObjectPlayAnimationEventArgs args)
  340. {
  341. if (unit.IsMe && orbwalker.ActiveMode.ToString() == "Combo") // Spell1 = Q
  342. {
  343. if (args.Animation.Contains("Spell1"))
  344. {
  345. ProcessPackets = true;
  346. if (!Config.SubMenu("Misc").Item("DCFix").GetValue<bool>())
  347. CancelAnimation();
  348. }
  349. }
  350. }
  351. public static void CancelAnimation()
  352. {
  353. Vector3 movePos = Game.CursorPos;
  354. if (currentTarget.IsValidTarget(600))
  355. {
  356. movePos = currentTarget.ServerPosition + (myChamp.ServerPosition - currentTarget.ServerPosition);
  357. movePos.Normalize();
  358. movePos *= myChamp.Distance(currentTarget.ServerPosition) + 55;
  359. }
  360. //Packet.C2S.Move.Encoded(new Packet.C2S.Move.Struct(movePos.X, movePos.Y)).Send();
  361. myChamp.IssueOrder(GameObjectOrder.MoveTo, movePos);
  362. }
  363. private static double GetRDamage(Obj_AI_Base target) // DamageLib doesn't do this correctly yet
  364. {
  365. double minDmg = 0.0;
  366. if (Skills[3].Level == 0)
  367. return 0.0;
  368. minDmg = (80 + (40 * (Skills[3].Level - 1))) +
  369. 0.6 * ((0.2 * (myChamp.BaseAttackDamage + myChamp.FlatPhysicalDamageMod)) + myChamp.FlatPhysicalDamageMod);
  370. float targetPercentHealthMissing = 100 * (1 - target.Health / target.MaxHealth);
  371. double dmg = 0.0;
  372. if (targetPercentHealthMissing > 75.0f)
  373. {
  374. dmg = minDmg * 3;
  375. }
  376. else
  377. {
  378. dmg = minDmg + minDmg * (0.0267 * targetPercentHealthMissing);
  379. }
  380. double realDmg = myChamp.CalcDamage(target, Damage.DamageType.Physical, dmg - 20);
  381. return realDmg;
  382. }
  383. private static double GetUltiQDamage(Obj_AI_Base target) // account for bonus ulti AD
  384. {
  385. double dmg = 10 + ((Skills[0].Level - 1) * 20) + 0.6 * (1.2 * (myChamp.BaseAttackDamage + myChamp.FlatPhysicalDamageMod));
  386. return myChamp.CalcDamage(target, Damage.DamageType.Physical, dmg - 10);
  387. }
  388. private static double GetUltiWDamage(Obj_AI_Base target) // account for bonus ulti AD
  389. {
  390. float totalAD = myChamp.FlatPhysicalDamageMod + myChamp.BaseAttackDamage;
  391. double dmg = 50 + ((Skills[1].Level - 1) * 30) + (0.2 * totalAD + myChamp.FlatPhysicalDamageMod);
  392. return myChamp.CalcDamage(target, Damage.DamageType.Physical, dmg - 10);
  393. }
  394. private static double GetQDamage(Obj_AI_Base target)
  395. {
  396. float totalAD = myChamp.FlatPhysicalDamageMod + myChamp.BaseAttackDamage;
  397. double dmg = 10 + ((Skills[0].Level - 1) * 20) + (0.35 + (myChamp.Level * 0.05)) * totalAD;
  398. return myChamp.CalcDamage(target, Damage.DamageType.Physical, dmg - 10);
  399. }
  400. private static double GetWDamage(Obj_AI_Base target)
  401. {
  402. float dmg = 50 + (Skills[1].Level * 30) + myChamp.FlatPhysicalDamageMod;
  403. return myChamp.CalcDamage(target, Damage.DamageType.Physical, dmg - 10);
  404. }
  405. private static double DamageCalcNoR(Obj_AI_Base target)
  406. {
  407. float health = target.Health;
  408. double qDamage = GetQDamage(target);
  409. double wDamage = GetWDamage(target);
  410. double tDamage = 0.0;
  411. double aDamage = myChamp.GetAutoAttackDamage(target);
  412. double pDmgMultiplier = 0.2 + (0.05 * Math.Floor(myChamp.Level / 3.0));
  413. float totalAD = myChamp.BaseAttackDamage + myChamp.FlatPhysicalDamageMod;
  414. double pDamage = myChamp.CalcDamage(target, Damage.DamageType.Physical, pDmgMultiplier * totalAD);
  415. if (Tiamat.IsReady() || Hydra.IsReady())
  416. tDamage = myChamp.GetItemDamage(target, Damage.DamageItems.Tiamat);
  417. if (!Skills[0].IsReady() && qCount == 0)
  418. qDamage = 0.0;
  419. if (!Skills[1].IsReady())
  420. wDamage = 0.0;
  421. return wDamage + tDamage + (qDamage * (3 - qCount)) + (pDamage * (3 - qCount)) + aDamage * (3 - qCount);
  422. }
  423. public static double DamageCalcR(Obj_AI_Base target)
  424. {
  425. float health = target.Health;
  426. double qDamage = GetUltiQDamage(target);
  427. double wDamage = GetUltiWDamage(target);
  428. double rDamage = GetRDamage(target);
  429. double tDamage = 0.0;
  430. float totalAD = myChamp.FlatPhysicalDamageMod + myChamp.BaseAttackDamage;
  431. double aDamage = myChamp.CalcDamage(target, Damage.DamageType.Physical, 0.2 * totalAD + totalAD);
  432. double pDmgMultiplier = 0.2 + (0.05 * Math.Floor(myChamp.Level / 3.0));
  433. double pDamage = myChamp.CalcDamage(target, Damage.DamageType.Physical,
  434. pDmgMultiplier * (0.2 * totalAD + totalAD));
  435. if (Tiamat.IsReady() || Hydra.IsReady())
  436. tDamage = myChamp.GetItemDamage(target, Damage.DamageItems.Tiamat);
  437. if (!Skills[0].IsReady() && qCount == 0)
  438. qDamage = 0.0;
  439. if (!Skills[1].IsReady())
  440. wDamage = 0.0;
  441. if (Skills[3].IsReady())
  442. rDamage = 0.0;
  443. return (pDamage * (3 - qCount)) + (aDamage * (3 - qCount)) + wDamage + tDamage + rDamage +
  444. (qDamage * (3 - qCount));
  445. }
  446. public static void OnProcessSpell(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
  447. {
  448. if (sender.IsMe)
  449. {
  450. string SpellName = args.SData.Name;
  451. lastSpellName = SpellName;
  452. if (IsKSing && SpellName == "RivenFengShuiEngine") // cancel r animation to fire quickly
  453. {
  454. if (Tiamat.IsReady())
  455. Tiamat.Cast();
  456. if (Hydra.IsReady())
  457. Hydra.Cast();
  458. }
  459. if (SpellName == "RivenTriCleave")
  460. {
  461. lastQCast = Environment.TickCount;
  462. }
  463. if (orbwalker.ActiveMode.ToString() == "Combo")
  464. {
  465. lastSpell = null;
  466. if (SpellName.Contains("Attack"))
  467. {
  468. // This should happen in packet too, but just in case :)
  469. if (Tiamat.IsReady() && currentTarget.IsValidTarget(Tiamat.Range))
  470. {
  471. nextSpell = null;
  472. useTiamat = true;
  473. }
  474. else if (Hydra.IsReady() && currentTarget.IsValidTarget(Hydra.Range))
  475. {
  476. nextSpell = null;
  477. useTiamat = true;
  478. }
  479. }
  480. else if (SpellName == "RivenTriCleave")
  481. {
  482. nextSpell = null;
  483. lastSpell = Skills[0];
  484. if (!Config.SubMenu("Misc").Item("DCFix").GetValue<bool>())
  485. CancelAnimation();
  486. if (myChamp.Distance(currentTarget.ServerPosition) + currentTarget.BoundingRadius <
  487. myChamp.AttackRange + myChamp.BoundingRadius)
  488. {
  489. nextSpell = null;
  490. UseAttack = true;
  491. return;
  492. }
  493. if (Skills[1].IsReady() && currentTarget.IsValidTarget(Skills[1].Range))
  494. nextSpell = Skills[1];
  495. else
  496. {
  497. nextSpell = null;
  498. UseAttack = true;
  499. }
  500. }
  501. else if (SpellName == "RivenMartyr")
  502. {
  503. // Cancel W animation with Q
  504. if (Skills[0].IsReady())
  505. {
  506. nextSpell = null;
  507. Utility.DelayAction.Add(175, delegate { nextSpell = Skills[0]; });
  508. }
  509. else
  510. {
  511. nextSpell = null;
  512. UseAttack = true;
  513. }
  514. }
  515. else if (SpellName == "ItemTiamatCleave")
  516. {
  517. // Cancel tiamat animation with W or Q
  518. if (Skills[1].IsReady() && currentTarget.IsValidTarget(Skills[1].Range))
  519. nextSpell = Skills[1];
  520. else if (Skills[0].IsReady() && currentTarget.IsValidTarget(Skills[0].Range))
  521. nextSpell = Skills[0];
  522. }
  523. else if (SpellName == "RivenFengShuiEngine")
  524. {
  525. ultiOn = true;
  526. //Cast tiamat to cancel R animation if target is in range, otherwise Q or E
  527. if (Tiamat.IsReady() && currentTarget.IsValidTarget(Tiamat.Range))
  528. {
  529. nextSpell = null;
  530. useTiamat = true;
  531. }
  532. else if (Hydra.IsReady() && currentTarget.IsValidTarget(Hydra.Range))
  533. {
  534. nextSpell = null;
  535. useTiamat = true;
  536. }
  537. else if (Skills[0].IsReady() && currentTarget.IsValidTarget(Skills[0].Range))
  538. {
  539. nextSpell = Skills[0];
  540. }
  541. else if (Skills[2].IsReady())
  542. {
  543. nextSpell = Skills[2];
  544. }
  545. }
  546. }
  547. }
  548. }
  549. private static void GapClose(Obj_AI_Base target)
  550. {
  551. bool useE = Skills[2].IsReady();
  552. bool useQ = Skills[0].IsReady() && qCount < 2 && Config.SubMenu("ComboS").Item("UseQGapClose").GetValue<bool>();
  553. if (lastGapClose + 300 > Environment.TickCount && lastGapClose != 0)
  554. return;
  555. lastGapClose = Environment.TickCount;
  556. float aRange = myChamp.AttackRange + myChamp.BoundingRadius + target.BoundingRadius;
  557. float eRange = aRange + Skills[2].Range;
  558. float qRange = Skills[0].Range + aRange;
  559. float eqRange = Skills[0].Range + Skills[2].Range;
  560. float distance = myChamp.Distance(target.ServerPosition);
  561. if (distance < aRange)
  562. return;
  563. nextSpell = null;
  564. useTiamat = false;
  565. UseAttack = true;
  566. if (Ghostblade.IsReady())
  567. Ghostblade.Cast();
  568. if (useQ && qCount < 2 && Skills[0].IsReady() && qRange > distance && !Skills[2].IsReady())
  569. {
  570. double noRComboDmg = DamageCalcNoR(target);
  571. if (Skills[3].IsReady() && !ultiReady && noRComboDmg < target.Health &&
  572. Config.SubMenu("ComboS").Item("UseUlti").GetValue<bool>())
  573. {
  574. Skills[3].Cast();
  575. }
  576. Skills[0].Cast(target.ServerPosition, true);
  577. }
  578. else if (Skills[2].IsReady() && eRange > distance + aRange)
  579. {
  580. PredictionOutput pred = Prediction.GetPrediction(target, 0, 0, 1450);
  581. Skills[2].Cast(pred.CastPosition);
  582. }
  583. else if (useQ && Skills[2].IsReady() && Skills[0].IsReady() && eqRange + aRange > distance)
  584. {
  585. PredictionOutput pred = Prediction.GetPrediction(target, 0, 0, 1450);
  586. Skills[2].Cast(pred.CastPosition);
  587. }
  588. }
  589. private static void KillSecure()
  590. {
  591. foreach (Obj_AI_Hero hero in ObjectManager.Get<Obj_AI_Hero>())
  592. {
  593. if (hero.Team != myChamp.Team && !hero.IsDead && hero.IsVisible)
  594. {
  595. if (ultiReady && Config.SubMenu("KS").Item("KillStealR").GetValue<bool>() &&
  596. hero.IsValidTarget(Skills[3].Range - 30) && GetRDamage(hero) - 20 >= hero.Health &&
  597. !Config.SubMenu("KS").SubMenu("NoRKS").Item(hero.ChampionName).GetValue<bool>())
  598. {
  599. Skills[3].Cast(hero, aoe: true);
  600. IsKSing = false;
  601. }
  602. else if (Config.SubMenu("KS").Item("KillStealQ").GetValue<bool>() && Skills[0].IsReady() &&
  603. hero.IsValidTarget(Skills[0].Range) && GetQDamage(hero) - 10 >= hero.Health)
  604. {
  605. Skills[0].Cast(hero.ServerPosition, true);
  606. }
  607. else if (Config.SubMenu("KS").Item("KillStealW").GetValue<bool>() && Skills[1].IsReady() &&
  608. hero.IsValidTarget(Skills[1].Range) && GetWDamage(hero) - 10 >= hero.Health)
  609. {
  610. Skills[1].Cast();
  611. }
  612. else if (Config.SubMenu("KS").Item("KillStealT").GetValue<bool>() &&
  613. (Tiamat.IsReady() || Hydra.IsReady()) && hero.IsValidTarget(Tiamat.Range) &&
  614. myChamp.GetItemDamage(hero, Damage.DamageItems.Tiamat) >= hero.Health)
  615. {
  616. if (Tiamat.IsReady())
  617. Tiamat.Cast();
  618. if (Hydra.IsReady())
  619. Hydra.Cast();
  620. }
  621. else if (!ultiReady && !ultiOn &&
  622. Config.SubMenu("KS").Item("KillStealR").GetValue<bool>() &&
  623. Config.SubMenu("KS").Item("KillStealRActivate").GetValue<bool>() &&
  624. hero.IsValidTarget(Skills[3].Range - 30) && GetRDamage(hero) - 20 >= hero.Health &&
  625. orbwalker.ActiveMode.ToString() != "Combo")
  626. {
  627. IsKSing = true;
  628. Skills[3].Cast();
  629. }
  630. }
  631. }
  632. }
  633. }
  634. }

comments powered by Disqus