internal override void UpdatePolygon() { if (this.Rectangle == null) { this.Rectangle = new RectanglePoly(this.StartPosition, this.EndPosition, this.SData.Radius); this.UpdatePath(); } }
/// <summary> /// Returns the list of the units that the skill-shot will hit before reaching the set positions. /// </summary> /// <param name="positions"> /// The positions. /// </param> /// <param name="input"> /// The input. /// </param> /// <returns> /// A list of <c>Obj_AI_Base</c>s which the input collides with. /// </returns> public static List <Obj_AI_Base> GetCollision(List <Vector3> positions, PredictionInput input) { var result = new List <Obj_AI_Base>(); foreach (var position in positions) { if (input.CollisionObjects.HasFlag(CollisionableObjects.Minions)) { result.AddRange( GameObjects.EnemyMinions.Where(i => i.IsMinion() || i.IsPet()) .Concat(GameObjects.Jungle) .Where( minion => minion.IsValidTarget( Math.Min(input.Range + input.Radius + 100, 2000), true, input.RangeCheckFrom) && (minion.Distance(input.From) < 10 + minion.BoundingRadius || minion.Distance(position) < minion.BoundingRadius || IsHitCollision(minion, input, position, minion.IsMoving ? 50 : 15)))); } if (input.CollisionObjects.HasFlag(CollisionableObjects.Heroes)) { result.AddRange( GameObjects.EnemyHeroes.Where( hero => hero.IsValidTarget( Math.Min(input.Range + input.Radius + 100, 2000), true, input.RangeCheckFrom) && IsHitCollision(hero, input, position, 50))); } if (input.CollisionObjects.HasFlag(CollisionableObjects.Walls)) { var step = position.Distance(input.From) / 20; for (var i = 0; i < 20; i++) { if (input.From.ToVector2().Extend(position, step * i).IsWall()) { result.Add(GameObjects.Player); } } } if (input.CollisionObjects.HasFlag(CollisionableObjects.YasuoWall)) { if (yasuoWallLeft == null || yasuoWallRight == null) { continue; } yasuoWallPoly = new RectanglePoly(yasuoWallLeft.Position, yasuoWallRight.Position, 75); var intersections = new List <Vector2>(); for (var i = 0; i < yasuoWallPoly.Points.Count; i++) { var inter = yasuoWallPoly.Points[i].Intersection( yasuoWallPoly.Points[i != yasuoWallPoly.Points.Count - 1 ? i + 1 : 0], input.From.ToVector2(), position.ToVector2()); if (inter.Intersects) { intersections.Add(inter.Point); } } if (intersections.Count > 0) { result.Add(GameObjects.Player); } } } return(result.Distinct().ToList()); }
internal override void UpdatePolygon() { Rectangle = new RectanglePoly(this.StartPosition, this.EndPosition, 55); this.UpdatePath(); }
/// <summary> /// Returns the list of the units that the skill-shot will hit before reaching the set positions. /// </summary> /// <param name="positions"> /// The positions. /// </param> /// <param name="input"> /// The input. /// </param> /// <returns> /// A list of <c>Obj_AI_Base</c>s which the input collides with. /// </returns> /// public static List <Obj_AI_Base> GetCollision(List <Vector3> positions, PredictionInput input) { var result = new List <Obj_AI_Base>(); foreach (var position in positions) { if (input.CollisionObjects.HasFlag(CollisionableObjects.Minions)) { result.AddRange( EntityManager.MinionsAndMonsters.EnemyMinions.Where(i => i.IsMinion || i.Pet != null) .Concat(GameObjects.Jungle) .Where( minion => minion.IsValidTarget(Math.Min(input.Range + input.Radius + 100, 2000), true, input.RangeCheckFrom) && IsHitCollision(minion, input, position, 20))); } if (input.CollisionObjects.HasFlag(CollisionableObjects.Heroes)) { result.AddRange( GameObjects.EnemyHeroes.Where( hero => hero.IsValidTarget( Math.Min(input.Range + input.Radius + 100, 2000), true, input.RangeCheckFrom) && IsHitCollision(hero, input, position, 50))); } if (input.CollisionObjects.HasFlag(CollisionableObjects.Walls)) { var step = position.Distance(input.From) / 20; for (var i = 0; i < 20; i++) { if (input.From.ToVector2().Extend(position, step * i).IsWall()) { result.Add(GameObjects.Player); } } } if (input.CollisionObjects.HasFlag(CollisionableObjects.YasuoWall)) { /*if (Variables.TickCount - wallCastT > 4000) * { * continue; * }*/ var wall = GameObjects.AllGameObjects.FirstOrDefault( gameObject => gameObject.IsValid && Regex.IsMatch(gameObject.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase)); if (wall == null) { continue; } Chat.Print(wall.Name + " => " + wall.Type + " | " + wall.Team); var level = wall.Name.Substring(wall.Name.Length - 6, 1); var wallWidth = 300 + (50 * Convert.ToInt32(level)); var wallDirection = (wall.Position.ToVector2() - yasuoWallCastedPos).LSNormalized().Perpendicular(); var wallStart = wall.Position.ToVector2() + (wallWidth / 2f * wallDirection); var wallEnd = wallStart - (wallWidth * wallDirection); var wallPolygon = new RectanglePoly(wallStart, wallEnd, 75); var intersections = new List <Vector2>(); for (var i = 0; i < wallPolygon.Points.Count; i++) { var inter = wallPolygon.Points[i].Intersection( wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0], input.From.ToVector2(), position.ToVector2()); if (inter.Intersects) { intersections.Add(inter.Point); } } wallPolygon.Draw(Color.Red); if (intersections.Count > 0) { result.Add(GameObjects.Player); } } } return(result.Distinct().ToList()); }