Kog


SUBMITTED BY: Alerand

DATE: May 7, 2016, 10:55 a.m.

FORMAT: Text only

SIZE: 9.0 kB

HITS: 10702

  1. #region
  2. using System;
  3. using System.Drawing;
  4. using System.Linq;
  5. using DetuksSharp;
  6. using LeagueSharp;
  7. using LeagueSharp.Common;
  8. #endregion
  9. namespace Marksman.Champions
  10. {
  11. internal class Kogmaw : Champion
  12. {
  13. public Spell E;
  14. public static Spell Q;
  15. public Spell R;
  16. public int UltimateBuffStacks;
  17. public Spell W;
  18. public Kogmaw()
  19. {
  20. Utils.Utils.PrintMessage("KogMaw loaded.");
  21. Q = new Spell(SpellSlot.Q, 950f);
  22. W = new Spell(SpellSlot.W, float.MaxValue);
  23. E = new Spell(SpellSlot.E, 1260f);
  24. R = new Spell(SpellSlot.R, float.MaxValue);
  25. Q.SetSkillshot(0.25f, 70f, 1650f, true, SkillshotType.SkillshotLine);
  26. E.SetSkillshot(0.50f, 120f, 1400f, false, SkillshotType.SkillshotLine);
  27. R.SetSkillshot(1.2f, 120f, float.MaxValue, false, SkillshotType.SkillshotCircle);
  28. }
  29. public override void Drawing_OnDraw(EventArgs args)
  30. {
  31. Spell[] spellList = {Q, W, E, R};
  32. foreach (var spell in spellList)
  33. {
  34. var menuItem = GetValue<Circle>("Draw" + spell.Slot);
  35. if (menuItem.Active)
  36. Render.Circle.DrawCircle(ObjectManager.Player.Position,
  37. spell.Slot == SpellSlot.W ? DeathWalker.getRealAutoAttackRange(null) + 65 + W.Range : spell.Range,
  38. menuItem.Color);
  39. }
  40. }
  41. private static void CastQ()
  42. {
  43. var t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
  44. if (t.IsValidTarget() && Q.IsReady() &&
  45. ObjectManager.Player.Distance(t.ServerPosition) <= Q.Range)
  46. {
  47. var qPredict = Q.GetPrediction(t);
  48. var hithere = qPredict.CastPosition.Extend(ObjectManager.Player.Position, -140);
  49. if (qPredict.Hitchance >= HitChance.High)
  50. Q.Cast(hithere);
  51. }
  52. }
  53. public override void Game_OnGameUpdate(EventArgs args)
  54. {
  55. UltimateBuffStacks = GetUltimateBuffStacks();
  56. W.Range = 110 + 20*ObjectManager.Player.Spellbook.GetSpell(SpellSlot.W).Level;
  57. R.Range = 900 + 300*ObjectManager.Player.Spellbook.GetSpell(SpellSlot.R).Level;
  58. if (R.IsReady() && GetValue<bool>("UseRM"))
  59. foreach (
  60. var hero in
  61. ObjectManager.Get<Obj_AI_Hero>()
  62. .Where(
  63. hero => hero.IsValidTarget(R.Range) && R.GetDamage(hero) > hero.Health))
  64. R.Cast(hero, false, true);
  65. if ((!ComboActive && !HarassActive) ||
  66. (!DeathWalker.canMove() &&
  67. !(ObjectManager.Player.BaseAbilityDamage + ObjectManager.Player.FlatMagicDamageMod > 100))) return;
  68. var useQ = GetValue<bool>("UseQ" + (ComboActive ? "C" : "H"));
  69. var useW = GetValue<bool>("UseW" + (ComboActive ? "C" : "H"));
  70. var useE = GetValue<bool>("UseE" + (ComboActive ? "C" : "H"));
  71. var useR = GetValue<bool>("UseR" + (ComboActive ? "C" : "H"));
  72. var rLim = GetValue<Slider>("Rlim" + (ComboActive ? "C" : "H")).Value;
  73. if (useW && W.IsReady())
  74. foreach (
  75. var hero in
  76. ObjectManager.Get<Obj_AI_Hero>()
  77. .Where(hero => hero.IsValidTarget(DeathWalker.getRealAutoAttackRange(hero) + W.Range)))
  78. W.CastOnUnit(ObjectManager.Player);
  79. if (useQ && Q.IsReady())
  80. {
  81. var t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Magical);
  82. if (t != null)
  83. CastQ();
  84. //if (Q.Cast(t) == Spell.CastStates.SuccessfullyCasted)
  85. // return;
  86. }
  87. if (useE && E.IsReady())
  88. {
  89. var t = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Magical);
  90. if (t != null)
  91. if (E.Cast(t, false, true) == Spell.CastStates.SuccessfullyCasted)
  92. return;
  93. }
  94. if (GetValue<bool>("UseRSC") && R.IsReady())
  95. {
  96. var t = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Magical);
  97. if (t.IsValidTarget() &&
  98. (t.HasBuffOfType(BuffType.Stun) || t.HasBuffOfType(BuffType.Snare) || t.HasBuffOfType(BuffType.Slow) ||
  99. t.HasBuffOfType(BuffType.Fear) ||
  100. t.HasBuffOfType(BuffType.Taunt)))
  101. {
  102. R.Cast(t, false, true);
  103. }
  104. }
  105. if (useR && R.IsReady() && UltimateBuffStacks < rLim)
  106. {
  107. var t = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Magical);
  108. if (t != null)
  109. R.Cast(t, false, true);
  110. }
  111. }
  112. public override void DeathWalker_AfterAttack(AttackableUnit unit, AttackableUnit target)
  113. {
  114. if (target != null && (!ComboActive && !HarassActive) || !unit.IsMe || !(target is Obj_AI_Hero))
  115. return;
  116. var t = target as Obj_AI_Hero;
  117. var useQ = GetValue<bool>("UseQ" + (ComboActive ? "C" : "H"));
  118. var useW = GetValue<bool>("UseW" + (ComboActive ? "C" : "H"));
  119. var useE = GetValue<bool>("UseE" + (ComboActive ? "C" : "H"));
  120. var useR = GetValue<bool>("UseR" + (ComboActive ? "C" : "H"));
  121. var rLim = GetValue<Slider>("Rlim" + (ComboActive ? "C" : "H")).Value;
  122. if (useW && W.IsReady())
  123. W.CastOnUnit(ObjectManager.Player);
  124. if (useQ && Q.IsReady())
  125. if (Q.Cast(t) == Spell.CastStates.SuccessfullyCasted)
  126. return;
  127. if (useE && E.IsReady())
  128. if (E.Cast(t, false, true) == Spell.CastStates.SuccessfullyCasted)
  129. return;
  130. if (useR && R.IsReady() && UltimateBuffStacks < rLim)
  131. R.Cast(t, false, true);
  132. }
  133. private static int GetUltimateBuffStacks()
  134. {
  135. return (from buff in ObjectManager.Player.Buffs
  136. where buff.DisplayName.ToLower() == "kogmawlivingartillery"
  137. select buff.Count).FirstOrDefault();
  138. }
  139. public override bool ComboMenu(Menu config)
  140. {
  141. config.AddItem(new MenuItem("UseQC" + Id, "Use Q").SetValue(true));
  142. config.AddItem(new MenuItem("UseWC" + Id, "Use W").SetValue(true));
  143. config.AddItem(new MenuItem("UseEC" + Id, "Use E").SetValue(true));
  144. config.AddItem(new MenuItem("UseRC" + Id, "Use R").SetValue(true));
  145. config.AddItem(new MenuItem("UseRSC" + Id, "Use R for Stunned Enemy").SetValue(true));
  146. config.AddItem(new MenuItem("RlimC" + Id, "R Limiter").SetValue(new Slider(3, 5, 1)));
  147. return true;
  148. }
  149. public override bool HarassMenu(Menu config)
  150. {
  151. config.AddItem(new MenuItem("UseQH" + Id, "Use Q").SetValue(false));
  152. config.AddItem(new MenuItem("UseWH" + Id, "Use W").SetValue(false));
  153. config.AddItem(new MenuItem("UseEH" + Id, "Use E").SetValue(false));
  154. config.AddItem(new MenuItem("UseRH" + Id, "Use R").SetValue(true));
  155. config.AddItem(new MenuItem("RlimH" + Id, "R Limiter").SetValue(new Slider(1, 5, 1)));
  156. return true;
  157. }
  158. public override bool DrawingMenu(Menu config)
  159. {
  160. config.AddItem(
  161. new MenuItem("DrawQ" + Id, "Q range").SetValue(new Circle(true,
  162. Color.FromArgb(100, 255, 0, 255))));
  163. config.AddItem(
  164. new MenuItem("DrawW" + Id, "W range").SetValue(new Circle(true,
  165. Color.FromArgb(100, 255, 0, 255))));
  166. config.AddItem(
  167. new MenuItem("DrawE" + Id, "E range").SetValue(new Circle(false,
  168. Color.FromArgb(100, 255, 0, 255))));
  169. config.AddItem(
  170. new MenuItem("DrawR" + Id, "R range").SetValue(new Circle(false,
  171. Color.FromArgb(100, 255, 0, 255))));
  172. return true;
  173. }
  174. public override bool MiscMenu(Menu config)
  175. {
  176. config.AddItem(new MenuItem("UseRM" + Id, "Use R To Killsteal").SetValue(true));
  177. return true;
  178. }
  179. public override bool ExtrasMenu(Menu config)
  180. {
  181. return true;
  182. }
  183. public override bool LaneClearMenu(Menu config)
  184. {
  185. return true;
  186. }
  187. }
  188. }

comments powered by Disqus