Exemple #1
0
        /// <summary>
        /// Checks Yasuo wall collisions
        /// </summary>
        /// <param name="poly">Polygon to check collision</param>
        /// <returns>true if collision found</returns>
        public bool CheckYasuoWallCollision(Geometry.Polygon poly)
        {
            if (Utils.TickCount - yasuoWallCastedTick > 4000)
            {
                return(false);
            }

            GameObject yasuoWall = ObjectManager.Get <GameObject>().Where(p => p.IsValid && Regex.IsMatch(p.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase)).FirstOrDefault();

            if (yasuoWall == null)
            {
                return(false);
            }

            Vector2 yasuoWallDirection = (yasuoWall.Position.To2D() - yasuoWallCastedPos).Normalized().Perpendicular();
            float   yasuoWallWidth     = 300 + 50 * yasuoWallLevel;

            Vector2 yasuoWallStart = yasuoWall.Position.To2D() + yasuoWallWidth / 2f * yasuoWallDirection;
            Vector2 yasuoWallEnd   = yasuoWallStart - yasuoWallWidth * yasuoWallDirection;

            Geometry.Polygon yasuoWallPoly = ClipperWrapper.DefineRectangle(yasuoWallStart, yasuoWallEnd, 5);

            return(ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(yasuoWallPoly), ClipperWrapper.MakePaths(poly)));
        }
Exemple #2
0
        /// <summary>
        /// Checks hero collisions
        /// </summary>
        /// <param name="from">Start position</param>
        /// <param name="to">End position</param>
        /// <param name="width">Width</param>
        /// <param name="checkAlly">Check ally heroes</param>
        /// <returns>true if collision found</returns>
        public bool CheckHeroCollision(Vector2 from, Vector2 to, Spell s, bool checkAlly = false)
        {
            Geometry.Polygon   poly        = ClipperWrapper.DefineRectangle(from, to, s.Width);
            List <Obj_AI_Hero> listToCheck = checkAlly ? HeroManager.AllHeroes : HeroManager.Enemies;

            return(listToCheck.AsParallel().Any(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(poly), ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(p.ServerPosition.To2D(), p.BoundingRadius)))));
        }
Exemple #3
0
        /// <summary>
        /// Checks minion collisions
        /// </summary>
        /// <param name="from">Start position</param>
        /// <param name="to">End position</param>
        /// <param name="width">Width</param>
        /// <returns>true if collision found</returns>
        public bool CheckMinionCollision(Vector2 from, Vector2 to, Spell s)
        {
            Geometry.Polygon poly = ClipperWrapper.DefineRectangle(from, to, s.Width);
            HitChance        hc;

            return(MinionManager.GetMinions(from.Distance(to) + 100, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None).AsParallel().Any(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetPrediction(p, s, p.GetWaypoints(), 0, 0, 0, out hc, p.ServerPosition), p.BoundingRadius)), ClipperWrapper.MakePaths(poly))));
        }