private static void InsecCombo(AIHeroClient target) { try { if (target != null && target.IsVisible) { if (Player.ELDistance(GetInsecPos(target)) < 200) { insecComboStep = InsecComboStepSelect.Pressr; } else if (insecComboStep == InsecComboStepSelect.None && GetInsecPos(target).ELDistance(Player.Position) < 600) { insecComboStep = InsecComboStepSelect.Wgapclose; } else if (insecComboStep == InsecComboStepSelect.None && target.ELDistance(Player) < spells[Spells.Q].Range) { insecComboStep = InsecComboStepSelect.Qgapclose; } switch (insecComboStep) { case InsecComboStepSelect.Qgapclose: if (QState) { var pred1 = spells[Spells.Q].GetPrediction(target); if (pred1.Hitchance >= HitChance.High) { if (pred1.CollisionObjects.Count == 0) { if (spells[Spells.Q].Cast(pred1.CastPosition)) { return; } } else { CastQ(target); } } if (!getCheckBoxItem(InitMenu.insecMenu, "checkOthers1")) { return; } var insecObjects = HeroManager.Enemies.Where( x => x.LSIsValidTarget(spells[Spells.Q].Range) && x.ELDistance(target) < 550f) .Concat(MinionManager.GetMinions(Player.ServerPosition, spells[Spells.Q].Range)) .Where( m => m.LSIsValidTarget(spells[Spells.Q].Range) && spells[Spells.Q].GetDamage(m) < m.Health + 15 && m.ELDistance(target) < 400f) .ToList(); if (insecObjects.Count > 0) { foreach (var insectObject in insecObjects.Select(i => spells[Spells.Q].GetPrediction(i)) .Where(i => i.Hitchance >= HitChance.High) .OrderByDescending(i => i.Hitchance)) { spells[Spells.Q].Cast(insectObject.CastPosition); break; } } else { return; } } if (!(target.HasQBuff()) && QState) { CastQ(target); } else if (target.HasQBuff()) { spells[Spells.Q].Cast(); insecComboStep = InsecComboStepSelect.Wgapclose; } else { if (spells[Spells.Q].Instance.Name.Equals( "blindmonkqtwo", StringComparison.InvariantCultureIgnoreCase) && ReturnQBuff()?.ELDistance(target) <= 600) { spells[Spells.Q].Cast(); } } break; case InsecComboStepSelect.Wgapclose: if (Player.ELDistance(target) < WardRange) { WardJump(GetInsecPos(target), false, true, true); if (FindBestWardItem() == null && spells[Spells.R].IsReady() && getCheckBoxItem(InitMenu.insecMenu, "ElLeeSin.Flash.Insec") && Player.Spellbook.CanUseSpell(flashSlot) == SpellState.Ready) { if ((GetInsecPos(target).ELDistance(Player.Position) < FlashRange && LastWard + 1000 < Environment.TickCount) || !spells[Spells.W].IsReady()) { Player.Spellbook.CastSpell(flashSlot, GetInsecPos(target)); } } } else if (Player.ELDistance(target) < WardFlashRange) { WardJump(target.Position); if (spells[Spells.R].IsReady() && getCheckBoxItem(InitMenu.insecMenu, "ElLeeSin.Flash.Insec") && Player.Spellbook.CanUseSpell(flashSlot) == SpellState.Ready) { if (Player.ELDistance(target) < FlashRange - 25) { if (FindBestWardItem() == null || LastWard + 1000 < Environment.TickCount) { Player.Spellbook.CastSpell(flashSlot, GetInsecPos(target)); } } } } break; case InsecComboStepSelect.Pressr: spells[Spells.R].CastOnUnit(target); break; } } } catch (Exception e) { Console.WriteLine("An error occurred: '{0}'", e); } }
public static Vector3 GetInsecPos(AIHeroClient target) { try { var jumpRange = 265; if (ClicksecEnabled && getCheckBoxItem(InitMenu.insecMenu, "clickInsec")) { InsecLinePos = Drawing.WorldToScreen(InsecClickPos); return V2E(InsecClickPos, target.Position, target.ELDistance(InsecClickPos) + jumpRange).To3D(); } if (isNullInsecPos) { isNullInsecPos = false; insecPos = Player.Position; } if (GetAllyHeroes(target, 2000 + getSliderItem(InitMenu.insecMenu, "bonusRangeA")).Count > 0 && getCheckBoxItem(InitMenu.insecMenu, "ElLeeSin.Insec.Ally")) { var insecPosition = InterceptionPoint(GetAllyInsec(GetAllyHeroes(target, 2000 + getSliderItem(InitMenu.insecMenu, "bonusRangeA")))); InsecLinePos = Drawing.WorldToScreen(insecPosition); return V2E(insecPosition, target.Position, target.ELDistance(insecPosition) + jumpRange).To3D(); } if (getCheckBoxItem(InitMenu.insecMenu, "ElLeeSin.Insec.Tower")) { var tower =ObjectManager.Get<Obj_AI_Turret>().Where(turret => turret.ELDistance(target) - 725 <= 950 && turret.IsAlly && turret.IsVisible && turret.Health > 0 && turret.ELDistance(target) <= 1300 && turret.ELDistance(target) > 400).MinOrDefault(i => target.ELDistance(Player)); if (tower != null) { InsecLinePos = Drawing.WorldToScreen(tower.Position); return V2E(tower.Position, target.Position, target.ELDistance(tower.Position) + jumpRange).To3D(); } } if (getCheckBoxItem(InitMenu.insecMenu, "ElLeeSin.Insec.Original.Pos")) { InsecLinePos = Drawing.WorldToScreen(insecPos); return V2E(insecPos, target.Position, target.ELDistance(insecPos) + jumpRange).To3D(); } return new Vector3(); } catch (Exception e) { Console.WriteLine("An error occurred: '{0}'", e); } return new Vector3(); }