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
        private static void DrawLineIfWallBetween(Vector3 startPos, Obj_AI_Base target)
        {
            Vector3 endPos = YasuoCalcs.GetDashingEnd(target);

            List <Vector3> inbetweenPoints   = new List <Vector3>();
            Vector2        wallStartPosition = Vector2.Zero;
            Vector2        wallEndPosition   = Vector2.Zero;

            //get every point between yasuo's position and the end position of the dash extended to a range of 1000.
            //1 point is every 1/100 of total length
            for (int i = 0; i <= 100; i++)
            {
                inbetweenPoints.Add(startPos.Extend(startPos.Extend(endPos, 1000), i * (startPos.Distance(startPos.Extend(endPos, 1000)) / 100)).To3D());
            }

            //for every point in the list of points, find the beginning and the end of the wal
            foreach (Vector2 vec in inbetweenPoints)
            {
                if (vec.IsWall())
                {
                    if (wallStartPosition == Vector2.Zero)
                    {
                        wallStartPosition = vec;
                    }
                }
                else if (wallEndPosition == Vector2.Zero && wallStartPosition != Vector2.Zero)
                {
                    wallEndPosition = vec;
                }
            }

            //draw the wall in the color blue
            if (wallStartPosition != Vector2.Zero && wallEndPosition != Vector2.Zero)
            {
                double wallWidth      = Math.Round(wallStartPosition.Distance(wallEndPosition)),
                       distanceToWall = Math.Round(startPos.Distance(wallStartPosition)),
                       totalDistance  = Math.Round(wallStartPosition.Distance(wallEndPosition) + startPos.Distance(wallStartPosition)),
                       monsterDist    = Math.Round(target.Position.Distance(wallStartPosition));

                Drawing.DrawLine(wallStartPosition.To3D().WorldToScreen(), wallEndPosition.To3D().WorldToScreen(), 10, System.Drawing.Color.Black);

                //if the end point of yasuos dash brings him at least halfway between the two points (closer to the wall end than to the walls beginning)
                //and the wall has to be thinner than yasuo's total dash range. TESTED THIS TO CONFIRM IT WORKS
                //if (endPos.Distance(wallEndPosition) < endPos.Distance(wallStartPosition) && wallStartPosition.Distance(wallEndPosition) <= Program.E.Range)
                if (totalDistance <= 630)
                {
                    Drawing.DrawLine(startPos.WorldToScreen(), startPos.Extend(endPos, 1000).To3D().WorldToScreen(), 3, System.Drawing.Color.Green);
                }
                else
                {
                    Drawing.DrawLine(startPos.WorldToScreen(), startPos.Extend(endPos, 1000).To3D().WorldToScreen(), 3, System.Drawing.Color.Red);
                }
                Drawing.DrawText(wallStartPosition.To3D().WorldToScreen(), System.Drawing.Color.Purple, wallStartPosition.Distance(wallEndPosition).ToString(), 15);
                Drawing.DrawText(startPos.Extend(endPos, 1000).To3D().WorldToScreen(), System.Drawing.Color.Purple, (wallStartPosition.Distance(wallEndPosition) + startPos.Distance(wallStartPosition)).ToString(), 15);
                Drawing.DrawCircle(endPos, 50, System.Drawing.Color.White);
            }
        }
