Example #1
0
        public static void EToMouse(bool goUnderEnemyTower, bool stackQ, bool EQ, List <Obj_AI_Base> EQTargets = null)
        {
            if (Program.E.IsReady() && !YasuoCalcs.IsDashing() && !didActionThisTick)
            {
                if (EQTargets == null)
                {
                    EQTargets = EntityManager.Enemies;
                }

                Geometry.Polygon.Sector sector = new Geometry.Polygon.Sector(Yasuo.Position, Game.CursorPos, (float)(30 * Math.PI / 180), Program.E.Range);

                List <Obj_AI_Base> dashableEnemies            = EntityManager.Enemies.Where(a => !a.IsDead && a.MeetsCriteria() && YasuoCalcs.ERequirements(a, goUnderEnemyTower) && a.IsInRange(Yasuo.Position, Program.E.Range) && sector.IsInside(a)).OrderBy(a => YasuoCalcs.GetDashingEnd(a).Distance(Game.CursorPos)).ToList();
                List <Obj_AI_Base> dashableEnemiesWithTargets = dashableEnemies.Where(a => EQTargets.Any(b => b.Position(250).IsInRange(YasuoCalcs.GetDashingEnd(a), Program.EQ.Range))).ToList();
                //.OrderBy(a => EQTargets.Where(b => b.Position(250).IsInRange(YasuoCalcs.GetDashingEnd(a), Program.EQ.Range)).Count()).ToList();

                if (YasuoCalcs.WillQBeReady() && stackQ && !Yasuo.HasBuff("yasuoq3w") && dashableEnemiesWithTargets.Count != 0)
                {
                    CastEQ(dashableEnemiesWithTargets, false, goUnderEnemyTower);
                }
                else if (YasuoCalcs.WillQBeReady() && EQ && dashableEnemiesWithTargets.Count != 0)
                {
                    CastEQ(dashableEnemiesWithTargets, false, goUnderEnemyTower, EQTargets);
                }
                else if (dashableEnemies.FirstOrDefault() != null)
                {
                    CastE(dashableEnemies.OrderBy(a => a.Distance(Game.CursorPos)).First());
                }
            }
        }
Example #2
0
        public static void EGapClose(List <Obj_AI_Base> targets, bool goUnderEnemyTower)
        {
            if (!Program.E.IsReady() || YasuoCalcs.IsDashing() || didActionThisTick)
            {
                return;
            }
            //if none of the targets are in auto attack range
            if (targets.Where(a => a.IsInRange(Yasuo, Yasuo.GetAutoAttackRange())).FirstOrDefault() == null)
            {
                //get the closest target
                Obj_AI_Base closestEnemy = targets.Where(a => a.MeetsCriteria() && a.IsInRange(Yasuo, 5000)).OrderBy(b => b.Distance(Yasuo)).FirstOrDefault();

                if (closestEnemy != null)
                {
                    //get all enemies in my E range
                    List <Obj_AI_Base> enemiesInERange = EntityManager.Enemies.Where(a => a.MeetsCriteria() && a != closestEnemy && YasuoCalcs.ERequirements(a, goUnderEnemyTower) && a.IsInRange(Yasuo, Program.E.Range)).ToList();

                    Obj_AI_Base enemyToDashTo = enemiesInERange.OrderBy(a => YasuoCalcs.GetDashingEnd(a).Distance(closestEnemy)).FirstOrDefault();

                    if (enemyToDashTo != null && YasuoCalcs.GetDashingEnd(enemyToDashTo).Distance(closestEnemy) < Yasuo.Distance(closestEnemy))
                    {
                        CastE(enemyToDashTo);
                    }
                }
            }
        }
Example #3
0
        public static void CastE(Obj_AI_Base unit)
        {
            if (!Program.E.IsReady() || YasuoCalcs.IsDashing() || !unit.IsInRange(Yasuo, Program.E.Range) || didActionThisTick)
            {
                return;
            }

            if (unit != null)
            {
                didActionThisTick = Program.E.Cast(unit);
            }
        }
