//Items need testing. Should work. public static void CastItems(List <Obj_AI_Base> enemies, bool ks) { #region Item Initialization InventorySlot QSS = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Use Quick Silver Sash")) ? Yasuo.GetItem(ItemId.Quicksilver_Sash) : null, MercurialsScimitar = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Use Mercurials Scimitar")) ? Yasuo.GetItem(ItemId.Mercurial_Scimitar) : null, RavenousHydra = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Use Ravenous Hydra")) ? Yasuo.GetItem(ItemId.Ravenous_Hydra) : null, TitanicHydra = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Use Titanic Hydra")) ? Yasuo.GetItem(ItemId.Titanic_Hydra) : null, Tiamat = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Use Tiamat")) ? Yasuo.GetItem(ItemId.Tiamat) : null, Youmuus = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Use Youmuus")) ? Yasuo.GetItem(ItemId.Youmuus_Ghostblade) : null, BOTRK = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Use Blade of the Ruined King")) ? Yasuo.GetItem(ItemId.Blade_of_the_Ruined_King) : null, BilgewaterCutlass = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Use Bilgewater Cutlass")) ? Yasuo.GetItem(ItemId.Bilgewater_Cutlass) : null, HextechGunblade = (MenuHandler.GetCheckboxValue(MenuHandler.Items, "Use Hextech Gunblade")) ? Yasuo.GetItem(ItemId.Hextech_Gunblade) : null; #endregion #region QSS if (!didActionThisTick && QSS.MeetsCriteria() && (Yasuo.HasBuffOfType(BuffType.Blind) || Yasuo.HasBuffOfType(BuffType.Charm) || Yasuo.HasBuffOfType(BuffType.Fear) || Yasuo.HasBuffOfType(BuffType.Knockback) || Yasuo.HasBuffOfType(BuffType.Silence) || Yasuo.HasBuffOfType(BuffType.Snare) || Yasuo.HasBuffOfType(BuffType.Stun) || Yasuo.HasBuffOfType(BuffType.Taunt)) //not being knocked back by dragon && !Yasuo.HasBuff("moveawaycollision") //not standing on raka silence && !Yasuo.HasBuff("sorakaepacify") && !Yasuo.HasBuff("plantsatchelknockback")) { didActionThisTick = QSS.Cast(); } #endregion #region Mercurials Scimitar if (!didActionThisTick && MercurialsScimitar.MeetsCriteria() && (Yasuo.HasBuffOfType(BuffType.Blind) || Yasuo.HasBuffOfType(BuffType.Charm) || Yasuo.HasBuffOfType(BuffType.Fear) || Yasuo.HasBuffOfType(BuffType.Knockback) || Yasuo.HasBuffOfType(BuffType.Silence) || Yasuo.HasBuffOfType(BuffType.Snare) || Yasuo.HasBuffOfType(BuffType.Stun) || Yasuo.HasBuffOfType(BuffType.Taunt)) //not being knocked back by dragon && !Yasuo.HasBuff("moveawaycollision") //not standing on raka silence && !Yasuo.HasBuff("sorakaepacify") && !Yasuo.HasBuff("plantsatchelknockback")) { didActionThisTick = MercurialsScimitar.Cast(); } #endregion #region Ravenous Hydra if (!didActionThisTick && RavenousHydra.MeetsCriteria() && enemies.Where(a => a.IsInRange(Yasuo, 400)).FirstOrDefault() != null && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Yasuo, a, ItemId.Ravenous_Hydra)).FirstOrDefault() != null)) { didActionThisTick = RavenousHydra.Cast(); } #endregion #region Titanic Hydra if (!didActionThisTick && TitanicHydra.MeetsCriteria() && enemies.Where(a => a.IsInRange(Yasuo, Yasuo.GetAutoAttackRange())).FirstOrDefault() != null && !Orbwalker.CanAutoAttack && !Orbwalker.IsAutoAttacking && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Yasuo, a, ItemId.Titanic_Hydra)).FirstOrDefault() != null)) { didActionThisTick = TitanicHydra.Cast(); } #endregion #region Tiamat if (!didActionThisTick && Tiamat.MeetsCriteria() && enemies.Where(a => a.IsInRange(Yasuo, 400)).FirstOrDefault() != null && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Yasuo, a, ItemId.Tiamat)).FirstOrDefault() != null)) { didActionThisTick = Tiamat.Cast(); } #endregion #region Youmuus if (!didActionThisTick && Youmuus.MeetsCriteria() && Yasuo.CountEnemyHeroesInRangeWithPrediction((int)Yasuo.GetAutoAttackRange(), 0) >= 1) { didActionThisTick = Youmuus.Cast(); } #endregion //all targeted spells that must be used on champions must be called after this enemies = enemies.Where(a => a.Type == GameObjectType.AIHeroClient).ToList(); #region Hextech Gunblade if (!didActionThisTick && HextechGunblade.MeetsCriteria() && enemies.Where(a => a.IsInRange(Yasuo, 700)).FirstOrDefault() != null && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Yasuo, a, ItemId.Hextech_Gunblade)).FirstOrDefault() != null)) { didActionThisTick = HextechGunblade.Cast(enemies.OrderBy(a => a.Health).FirstOrDefault()); } #endregion #region BOTRK if (!didActionThisTick && BOTRK.MeetsCriteria() && enemies.Where(a => a.IsInRange(Yasuo, 550)).FirstOrDefault() != null && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Yasuo, a, ItemId.Blade_of_the_Ruined_King)).FirstOrDefault() != null)) { didActionThisTick = BOTRK.Cast(enemies.OrderBy(a => a.Health).FirstOrDefault()); } #endregion #region Bilgewater Cutlass if (!didActionThisTick && BilgewaterCutlass.MeetsCriteria() && enemies.Where(a => a.IsInRange(Yasuo, 550)).FirstOrDefault() != null && (!ks || enemies.Where(a => a.MeetsCriteria() && a.Health <= DamageLibrary.GetItemDamage(Yasuo, a, ItemId.Bilgewater_Cutlass)).FirstOrDefault() != null)) { didActionThisTick = BilgewaterCutlass.Cast(enemies.OrderBy(a => a.Health).FirstOrDefault()); } #endregion }
//complete public static void Flee() { WallDash activeDash = null; Menu menu = MenuHandler.Flee; if (menu.GetCheckboxValue("Wall Dash") && Program.E.IsReady() && !YasuoCalcs.IsDashing()) { //walldash foreach (WallDash wd in YasuoWallDashDatabase.wallDashDatabase.Where(a => a.startPosition.Distance(Yasuo) <= 1300)) { if (EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && a.Name == wd.unitName && a.ServerPosition.Distance(wd.dashUnitPosition) <= 2).FirstOrDefault() != null) { Geometry.Polygon.Circle dashCircle = new Geometry.Polygon.Circle(wd.endPosition, 120); if (dashCircle.IsInside(Game.CursorPos)) { activeDash = wd; break; } } } } if (menu.GetCheckboxValue("Use E") || activeDash != null) { if (activeDash == null) { Orbwalker.MoveTo(Game.CursorPos); EToMouse(menu.GetCheckboxValue("Use E Under Tower"), menu.GetCheckboxValue("Stack Q"), false); } else { //first check if the positions are exact if (Yasuo.Position.To2D() == activeDash.startPosition.To2D()) { CastE(EntityManager.MinionsAndMonsters.Combined.Where(a => a.Name == activeDash.unitName).ToList().ToObj_AI_BaseList(), false, menu.GetCheckboxValue("Use E Under Tower")); } else { Orbwalker.MoveTo(activeDash.startPosition); } //if the positions aren't exact //if (Yasuo.Position.Distance(activeDash.startPosition) > 50) // return; Vector3 startPos = Yasuo.Position, dashEndPos = YasuoCalcs.GetDashingEnd(EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && YasuoCalcs.ERequirements(a, MenuHandler.GetCheckboxValue(MenuHandler.Flee, "Use E Under Tower")) && a.Name == activeDash.unitName).FirstOrDefault()), fakeEndPos = startPos.To2D().Extend(dashEndPos.To2D(), 1000).To3D() + new Vector3(0, 0, startPos.Z), slope = new Vector3(dashEndPos.X - startPos.X, dashEndPos.Y - startPos.Y, 0), fakeSlope = new Vector3(fakeEndPos.X - startPos.X, fakeEndPos.Y - startPos.Y, 0), actualDashPosition = Vector3.Zero; List <Vector3> pointsAlongPath = new List <Vector3>(); List <Vector3> straightLinePath = new List <Vector3>(); int points = 100; pointsAlongPath.Add(startPos); //get all points in a line from start to fake end for (int i = 0; i < points; i++) { straightLinePath.Add(startPos + (i * (fakeSlope / points))); } bool isWall = false; //get all wall start and end positions for (int i = 0; i < points; i++) { //wall start if (!isWall && straightLinePath[i].IsWall()) { pointsAlongPath.Add(straightLinePath[i]); isWall = true; } //wall end if (isWall && !straightLinePath[i].IsWall()) { pointsAlongPath.Add(straightLinePath[i]); isWall = false; } } pointsAlongPath.Add(fakeEndPos); Vector3 closestWall = pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(dashEndPos)).FirstOrDefault(), closestWallsEndPosition = (pointsAlongPath.IndexOf(closestWall) + 1 == pointsAlongPath.Count) ? Vector3.Zero : pointsAlongPath[pointsAlongPath.IndexOf(closestWall) + 1]; //none of the points are a wall so the end point is the dash position if (!pointsAlongPath.Any(a => a.IsWall())) { actualDashPosition = dashEndPos; } // OR none of the walls are in the E range else if (pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault() != null && pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault().Distance(startPos) > Program.E.Range) { actualDashPosition = dashEndPos; } //or the dashing end is not a wall else if (!dashEndPos.IsWall()) { actualDashPosition = dashEndPos; } //find the nearest wall to the dash position else if (closestWall != Vector3.Zero && closestWallsEndPosition != Vector3.Zero && closestWall != null && closestWallsEndPosition != null && closestWallsEndPosition.Distance(dashEndPos) < closestWall.Distance(dashEndPos) && startPos.Distance(closestWallsEndPosition) <= 630) { actualDashPosition = closestWallsEndPosition; } //the end position is the first wall else { actualDashPosition = pointsAlongPath.First(a => a.IsWall()); } //if the end position is close enough to the walldash position, dash if (actualDashPosition.Distance(activeDash.endPosition) <= menu.GetSliderValue("Wall Dash Extra Space")) { CastE(EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && YasuoCalcs.ERequirements(a, menu.GetCheckboxValue("Use E Under Tower")) && a.Name == activeDash.unitName).FirstOrDefault()); } } } }