Example #4
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 #5
0
        public static Obj_AI_Base FindEnemyToBlockChannelingSpell(MissileClient missile, SpellInfo info)
        {
            Obj_AI_Base target = ObjectManager.Get <Obj_AI_Base>().Where(a => a.IsEnemy &&
                                                                         a.IsInRange(Yasuo, Program.E.Range) &&
                                                                         !a.IsDead &&
                                                                         !a.IsInvulnerable &&
                                                                         !a.HasBuff("YasuoDashWrapper") &&
                                                                         !YasuoCalcs.IsUnderTurret(YasuoCalcs.GetDashingEnd(a)) &&
                                                                         YasuoCalcs.GetDashingEnd(a).IsInRange(missile.StartPosition, Program.W.Range)).FirstOrDefault();

            return(target);
        }
        public static float ComboDamage(this AIHeroClient enemy)
        {
            float qdmg      = Program.Q.IsReady() ? YasuoCalcs.Q(enemy) : 0;
            float edmg      = Program.E.IsReady() ? YasuoCalcs.E(enemy) : 0;
            float autoDmg   = Player.Instance.GetAutoAttackDamage(enemy) * MenuHandler.Drawing.GetSliderValue("Autos used in Combo");
            float qTotalDmg = qdmg * MenuHandler.Drawing.GetSliderValue("Q's used in Combo");
            float tiamat    = Player.Instance.GetItem(ItemId.Tiamat) != null && Player.Instance.GetItem(ItemId.Tiamat).CanUseItem() ? DamageLibrary.GetItemDamage(Player.Instance, enemy, ItemId.Tiamat) : 0;
            float thydra    = Player.Instance.GetItem(ItemId.Titanic_Hydra) != null && Player.Instance.GetItem(ItemId.Titanic_Hydra).CanUseItem() ? DamageLibrary.GetItemDamage(Player.Instance, enemy, ItemId.Titanic_Hydra) : 0;
            float rhydra    = Player.Instance.GetItem(ItemId.Ravenous_Hydra) != null && Player.Instance.GetItem(ItemId.Ravenous_Hydra).CanUseItem() ? DamageLibrary.GetItemDamage(Player.Instance, enemy, ItemId.Ravenous_Hydra) : 0;

            float comboDamage = qTotalDmg + edmg + autoDmg + tiamat + thydra + rhydra;

            return(comboDamage);
        }
Example #7
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 #8
0
        public static void CastIgnite(List <Obj_AI_Base> enemies, bool ks)
        {
            if (!Program.Ignite.IsReady() || !enemies.Any(a => a.IsInRange(Yasuo, Program.Ignite.Range)) || didActionThisTick)
            {
                return;
            }

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

            if (unit != null)
            {
                didActionThisTick = Program.Ignite.Cast(unit);
            }
        }
Example #9
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 #10
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 #11
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 #12
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());
                    }
                }
            }
        }