Example #4
0
        public static void CastEQ(List <Obj_AI_Base> dashEnemies, bool ks, bool goUnderEnemyTower, List <Obj_AI_Base> EQEnemies = null)
        {
            if (!Program.E.IsReady() || !YasuoCalcs.WillQBeReady() || didActionThisTick ||
                !dashEnemies.Any(a => a.IsInRange(Yasuo, Program.E.Range)) ||
                Yasuo.GetNearbyEnemies(Program.E.Range).Count() == 0 || YasuoCalcs.IsDashing())
            {
                return;
            }

            if (EQEnemies == null)
            {
                EQEnemies = dashEnemies;
            }

            int         numberOfEnemiesHitWithEQ = 0;
            Obj_AI_Base unitToDashTo             = null;

            List <Obj_AI_Base> possibleDashUnits = dashEnemies.Where(a => a.MeetsCriteria() && a.IsInRange(Yasuo, Program.E.Range) && YasuoCalcs.ERequirements(a, goUnderEnemyTower) && a.Health > YasuoCalcs.E(a)).ToList();

            foreach (Obj_AI_Base possibleDashUnit in possibleDashUnits)
            {
                List <Obj_AI_Base> unitsHitWithEQ = EQEnemies.Where(a => a.MeetsCriteria() && a.Position(250).IsInRange(YasuoCalcs.GetDashingEnd(possibleDashUnit), Program.EQ.Range)).ToList();
                if (ks)
                {
                    unitsHitWithEQ = unitsHitWithEQ.Where(a => a.Health <= YasuoCalcs.Q(a) || (a.Name == possibleDashUnit.Name && a.Health <= YasuoCalcs.Q(a) + YasuoCalcs.E(a))).ToList();
                }

                if (numberOfEnemiesHitWithEQ < unitsHitWithEQ.Count())
                {
                    numberOfEnemiesHitWithEQ = unitsHitWithEQ.Count();
                    unitToDashTo             = possibleDashUnit;
                }
            }

            if (unitToDashTo != null && numberOfEnemiesHitWithEQ >= 1 && !didActionThisTick)
            {
                CastE(unitToDashTo);
                if (YasuoCalcs.GetQReadyTimeInt() == 0)
                {
                    Core.DelayAction(delegate { CastEQsQ(EQEnemies); }, 100);
                }
                else
                {
                    Core.DelayAction(delegate { CastEQsQ(EQEnemies); }, YasuoCalcs.GetQReadyTimeInt());
                }
                didActionThisTick = true;
            }
        }
Example #5
0
        public static void CastE(List <Obj_AI_Base> enemies, bool ks, bool goUnderEnemyTower)
        {
            if (!Program.E.IsReady() || YasuoCalcs.IsDashing() || didActionThisTick || !enemies.Any(a => a.MeetsCriteria() && a.IsInRange(Yasuo, Program.E.Range)))
            {
                return;
            }

            Obj_AI_Base unit = enemies.Where(a =>
                                             a.MeetsCriteria() &&
                                             a.IsInRange(Yasuo, Program.E.Range) &&
                                             (!ks || YasuoCalcs.E(a) >= a.Health) &&
                                             YasuoCalcs.ERequirements(a, goUnderEnemyTower)
                                             ).FirstOrDefault();

            if (unit != null)
            {
                CastE(unit);
            }
        }
Example #6
0
        public static void CastQ(List <Obj_AI_Base> enemies, bool ks)
        {
            if (didActionThisTick || !Program.Q.IsReady() || YasuoCalcs.IsDashing() ||
                !enemies.Any(a =>
                             (Yasuo.HasBuff("YasuoQ3W") && a.IsInRange(Yasuo, Program.Q3.Range)) || (!Yasuo.HasBuff("YasuoQ3W") && a.IsInRange(Yasuo, Program.Q.Range))) ||
                !Yasuo.IsAutoCanceling(enemies))
            {
                return;
            }

            if (ks)
            {
                enemies = enemies.Where(a => YasuoCalcs.Q(a) >= a.Health).ToList();
            }

            int     enemiesHit = 0;
            Vector3 bestPos    = Vector3.Zero;

            if (Yasuo.HasBuff("YasuoQ3W"))
            {
                bestPos = Program.Q3.GetBestLinearPredictionPos(enemies, Yasuo.Position, out enemiesHit);
            }
            else
            {
                bestPos = Program.Q.GetBestLinearPredictionPos(enemies, Yasuo.Position + new Vector3(0, 0, 150f), out enemiesHit);
            }

            if (bestPos != Vector3.Zero && enemiesHit > 0)
            {
                if (Yasuo.HasBuff("YasuoQ3W"))
                {
                    didActionThisTick = Program.Q3.Cast(bestPos);
                }
                else
                {
                    didActionThisTick = Program.Q.Cast(bestPos);
                }
            }
        }
