/// <summary> /// Checks Yasuo wall collisions /// </summary> /// <param name="poly">Polygon to check collision</param> /// <returns>true if collision found</returns> public static bool CheckYasuoWallCollision(Geometry.Polygon spellHitBox) { if (GameObjects.EnemyHeroes.All(x => x.CharacterName != "Yasuo")) { return(false); } foreach (var effectEmitter in ObjectManager.Get <EffectEmitter>()) { if (effectEmitter.IsValid && Regex.IsMatch(effectEmitter.Name, @"Yasuo_.+_w_windwallenemy\d", RegexOptions.IgnoreCase)) { var wall = effectEmitter; var level = wall.Name.Substring(wall.Name.Length - 2, 2); var wallWidth = 250 + 50 * Convert.ToInt32(level); var wallDirection = wall.Position.ToVector2(); var wallStart = wall.Position.ToVector2() + wallWidth / 2 * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPoly = ClipperWrapper.DefineRectangle(wallStart, wallEnd, 5); if (Variables.GameTimeTickCount < wall.RestartTime + 4000) { if (ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(wallPoly), ClipperWrapper.MakePaths(spellHitBox))) { return(true); } } } } return(false); }
/// <summary> /// Checks minion collisions /// </summary> /// <param name="from">Start position</param> /// <param name="to">End position</param> /// <param name="width">Rectangle scale</param> /// <param name="delay">Spell delay</param> /// <param name="missileSpeed">Spell missile speed</param> /// <param name="isArc">Checks collision for arc spell</param> /// <returns>true if collision found</returns> public static bool CheckMinionCollision(Vector2 from, Vector2 to, float width, float delay, float missileSpeed = 0, bool isArc = false) { var spellHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(from, to, width)); if (isArc) { spellHitBox = ClipperWrapper.MakePaths(new SPredictionMash.Geometry.Polygon( ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 200 * (to.Distance(from) / 900)), ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 320 * (to.Distance(from) / 900)))); } return(MinionManager.GetMinions(from.Distance(to) + 250, MinionManager.MinionTypes.All, MinionManager.MinionTeam.NotAlly, MinionManager.MinionOrderTypes.None).AsParallel().Any(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius * 2f + 10f)), spellHitBox))); }
/// <summary> /// Checks enemy hero collisions /// </summary> /// <param name="from">Start position</param> /// <param name="to">End position</param> /// <param name="width">Rectangle scale</param> /// <param name="delay">Spell delay</param> /// <param name="missileSpeed">Spell missile speed</param> /// <param name="isArc">Checks collision for arc spell</param> /// <returns>true if collision found</returns> public static bool CheckAllyHeroCollision(Vector2 from, Vector2 to, float width, float delay, float missileSpeed = 0, bool isArc = false) { var spellHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(from, to, width)); if (isArc) { spellHitBox = ClipperWrapper.MakePaths(new SPredictionMash.Geometry.Polygon( ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 200 * (to.Distance(from) / 900)), ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 320 * (to.Distance(from) / 900)))); } return(GameObjects.AllyHeroes.AsParallel().Any(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox))); }
/// <summary> /// Gets collided units & flags /// </summary> /// <param name="from">Start position</param> /// <param name="to">End position</param> /// <param name="width">Rectangle scale</param> /// <param name="delay">Spell delay</param> /// <param name="missileSpeed">Spell missile speed</param> /// <returns>Collision result as <see cref="Collision.Result"/></returns> public static Result GetCollisions(Vector2 from, Vector2 to, float range, float width, float delay, float missileSpeed = 0, bool isArc = false) { List <AIBaseClient> collidedUnits = new List <AIBaseClient>(); var spellHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(from, to.Extend(from, -width), width)); if (isArc) { spellHitBox = ClipperWrapper.MakePaths(new SPredictionMash.Geometry.Polygon( ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 200 * (to.Distance(from) / 900)), ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 320 * (to.Distance(from) / 900)))); } Flags _colFlags = Flags.None; var collidedMinions = MinionManager.GetMinions(range + 100, MinionManager.MinionTypes.All, MinionManager.MinionTeam.NotAlly, MinionManager.MinionOrderTypes.None).AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius + 15)), spellHitBox)); var collidedEnemies = GameObjects.EnemyHeroes.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox)); var collidedAllies = GameObjects.AllyHeroes.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox)); if (collidedMinions != null && collidedMinions.Count() != 0) { collidedUnits.AddRange(collidedMinions); _colFlags |= Flags.Minions; } if (collidedEnemies != null && collidedEnemies.Count() != 0) { collidedUnits.AddRange(collidedEnemies); _colFlags |= Flags.EnemyChampions; } if (collidedAllies != null && collidedAllies.Count() != 0) { collidedUnits.AddRange(collidedAllies); _colFlags |= Flags.AllyChampions; } if (CheckWallCollision(from, to)) { _colFlags |= Flags.Wall; } if (CheckYasuoWallCollision(from, to, width)) { _colFlags |= Flags.YasuoWall; } return(new Result(collidedUnits, _colFlags)); }
/// <summary> /// Check Yasuo wall collisions /// </summary> /// <param name="from">Start position</param> /// <param name="to">End position</param> /// <param name="width">Rectangle scale</param> /// <param name="isArc">Check collision for arc spell</param> /// <returns>true if collision found</returns> public static bool CheckYasuoWallCollision(Vector2 from, Vector2 to, float width, bool isArc = false) { if (GameObjects.EnemyHeroes.All(x => x.CharacterName != "Yasuo")) { return(false); } var spellHitBox = ClipperWrapper.DefineRectangle(from, to, width); if (isArc) { spellHitBox = new SPredictionMash.Geometry.Polygon( ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 200 * (to.Distance(from) / 900)), ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 320 * (to.Distance(from) / 900))); } foreach (var effectEmitter in ObjectManager.Get <EffectEmitter>()) { if (effectEmitter.IsValid && Regex.IsMatch(effectEmitter.Name, @"Yasuo_.+_w_windwallenemy\d", RegexOptions.IgnoreCase)) { var wall = effectEmitter; var level = wall.Name.Substring(wall.Name.Length - 2, 2); var wallWidth = 250 + 50 * Convert.ToInt32(level); var wallDirection = wall.Position.ToVector2(); var wallStart = wall.Position.ToVector2() + wallWidth / 2 * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPoly = ClipperWrapper.DefineRectangle(wallStart, wallEnd, 5); if (Variables.GameTimeTickCount < wall.RestartTime + 4000) { if (ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(wallPoly), ClipperWrapper.MakePaths(spellHitBox))) { return(true); } } } } return(false); }