public static Vector3 bestVectorToAoeFarm(Vector3 center, float spellrange, float spellWidth, int hit = 0) { var minions = MinionManager.GetMinions(center, spellrange, MinionTypes.All, MinionTeam.NotAlly); Vector3 bestPos = new Vector3(); int hits = hit; foreach (var minion in minions) { if (countMinionsInrange(minion.Position, spellWidth) > hits) { bestPos = minion.Position; hits = countMinionsInrange(minion.Position, spellWidth); } Vector3 newPos = new Vector3(minion.Position.X + 80, minion.Position.Y + 80, minion.Position.Z); for (int i = 1; i < 4; i++) { var rotated = newPos.To2D().RotateAroundPoint(newPos.To2D(), 90 * i).To3D(); if (countMinionsInrange(rotated, spellWidth) > hits && player.Distance(rotated) <= spellrange) { bestPos = newPos; hits = countMinionsInrange(rotated, spellWidth); } } } return bestPos; }
public static Vector3 bestVectorToAoeSpell(IEnumerable<AIHeroClient> heroes, float spellrange, float spellwidth) { var bestPos = new Vector3(); var hits = 0; foreach (var hero in heroes) { if (countChampsAtrange(hero.Position, spellwidth) > hits) { bestPos = hero.Position; hits = countChampsAtrange(hero.Position, spellwidth); } var newPos = new Vector3(hero.Position.X + 80, hero.Position.Y + 80, hero.Position.Z); for (var i = 1; i < 4; i++) { var rotated = newPos.To2D().RotateAroundPoint(newPos.To2D(), 90*i).To3D(); if (countChampsAtrange(rotated, spellwidth) > hits && player.Distance(rotated) <= spellrange) { bestPos = newPos; hits = countChampsAtrange(rotated, spellwidth); } } } return bestPos; }
public static void Jump(Vector3 pos, bool juke = false, bool castq = true) { if (Math.Abs(Program._e.Cooldown) < 0.00001) { var extended = ObjectManager.Player.ServerPosition.To2D().Extend(pos.To2D(), 800f); if (!JumpTo.IsValid()) JumpTo = pos.To2D(); if (Program._w.IsReady() && SoldierMgr.ActiveSoldiers.Count == 0) { if (juke) { var outRadius = 250 / (float)Math.Cos(2 * Math.PI / 12); for (var i = 1; i <= 12; i++) { var angle = i * 2 * Math.PI / 12; var x = ObjectManager.Player.Position.X + outRadius * (float)Math.Cos(angle); var y = ObjectManager.Player.Position.Y + outRadius * (float)Math.Sin(angle); if (NavMesh.GetCollisionFlags(x, y).HasFlag(CollisionFlags.Wall) && !ObjectManager.Player.ServerPosition.To2D().Extend(new Vector2(x, y), 500f).IsWall()) { Program._w.Cast(ObjectManager.Player.ServerPosition.To2D().Extend(new Vector2(x, y), 800f)); return; } } } Program._w.Cast(extended); } if (SoldierMgr.ActiveSoldiers.Count > 0 && Program._q.IsReady()) { var closestSoldier = SoldierMgr.ActiveSoldiers.MinOrDefault(s => s.Position.To2D().Distance(extended, true)); CastELocation = closestSoldier.Position.To2D(); CastQLocation = closestSoldier.Position.To2D().Extend(JumpTo, 800f); if (CastELocation.Distance(JumpTo) > ObjectManager.Player.ServerPosition.To2D().Distance(JumpTo) && !juke && castq) { CastQLocation = extended; CastET = Utils.TickCount + 250; Program._q.Cast(CastQLocation); } else { Program._e.Cast(CastELocation, true); if (ObjectManager.Player.ServerPosition.To2D().Distance(CastELocation) < 700 && castq) LeagueSharp.Common.Utility.DelayAction.Add(250, () => Program._q.Cast(CastQLocation, true)); } } } else { if (Program._q.IsReady() && CastELocation.Distance(ObjectManager.Player.ServerPosition) <= 200 && castq) Program._q.Cast(CastQLocation, true); JumpTo = Vector2.Zero; } }
public static Vector3 RotatePosition(Vector3 path) { var rotateAroundPoint = path.To2D().RotateAroundPoint(Player.Instance.Position.To2D(), 180); var finalPath = new Vector3(rotateAroundPoint, NavMesh.GetHeightForPosition(rotateAroundPoint.X, rotateAroundPoint.Y)); return finalPath; }
public static List<Vector2> GetCastMinionsPredictedPositions(List<Obj_AI_Base> minions, float delay, float width, float speed, Vector3 from, float range, bool collision, SkillshotType stype, Vector3 rangeCheckFrom = new Vector3()) { var result = new List<Vector2>(); from = from.To2D().IsValid() ? from : ObjectManager.Player.ServerPosition; foreach (var minion in minions) { var pos = Prediction.GetPrediction(new PredictionInput { Unit = minion, Delay = delay, Radius = width, Speed = speed, From = from, Range = range, Collision = collision, Type = stype, RangeCheckFrom = rangeCheckFrom }); if (pos.Hitchance >= HitChance.High) { result.Add(pos.CastPosition.To2D()); } } return result; }
public static bool CheckHeroCollision(Vector3 to) { if (Position == to) return false; return Collision.CheckEnemyHeroCollision(Position.To2D(), to.To2D(), 130f, 0.25f); }
public static int CountEnemysInRange(float range, Vector3 point) { return ( from units in ObjectManager.Get<Obj_AI_Hero>() where units.IsValidTarget() select units).Count<Obj_AI_Hero>( units => Vector2.Distance(point.To2D(), units.Position.To2D()) <= range); }
public static int CountAlliesInRange(float range, Vector3 point) { return ( from units in ObjectManager.Get<Obj_AI_Hero>() where units.IsAlly && units.IsVisible && !units.IsDead select units).Count<Obj_AI_Hero>( units => Vector2.Distance(point.To2D(), units.Position.To2D()) <= range); }
/// <summary> /// Calculates Reflected Position. Returns no Vector if it is a wall, building, or prop /// </summary> /// <param name="source">The Player or Position Being Reflected</param> /// <param name="newPath">The Path</param> /// <returns></returns> private static Vector3 CalculatePosition(Obj_AI_Base source, Vector3 path) { var playerPosition2D = source.Position.To2D(); var pathPosition2D = path.To2D(); var reflectedPos = Vector2.Reflect(pathPosition2D, playerPosition2D).To3D(); return reflectedPos; }
public static Vector3? GetFirstWallPoint(this Vector3 from, Vector3 to, float step = 25) { var wallPoint = GetFirstWallPoint(from.To2D(), to.To2D(), step); if (wallPoint.HasValue) { return wallPoint.Value.To3DWorld(); } return null; }
public static PositionInfo GetScreenPosition(Vector3 position3D) { var position = position3D.To2D(); var worldCenter = GetWorldCenter(); var screenCenter = Drawing.WorldToScreen(worldCenter.To3D().SetZ(0)); if (position3D.IsOnScreen()) { var screenPosition = Drawing.WorldToScreen(position3D); return new PositionInfo { screenPosition = screenPosition, direction = (screenPosition - screenCenter).Normalized(), distance = worldCenter.Distance(position), screenCollisionDistance = worldCenter.Distance(position) }; } var worldDir = (position - worldCenter).Normalized(); var worldClosePosition = worldCenter + worldDir * 100; var screenClosePosition = Drawing.WorldToScreen(worldClosePosition.To3D().SetZ(0)); var dir = (screenClosePosition - screenCenter).Normalized(); var screenFarPosition = screenCenter + dir * (Math.Max(Drawing.Width, Drawing.Height) + 100); var ray = new Ray(screenFarPosition.To3D().SetZ(0), -dir.To3D().SetZ(0)); var boundingBox = new BoundingBox(new Vector3(0, 0, -1), new Vector3(Drawing.Width, Drawing.Height, 1)); float dist; var hasIntersection = ray.Intersects(ref boundingBox, out dist); if (hasIntersection) { var rayDirection = dir; var distance = worldCenter.Distance(position); var finalScreenPos = screenFarPosition - dir * (dist); return new PositionInfo { screenPosition = position3D.IsOnScreen() ? Drawing.WorldToScreen(position3D) : finalScreenPos, direction = rayDirection, distance = distance, screenCollisionDistance = dist }; } //Console.WriteLine("no intersect"); return null; }
public static void DrawArrow(Vector3 starPosition, Vector3 endPosition, int angle, int linelength, int arrowsize, Color arrowColor) { var playerPositionExtend = starPosition.Extend(endPosition, linelength); var extendPlayerPos = Drawing.WorldToScreen(playerPositionExtend); var afterStartPosition = playerPositionExtend.Extend(starPosition, playerPositionExtend.Distance(starPosition) - 110); var starPos = Drawing.WorldToScreen(afterStartPosition); Drawing.DrawLine(starPos, extendPlayerPos, 1, arrowColor); var playerposextend = playerPositionExtend.Extend(starPosition, -130); var firstLineRotate = RotateByX(playerposextend.To2D(), starPosition.To2D(), angle); var secondLineRotate = RotateByX(playerposextend.To2D(), starPosition.To2D(), -angle); var extend1 = playerposextend.Extend(firstLineRotate.To3D(), arrowsize); var extend2 = playerposextend.Extend(secondLineRotate.To3D(), arrowsize); var extendpoint = Drawing.WorldToScreen(playerposextend); var firstLineRotatePos = Drawing.WorldToScreen(extend1); var secondLineRotatePos = Drawing.WorldToScreen(extend2); Drawing.DrawLine(extendpoint, firstLineRotatePos, 1, arrowColor); Drawing.DrawLine(extendpoint, secondLineRotatePos, 1, arrowColor); }
public static bool IsFountain(Vector3 position) { float fountainRange = 750; var map = LeagueSharp.Common.Utility.Map.GetMap(); if (map != null && map.Type == LeagueSharp.Common.Utility.Map.MapType.SummonersRift) { fountainRange = 1050; } return ObjectManager.Get<GameObject>().Where(spawnPoint => spawnPoint is Obj_SpawnPoint && spawnPoint.IsAlly).Any(spawnPoint => Vector2.Distance(position.To2D(), spawnPoint.Position.To2D()) < fountainRange); }
public static Geometry.Polygon getERectangle(Vector3 finalPosition, float BoundingRadius) { var halfERange = 150f; var eRectangle = new Geometry.Polygon( Geometry.Polygon.Rectangle( ObjectManager.Player.ServerPosition.To2D(), ObjectManager.Player.ServerPosition.To2D().Extend(finalPosition.To2D(), halfERange), BoundingRadius) ); return eRectangle; }
public static bool IsValidTargetEx( this AttackableUnit unit, float range, bool checkTeam = true, Vector3 from = default(Vector3)) { var ai = unit as Obj_AI_Base; if ((ai != null && ai.HasBuff("kindredrnodeathbuff") && ai.HealthPercent <= 10.0) || checkTeam && unit.Team == ObjectManager.Player.Team) { return false; } var targetPosition = ai != null ? ai.ServerPosition : unit.Position; var fromPosition = from.To2D().IsValid() ? from.To2D() : ObjectManager.Player.ServerPosition.To2D(); var distance2 = Vector2.DistanceSquared(fromPosition, targetPosition.To2D()); return distance2 <= range * range; }
public static bool IsPassWall(Vector3 start, Vector3 end) { double count = Vector3.Distance(start, end); for (uint i = 0; i <= count; i += 25) { Vector2 pos = start.To2D().Extend(Player.ServerPosition.To2D(), -i); if (IsWall(pos)) return true; } return false; }
public static Vector3[] GetPointsOnCirlce(Vector3 origin, float radius, float steps = 50) { var points = new List<Vector3>(); var origin2D = origin.To2D(); for (float a = 0; a < 360; a = a + steps) // For each angle via steps { var x = origin2D.X + (radius * Math.Cos(a.ToRadians())); var y = origin2D.Y + (radius * Math.Sin(a.ToRadians())); points.Add(new Vector3((float)x, (float)y, origin.Z)); } return points.ToArray(); }
public static bool CollisionYasuo(Vector3 from, Vector3 to) { if (Game.Time - yasuoWall.CastTime > 4) return false; var level = yasuoWall.WallLvl; var wallWidth = (350 + 50 * level); var wallDirection = (yasuoWall.CastPosition.To2D() - yasuoWall.YasuoPosition.To2D()).Normalized().Perpendicular(); var wallStart = yasuoWall.CastPosition.To2D() + wallWidth / 2f * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; if (wallStart.Intersection(wallEnd, to.To2D(), from.To2D()).Intersects) { return true; } return false; }
public static bool WillHitYasuoWall(Vector3 startPosition, Vector3 endPosition) { if (_containsYasuo) { if (_wallObject != null && _wallObject.IsValid && !_wallObject.IsDead) { var level = Convert.ToInt32(_wallObject.Name.Substring(_wallObject.Name.Length - 6, 1)); var width = 250f + level * 50f; var pos1 = _wallObject.Position.To2D() + (_wallObject.Position.To2D() - _startPosition.To2D()).Normalized().Perpendicular() * width / 2f; var pos2 = _wallObject.Position.To2D() + (_wallObject.Position.To2D() - _startPosition.To2D()).Normalized().Perpendicular2() * width / 2f; var intersection = pos1.Intersection(pos2, startPosition.To2D(), endPosition.To2D()); return intersection.Point.IsValid(); } } return false; }
public static Vector3 GetBestConeAndLinearCastPosition(this Spell.Skillshot cone, Spell.Skillshot linearSpell, List<Obj_AI_Base> enemies, Vector3 sourcePosition, out int bestHitNumber) { int radius = (int)cone.Range; enemies = enemies.Where(a => a.MeetsCriteria() && a.IsInRange(sourcePosition, radius)).ToList(); bestHitNumber = 0; Vector3 castPosition = Vector3.Zero; //if there is nothing that meets the criteria if (enemies.Count() == 0) return castPosition; List<Tuple<Geometry.Polygon.Sector, Vector3>> conePositions = new List<Tuple<Geometry.Polygon.Sector, Vector3>>(); Vector3 extendingPosition = sourcePosition + new Vector3(0, radius, 0); //checks every 15 degrees for(int i = 0; i < 24; i++) { Vector3 endPosition = extendingPosition.To2D().RotateAroundPoint(sourcePosition.To2D(), (float)((i * 15) * Math.PI / 180)).To3D((int)sourcePosition.Z); Geometry.Polygon.Sector sector = new Geometry.Polygon.Sector(sourcePosition, endPosition, (float)(cone.ConeAngleDegrees * Math.PI / 180), radius); conePositions.Add(Tuple.Create(sector, endPosition)); } //order list by most hit by Q1 and Q2 conePositions = conePositions.OrderByDescending(a => a.Item1.EnemiesHitInSectorAndRectangle(new Geometry.Polygon.Rectangle(sourcePosition, a.Item2, linearSpell.Width), enemies)).ToList(); //only leave the ones with the highest amount conePositions = conePositions.Where(a => a.Item1.EnemiesHitInSectorAndRectangle(new Geometry.Polygon.Rectangle(sourcePosition, a.Item2, linearSpell.Width), enemies) == conePositions[0].Item1.EnemiesHitInSectorAndRectangle(new Geometry.Polygon.Rectangle(sourcePosition, a.Item2, linearSpell.Width), enemies)).ToList(); //from the ones with the most Sector/Line enemies hit, find the one with the most in the rectangle conePositions = conePositions.OrderByDescending(a => new Geometry.Polygon.Rectangle(sourcePosition, a.Item2, linearSpell.Width).EnemiesHitInRectangle(enemies)).ToList(); //only take the ones with the most enemies conePositions = conePositions.Where(a => new Geometry.Polygon.Rectangle(sourcePosition, a.Item2, linearSpell.Width).EnemiesHitInRectangle(enemies) == new Geometry.Polygon.Rectangle(sourcePosition, conePositions[0].Item2, linearSpell.Width).EnemiesHitInRectangle(enemies)).ToList(); //from the ones with the most sector/line enemies hit AND the most line enemies hit, find the ones with the most sector area conePositions = conePositions.OrderByDescending(a => a.Item1.EnemiesHitInSector(enemies)).ToList(); Tuple<Geometry.Polygon.Sector, Vector3> bestCone = conePositions.First(); bestHitNumber = bestCone.Item1.EnemiesHitInSectorAndRectangle(new Geometry.Polygon.Rectangle(sourcePosition, bestCone.Item2, linearSpell.Width), enemies); return sourcePosition.Extend(bestCone.Item2, radius - 1).To3D((int)sourcePosition.Z); }
/// <summary> /// Collideses the with wall. /// </summary> /// <param name="start">The start.</param> /// <param name="end">The end.</param> /// <returns></returns> internal static bool CollidesWithWall(Vector3 start, Vector3 end) { if (Utils.TickCount - _wallCastT > 4000) { return false; } GameObject wall = null; foreach (var gameObject in ObjectManager.Get<GameObject>() .Where( gameObject => gameObject.IsValid && Regex.IsMatch( gameObject.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase)) ) { wall = gameObject; } if (wall == null) { return false; } var level = wall.Name.Substring(wall.Name.Length - 6, 1); var wallWidth = (300 + 50 * Convert.ToInt32(level)); var wallDirection = (wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; for (int i = 0; i < start.Distance(end); i += 30) { var currentPosition = start.Extend(end, i); if (wallStart.Intersection(wallEnd, currentPosition.To2D(), start.To2D()).Intersects) { return true; } } return false; }
// Counts the number of units in path from the start position to the end position internal static int CountInPath( Vector3 startpos, Vector3 endpos, float width, float range, out List<Obj_AI_Base> units, bool minion = false) { var end = endpos.To2D(); var start = startpos.To2D(); var direction = (end - start).Normalized(); var endposition = start + direction * start.Distance(endpos); var objinpath = from unit in ObjectManager.Get<Obj_AI_Base>().Where(b => b.Team != Player.Team) where Player.ServerPosition.Distance(unit.ServerPosition) <= range where unit is Obj_AI_Hero || unit is Obj_AI_Minion && minion let proj = unit.ServerPosition.To2D().ProjectOn(start, endposition) let projdist = unit.Distance(proj.SegmentPoint) where unit.BoundingRadius + width > projdist select unit; units = objinpath.ToList(); return units.Count(); }
private static Obj_AI_Hero CondemnCheck(Vector3 fromPosition) { var HeroList = HeroManager.Enemies.Where( h => h.IsValidTarget(Condemn.Range) && !h.HasBuffOfType(BuffType.SpellShield) && !h.HasBuffOfType(BuffType.SpellImmunity)); foreach (var Hero in HeroList) { var ePred = Condemn.GetPrediction(Hero); int pushDist = AssemblyMenu.Item("dz191.exocondemn.pushdistance").GetValue<Slider>().Value; for (int i = 0; i < pushDist; i += (int)Hero.BoundingRadius) { Vector3 loc3 = ePred.UnitPosition.To2D().Extend(fromPosition.To2D(), -i).To3D(); if (loc3.IsWall()) { return Hero; } } } return null; }
public static AIHeroClient CondemnCheck(Vector3 fromPosition) { var HeroList = EntityManager.Heroes.Enemies.Where( h => h.IsValidTarget(Program.E.Range) && !h.HasBuffOfType(BuffType.SpellShield) && !h.HasBuffOfType(BuffType.SpellImmunity)); foreach (var Hero in HeroList) { var ePred = Program.E2.GetPrediction(Hero); int pushDist = MenuManager.CondemnMenu["pushDistance"].Cast<Slider>().CurrentValue; for (int i = 0; i < pushDist; i += (int)Hero.BoundingRadius) { Vector3 loc3 = ePred.UnitPosition.To2D().Extend(fromPosition.To2D(), -i).To3D(); var collFlags = NavMesh.GetCollisionFlags(loc3); if (collFlags.HasFlag(CollisionFlags.Wall) || collFlags.HasFlag(CollisionFlags.Building)) { return Hero; } } } return null; }
public static Vector3 bestVectorToPoppyFlash(Obj_AI_Base target) { if (target == null) { return new Vector3(); } Vector3 newPos = new Vector3(); for (int i = 1; i < 7; i++) { for (int j = 1; j < 6; j++) { newPos = new Vector3(target.Position.X + 65 * j, target.Position.Y + 65 * j, target.Position.Z); var rotated = newPos.To2D().RotateAroundPoint(target.Position.To2D(), 45 * i).To3D(); if (rotated.IsValid() && Environment.Map.CheckWalls(rotated, target.Position) && player.Distance(rotated) < 400) { return rotated; } } } return new Vector3(); }
//if onSpellCast was used then the spells end position is the direction the caster is facing extended to max range. IE: xerath q, velkoz r public static void DrawLinearSkillshot(Vector3 startPosition, Vector3 endPosition, float width, float missileSpeed, float range, float collisionCount) { if (collisionCount != 0 && collisionCount != int.MaxValue) { List<Obj_AI_Base> enemiesThatWillBeHit = new List<Obj_AI_Base>(); //get if unit(s) will be hit by spell if so get the info.CollisionCount's units position and set it as the end position foreach(Obj_AI_Base enemy in EntityManager.Enemies.Where(a=>!a.IsDead &&a.Distance(startPosition) <= range)) if (Prediction.Position.Collision.LinearMissileCollision(enemy, startPosition.To2D(), endPosition.To2D(), missileSpeed, (int)width, 0)) enemiesThatWillBeHit.Add(enemy); enemiesThatWillBeHit.OrderByDescending(a => a.Distance(startPosition)); if(enemiesThatWillBeHit.Count() >= collisionCount) endPosition = enemiesThatWillBeHit[(int)collisionCount - 1].Position; } Vector3 northernMostPoint = (startPosition.Y >= endPosition.Y) ? startPosition : endPosition; Vector3 southernMostPoint = (startPosition.Y >= endPosition.Y) ? endPosition : startPosition; Vector3 betweenVector = new Vector3(northernMostPoint.X - southernMostPoint.X, northernMostPoint.Y - southernMostPoint.Y, 0f); Vector2 betweenVector2 = new Vector2(betweenVector.Y, -betweenVector.X); double Length = Math.Sqrt(betweenVector2.X * betweenVector2.X + betweenVector2.Y * betweenVector2.Y); //Thats length of perpendicular Vector2 NewVector = new Vector2((float)(betweenVector2.X / Length), (float)(betweenVector2.Y / Length)); //Now N is normalized perpendicular Vector3 NEPoint = new Vector3(southernMostPoint.X + NewVector.X * (width / 2), southernMostPoint.Y + NewVector.Y * (width / 2), startPosition.Z); Vector3 NWPoint = new Vector3(southernMostPoint.X - NewVector.X * (width / 2), southernMostPoint.Y - NewVector.Y * (width / 2), startPosition.Z); Vector3 SEPoint = new Vector3(northernMostPoint.X + NewVector.X * (width / 2), northernMostPoint.Y + NewVector.Y * (width / 2), startPosition.Z); Vector3 SWPoint = new Vector3(northernMostPoint.X - NewVector.X * (width / 2), northernMostPoint.Y - NewVector.Y * (width / 2), startPosition.Z); //top Drawing.DrawLine(NEPoint.WorldToScreen(), NWPoint.WorldToScreen(), 3, drawColor); //bottom Drawing.DrawLine(SEPoint.WorldToScreen(), SWPoint.WorldToScreen(), 3, drawColor); //right Drawing.DrawLine(NEPoint.WorldToScreen(), SEPoint.WorldToScreen(), 3, drawColor); //left Drawing.DrawLine(NWPoint.WorldToScreen(), SWPoint.WorldToScreen(), 3, drawColor); }
private static void MoveTo(Vector3 position) { var delay = _menu.Item("orb_Misc_Humanizer").GetValue<Slider>().Value; if (Utils.GameTimeTickCount - _humanizerTick < delay) return; _humanizerTick = Utils.GameTimeTickCount; var holdAreaRadius = _menu.Item("orb_Misc_Holdzone").GetValue<Slider>().Value; if (Player.ServerPosition.Distance(position) < holdAreaRadius) { if (Player.Path.Count() > 1) Player.IssueOrder(GameObjectOrder.HoldPosition, Player.Position); return; } var point = Player.ServerPosition + 300 * (position.To2D() - Player.ServerPosition.To2D()).Normalized().To3D(); Player.IssueOrder(GameObjectOrder.MoveTo, point); }
public static void JumpToVector(Vector3 position) { if (SpellManager.CanCastW1) { var ward = GetNearestTo(position); if (ward != null && position.To2D().Distance(ward.Position.To2D(), true) < Math.Pow(250f, 2)) { SpellManager.CastW1(ward); } } }
private void fleeqToInsec(Vector3 position) { if (Vector2.Distance(HeroManager.Player.ServerPosition.To2D(), position.To2D()) < azir.Spells.Q.Range) { azir.Spells.Q.Cast(position); } else { azir.Spells.Q.Cast(HeroManager.Player.Position.Extend(position, 1150)); } }
internal static double GetAngle(Vector3 from, Obj_AI_Base target) { var C = target.ServerPosition.To2D(); var A = target.GetWaypoints().Last(); if (C == A) return 60; var B = from.To2D(); var AB = Math.Pow((double)A.X - (double)B.X, 2) + Math.Pow((double)A.Y - (double)B.Y, 2); var BC = Math.Pow((double)B.X - (double)C.X, 2) + Math.Pow((double)B.Y - (double)C.Y, 2); var AC = Math.Pow((double)A.X - (double)C.X, 2) + Math.Pow((double)A.Y - (double)C.Y, 2); return Math.Cos((AB + BC - AC) / (2 * Math.Sqrt(AB) * Math.Sqrt(BC))) * 180 / Math.PI; }