Example #7
0
        private static void TryBeyBlade()
        {
            if (didActionThisTick)
            {
                return;
            }

            int beyBladeRange = (int)(Program.E.Range + Program.Flash.Range + (Program.EQ.Range / 2)),
                flashEQRange  = (int)(Program.Flash.Range + (Program.EQ.Range / 2));


            //if yasuo has 3rd q ready and everything needed to beyblade
            if (!YasuoCalcs.IsDashing() &&
                Yasuo.HasBuff("yasuoq3w") &&
                Program.Q.IsReady() &&
                Program.E.IsReady() &&
                Program.Flash != null &&
                Program.Flash.IsReady() &&
                Program.R.IsReady())
            {
                //not in EQ range, and is in beyblade range
                List <AIHeroClient> EnemiesInRange = EntityManager.Heroes.Enemies.Where(a =>
                                                                                        a.MeetsCriteria() && !a.IsInRange(Yasuo, Program.E.Range + (Program.EQ.Range / 2)) && a.IsInRange(Yasuo, beyBladeRange)).ToList();

                if (EnemiesInRange.Count() != 0)
                {
                    List <Obj_AI_Base> DashableUnits = EntityManager.MinionsAndMonsters.EnemyMinions.Where(a =>
                                                                                                           //meets criteria
                                                                                                           a.MeetsCriteria()
                                                                                                           //if dashing this this unit, it will put is in position to flash range
                                                                                                           && YasuoCalcs.GetDashingEnd(a).IsInRange(EnemiesInRange.OrderBy(b => YasuoCalcs.GetDashingEnd(a).Distance(b)).FirstOrDefault(), Program.Flash.Range + (Program.EQ.Range / 2))).ToList().ToObj_AI_BaseList();

                    if (DashableUnits.Count() != 0)
                    {
                        Obj_AI_Base dashUnitThatGetsMostChampionsInEQRange = DashableUnits.OrderBy(a =>
                                                                                                   //get best cast position start
                                                                                                   Prediction.Position.PredictCircularMissileAoe(EnemiesInRange.ToObj_AI_BaseList().ToArray(), flashEQRange, Program.EQ.Radius, 250, int.MaxValue, YasuoCalcs.GetDashingEnd(a)).OrderBy(prediction => prediction.CollisionObjects.Where(unit => EnemiesInRange.Contains(unit)).Count()).FirstOrDefault().CollisionObjects.Where(unit => EnemiesInRange.Contains(unit)).Count()).FirstOrDefault();

                        if (dashUnitThatGetsMostChampionsInEQRange != null)
                        {
                            CastE(dashUnitThatGetsMostChampionsInEQRange);
                        }
                    }
                }
            }

            if (Yasuo.HasBuff("yasuoq3w") &&
                Program.R.IsReady() &&
                YasuoCalcs.IsDashing() &&
                Program.Flash.IsReady() &&
                Program.Q.IsReady())
            {
                List <AIHeroClient> EnemiesInRange = EntityManager.Heroes.Enemies.Where(a =>
                                                                                        a.MeetsCriteria() && a.IsInRange(Yasuo, beyBladeRange)).ToList();

                PredictionResult predictionResult = Prediction.Position.PredictCircularMissileAoe(EnemiesInRange.ToObj_AI_BaseList().ToArray(), flashEQRange, Program.EQ.Radius, 250, int.MaxValue, Yasuo.Position)
                                                    .OrderBy(prediction => prediction.CollisionObjects.Where(unit => EnemiesInRange.Contains(unit)).Count()).FirstOrDefault();

                if (predictionResult.CastPosition != null && predictionResult.CastPosition != Vector3.Zero && predictionResult.CollisionObjects.Where(a => EnemiesInRange.Contains(a)).Count() >= 1)
                {
                    CastEQsQ(EnemiesInRange.ToObj_AI_BaseList());
                    if (!predictionResult.CastPosition.IsInRange(Yasuo, Program.Flash.Range) && predictionResult.CastPosition.IsInRange(Yasuo, flashEQRange))
                    {
                        didActionThisTick = Program.Flash.Cast(Yasuo.Position.Extend(predictionResult.CastPosition, Program.Flash.Range).To3D());
                    }
                    //is in flash range, but is not in EQ range. Might delete this so it stops flashing during every EQ possible...
                    else if (predictionResult.CastPosition.IsInRange(Yasuo, Program.Flash.Range) && !predictionResult.CastPosition.IsInRange(Yasuo, Program.EQ.Range))
                    {
                        didActionThisTick = Program.Flash.Cast(predictionResult.CastPosition);
                    }
                }
            }
        }
Example #8
0
        //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());
                    }
                }
            }
        }