/// <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 (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); Geometry.Polygon spellHitBox = ClipperWrapper.DefineRectangle(from, to, width); if (isArc) { spellHitBox = new SPrediction.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(ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(yasuoWallPoly), ClipperWrapper.MakePaths(spellHitBox))); }
/// <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 (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); Geometry.Polygon spellHitBox = ClipperWrapper.DefineRectangle(from, to, width); if (isArc) { spellHitBox = new SPrediction.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 ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(yasuoWallPoly), ClipperWrapper.MakePaths(spellHitBox)); }