Example #13
0
        //complete
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (Yasuo.IsDead)
            {
                return;
            }

            Menu menu = MenuHandler.Drawing;

            System.Drawing.Color drawColor = System.Drawing.Color.Blue;

            //Drawing.DrawText(Yasuo.Position.WorldToScreen(), drawColor, Animation, 15);

            //Vector3 yasuoQStartPos = Yasuo.Position + new Vector3(0, 0, 150f),
            //    yasuoQEndPos = yasuoQStartPos.To2D().Extend(Game.CursorPos, Q.Range).To3D((int)yasuoQStartPos.Z - 75);

            //yasuoQStartPos.DrawArrow(yasuoQEndPos, drawColor);
            //Drawing.DrawLine(yasuoQStartPos.WorldToScreen(), yasuoQEndPos.WorldToScreen(), 5, drawColor);

            if (menu.GetCheckboxValue("Draw Q") && !Yasuo.HasBuff("YasuoQ3W") && Q.IsLearned)
            {
                //Drawing.DrawCircle(yasuoQStartPos, Q.Range, drawColor);
                Q.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw Q") && Yasuo.HasBuff("YasuoQ3W") && Q.IsLearned)
            {
                Q3.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw W") && W.IsLearned)
            {
                W.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw E") && E.IsLearned)
            {
                E.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw EQ") && E.IsLearned && Q.IsLearned)
            {
                EQ.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw R") && R.IsLearned)
            {
                R.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw Beyblade") && R.IsLearned && Flash != null && E.IsLearned && Q.IsLearned)
            {
                Drawing.DrawCircle(Yasuo.Position, E.Range + Flash.Range + (EQ.Range / 2), System.Drawing.Color.Red);
            }
            if (menu.GetCheckboxValue("Draw Turret Range"))
            {
                foreach (Obj_AI_Turret turret in EntityManager.Turrets.Enemies.Where(a => !a.IsDead && a.VisibleOnScreen))
                {
                    turret.DrawCircle((int)turret.GetAutoAttackRange() + 35, drawColor);
                }
            }

            Obj_AI_Base hoverObject = EntityManager.Enemies.Where(a => !a.IsDead && a.IsTargetable && a.IsInRange(Yasuo, E.Range) && a.Distance(Game.CursorPos) <= 75).OrderBy(a => a.Distance(Game.CursorPos)).FirstOrDefault();

            if (hoverObject != null)
            {
                if (menu.GetCheckboxValue("Draw EQ on Target"))
                {
                    Drawing.DrawCircle(YasuoCalcs.GetDashingEnd(hoverObject), EQ.Range, drawColor);
                }
                if (menu.GetCheckboxValue("Draw E End Position on Target"))
                {
                    Drawing.DrawLine(Yasuo.Position.WorldToScreen(), YasuoCalcs.GetDashingEnd(hoverObject).WorldToScreen(), 3, drawColor);
                }
                if (menu.GetCheckboxValue("Draw E End Position on Target - Detailed"))
                {
                    Vector3 startPos   = Yasuo.Position,
                            dashEndPos = YasuoCalcs.GetDashingEnd(hoverObject),
                            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);

                    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);

                    for (int i = 0; i < pointsAlongPath.Count() - 1; i++)
                    {
                        System.Drawing.Color color = (pointsAlongPath[i].IsWall()) ? System.Drawing.Color.Red : System.Drawing.Color.Green;
                        Drawing.DrawLine(pointsAlongPath[i].WorldToScreen(), pointsAlongPath[i + 1].WorldToScreen(), 2, color);
                    }

                    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];

                    Drawing.DrawText(closestWall.WorldToScreen(), drawColor, "start", 15);
                    Drawing.DrawText(closestWallsEndPosition.WorldToScreen(), drawColor, "end", 15);
                    Drawing.DrawText(((closestWall + closestWallsEndPosition) / 2).WorldToScreen(), drawColor, closestWall.Distance(closestWallsEndPosition).ToString(), 15);
                    Drawing.DrawText(dashEndPos.WorldToScreen(), drawColor, startPos.Distance(closestWallsEndPosition).ToString(), 15);

                    //none of the points are a wall so the end point is the dash position
                    if (!pointsAlongPath.Any(a => a.IsWall()))
                    {
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    }
                    // 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) > E.Range)
                    {
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    }
                    //or the dashing end is not a wall
                    else if (!dashEndPos.IsWall())
                    {
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    }
                    //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)
                    {
                        Drawing.DrawCircle(closestWallsEndPosition, 50, drawColor);
                    }
                    //the end position is the first wall
                    else
                    {
                        Drawing.DrawCircle(pointsAlongPath.First(a => a.IsWall()), 50, drawColor);
                    }
                }
            }

            if (menu.GetCheckboxValue("Draw Wall Dashes") && E.IsLearned)
            {
                foreach (WallDash wd in YasuoWallDashDatabase.wallDashDatabase.Where(a => a.startPosition.Distance(Yasuo) <= 1300))
                {
                    if (EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && a.VisibleOnScreen && a.Name == wd.unitName && a.ServerPosition.Distance(wd.dashUnitPosition) <= 2).FirstOrDefault() != null)
                    {
                        wd.startPosition.DrawArrow(wd.endPosition, System.Drawing.Color.Red, 1);
                        Geometry.Polygon.Circle dashCircle = new Geometry.Polygon.Circle(wd.endPosition, 120);
                        dashCircle.Draw(System.Drawing.Color.Red, 1);
                    }
                }
            }
        }