Exemple #1
0
        public static Vector2 GetCollisionPoint(this LinearSkillshot skillshot)
        {
            if (!skillshot.OwnSpellData.MinionCollision || skillshot.Missile == null)
            {
                return(Vector2.Zero);
            }

            var collisions = new List <Vector2>();

            var currentSpellPos = skillshot.GetCurrentPosition().To2D();

            if (EvadeMenu.CollisionMenu["minion"].Cast <CheckBox>().CurrentValue)
            {
                foreach (var minion in
                         EntityManager.MinionsAndMonsters.AlliedMinions.Where(x => !x.IsDead && x.IsValid && x.Health >= 50 &&
                                                                              x.Distance(skillshot.RealCurrentPosition) <= skillshot.OwnSpellData.Range + 100))
                {
                    var proj = minion.Position.To2D().ProjectOn(skillshot.RealCurrentPosition.To2D(), skillshot.RealEndPosition.To2D());
                    if (proj.IsOnSegment)
                    {
                        collisions.Add(proj.SegmentPoint);
                    }
                }
            }

            if (EvadeMenu.CollisionMenu["yasuoWall"].Cast <CheckBox>().CurrentValue&& skillshot.Missile != null)
            {
                GameObject wall = null;
                foreach (var gameObject in ObjectManager.Get <GameObject>().
                         Where(gameObject => gameObject.IsValid && System.Text.RegularExpressions.Regex.IsMatch(
                                   gameObject.Name, "_w_windwall.\\.troy", System.Text.RegularExpressions.RegexOptions.IgnoreCase)))
                {
                    wall = gameObject;
                }
                if (wall != null)
                {
                    var level         = wall.Name.Substring(wall.Name.Length - 6, 1);
                    var wallWidth     = 300 + 50 * Convert.ToInt32(level);
                    var wallDirection = (wall.Position.To2D() - WindWallStartPosition).Normalized().Perpendicular();

                    var wallStart   = wall.Position.To2D() + wallWidth / 2f * wallDirection;
                    var wallEnd     = wallStart - wallWidth * wallDirection;
                    var wallPolygon = new Geometry.Polygon.Rectangle(wallStart, wallEnd, 75);

                    var intersections = wallPolygon.GetIntersectionPointsWithLineSegment(skillshot.GetCurrentPosition().To2D(),
                                                                                         skillshot.RealEndPosition.To2D());


                    if (intersections.Length > 0)
                    {
                        float wallDisappearTime = WallCastTick + 250 + 3750 - Environment.TickCount;

                        collisions.AddRange(intersections.Where(intersec =>
                                                                intersec.Distance(currentSpellPos) / skillshot.OwnSpellData.MissileSpeed * 1000 <
                                                                wallDisappearTime).ToList());
                    }
                }
            }

            var result = collisions.Count > 0 ? collisions.
                         OrderBy(c => c.Distance(currentSpellPos)).ToList().First() : Vector2.Zero;

            return(result);
        }