static Boolean checkYasuoWall(Vector3 enemyPos) { if (wallCastTick > Environment.TickCount) { GameObject wall = null; foreach (var gameObject in ObjectManager.Get<GameObject>()) { if (gameObject.IsValid && Regex.IsMatch(gameObject.Name, "_w_windwall", System.Text.RegularExpressions.RegexOptions.IgnoreCase)) { wall = gameObject; break; } } if (wall == null) return false; int wallWidth = (300 + 50 * Convert.ToInt32(wall.Name.Substring(wall.Name.Length - 6, 1))); var wallDirection = (wall.Position.To2D() - yasuoWallPos).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2 * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; Vector2 Direction = (wallEnd - wallStart).Normalized(); Vector2 Perpendicular = Direction.Perpendicular(); Geometry.Polygon wallPolygon = new Geometry.Polygon(); int widthWall = 75; wallPolygon.Add(wallStart + widthWall * Perpendicular); wallPolygon.Add(wallStart - widthWall * Perpendicular); wallPolygon.Add(wallEnd - widthWall * Perpendicular); wallPolygon.Add(wallEnd + widthWall * Perpendicular); int polygonCounts = wallPolygon.Points.Count; for (var i = 0; i < polygonCounts; i++) { var inter = wallPolygon.Points[i].Intersection(wallPolygon.Points[i != polygonCounts - 1 ? i + 1 : 0], player.ServerPosition.To2D(), enemyPos.To2D()); if (inter.Intersects) return true; } } return false; }
private static void getAllUnsafePositions() { List<Geometry.Polygon> dangerousPositions = new List<Geometry.Polygon>(); foreach (var Hero in ObjectManager.Get<Obj_AI_Hero>()) { var Q = Hero.Spellbook.GetSpell(SpellSlot.Q); var W = Hero.Spellbook.GetSpell(SpellSlot.W); var E = Hero.Spellbook.GetSpell(SpellSlot.E); var R = Hero.Spellbook.GetSpell(SpellSlot.R); var AARange = Hero.AttackRange; List<float> Ranges = new List<float>(); if (Q.SData.CastRange <= 900 && Q.Cooldown <= 0)//filter global skillshots and Spells on cooldown { Ranges.Add(Q.SData.CastRange); } if (W.SData.CastRange <= 900 && W.Cooldown <= 0)//filter global skillshots and Spells on cooldown { Ranges.Add(W.SData.CastRange); } if (E.SData.CastRange <= 900 && E.Cooldown <= 0)//filter global skillshots and Spells on cooldown { Ranges.Add(E.SData.CastRange); } if (R.SData.CastRange <= 900 && R.Cooldown <= 0)//filter global skillshots and Spells on cooldown { Ranges.Add(R.SData.CastRange); } Ranges.Add(AARange); float maxRange = Ranges.Max(); var Poly = new Geometry.Polygon(); int sensitivity = 60; for(int i = 0; i < sensitivity; i ++){//Todo, allow user interactivity var Circle = new Vector2(Hero.Position + maxRange * Math.Cos(360/sensitivity), Hero.Position + maxRange * Math.Sin(360/sensitivity)); Poly.Add(Circle); } dangerousPositions.Add(Poly); } return dangerousPositions; }
private Geometry.Polygon GetPoly(Vector3 pos) { var POS = player.ServerPosition.Extend(pos, Q.ChargedMaxRange); var direction = (POS.To2D() - player.ServerPosition.To2D()).Normalized(); var pos1 = (player.ServerPosition.To2D() - direction.Perpendicular() * qWidth / 2f).To3D(); var pos2 = (POS.To2D() + (POS.To2D() - player.ServerPosition.To2D()).Normalized() + direction.Perpendicular() * qWidth / 2f).To3D(); var pos3 = (player.ServerPosition.To2D() + direction.Perpendicular() * qWidth / 2f).To3D(); var pos4 = (POS.To2D() + (POS.To2D() - player.ServerPosition.To2D()).Normalized() - direction.Perpendicular() * qWidth / 2f).To3D(); var poly = new Geometry.Polygon(); poly.Add(pos1); poly.Add(pos3); poly.Add(pos2); poly.Add(pos4); return poly; }
public static Geometry.Polygon GetPoly(Vector3 pos, float range, float widht) { var POS = player.ServerPosition.Extend(pos, range); var direction = (POS.To2D() - player.ServerPosition.To2D()).Normalized(); var pos1 = (player.ServerPosition.To2D() - direction.Perpendicular() * widht / 2f).To3D(); var pos2 = (POS.To2D() + (POS.To2D() - player.ServerPosition.To2D()).Normalized() + direction.Perpendicular() * widht / 2f).To3D(); var pos3 = (player.ServerPosition.To2D() + direction.Perpendicular() * widht / 2f).To3D(); var pos4 = (POS.To2D() + (POS.To2D() - player.ServerPosition.To2D()).Normalized() - direction.Perpendicular() * widht / 2f).To3D(); var poly = new Geometry.Polygon(); poly.Add(pos1); poly.Add(pos3); poly.Add(pos2); poly.Add(pos4); return poly; }