public static bool MinionCollideLine(Vector3 lineStart, Vector3 lineFinish, Spell spell) { var minion = MinionManager.GetMinions(spell.Range, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.Health); // Render.Circle.DrawCircle(ObjectManager.Player.Position, 100, System.Drawing.Color.Brown, 2); // Render.Circle.DrawCircle(line_finish, 10, System.Drawing.Color.Red, 2); var d = lineStart.Distance(lineFinish); // dis = (int)(dis /spell.Width); var circles = new List<Circle>(); for (var i = 0; i < d; i += 10) { var dist = i > d ? d : i; var point = lineStart.Extend(lineFinish, +dist); circles.Add(new Circle(point, spell.Width)); } foreach (var c in circles) { foreach (var m in minion) { if (Geometry.CircleCircleIntersection(c.pos.To2D(), m.Position.To2D(), c.range, 100).Count()!=0) { return true; } } } // foreach(Obj_AI_Base m in minion) // { // m. // } // Geometry.cu return false; }
public static void Move_Draw(Vector3 Spell_Start, Vector3 Spell_End, double Spell_Time, int Distance, int Type) { if (Spell_Start.Distance(Spell_End) > Distance){var dis = Spell_Start.Distance(Spell_End) - Distance;Spell_End = Spell_End.Extend(Spell_Start, +dis);} Render.Circle.DrawCircle(Spell_Start, 50, System.Drawing.Color.PaleVioletRed, 1); Render.Circle.DrawCircle(Spell_End, 50, System.Drawing.Color.LawnGreen, 1); var from = Drawing.WorldToScreen(Spell_Start);var to = Drawing.WorldToScreen(Spell_End); Drawing.DrawLine(from[0], from[1], to[0], to[1], 1, System.Drawing.Color.LawnGreen); Drawing.DrawText(from[0], from[1], System.Drawing.Color.PaleVioletRed, "Start"); Drawing.DrawText(to[0], to[1], System.Drawing.Color.PaleVioletRed, "End"); }
public Vector3 GetFirstWallPoint(Vector3 start, Vector3 end, float range) { if (end.IsValid() && start.Distance(end) <= range) { var newPoint = start.Extend(end, range); return NavMesh.GetCollisionFlags(newPoint) == CollisionFlags.Wall || newPoint.IsWall() ? newPoint : Vector3.Zero; } return Vector3.Zero; }
//my condemn logic so far public static Obj_AI_Base GetTarget(Vector3 fromPosition) { var targetList = EntityManager.Heroes.Enemies.Where( h => h.IsValidTarget(Manager.SpellManager.E.Range) && !h.HasBuffOfType(BuffType.SpellShield) && !h.HasBuffOfType(BuffType.SpellImmunity) && h.Health > ObjectManager.Player.GetAutoAttackDamage(h, true) * 2).ToList(); if (!targetList.Any()) { return null; } foreach (var enemy in targetList) { var prediction = Manager.SpellManager.E2.GetPrediction(enemy); var predictionsList = new List<Vector3> { enemy.ServerPosition, enemy.Position, prediction.CastPosition, prediction.UnitPosition }; var wallsFound = 0; foreach (var position in predictionsList) { var distance = fromPosition.Distance(position); for (var i = 0; i < Manager.MenuManager.CondemnPushDistance; i += (int)enemy.BoundingRadius) { var finalPosition = fromPosition.Extend(position, distance + i).To3D(); var j4Flag = Manager.MenuManager.J4Flag && (Variables.IsJ4Flag(finalPosition, enemy)); if (NavMesh.GetCollisionFlags(finalPosition).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(finalPosition).HasFlag(CollisionFlags.Building) || j4Flag) { wallsFound++; break; } } } if (wallsFound >= Manager.MenuManager.CondemnHitchance) { return enemy; } } return null; }
public static bool IsOverWall(Vector3 start, Vector3 end) { double distance = Vector3.Distance(start, end); for (uint i = 0; i < distance; i += 10) { var tempPosition = start.Extend(end, i).ToVector2(); if (tempPosition.IsWall()) { return true; } } return false; }
public static Vector3 GetFirstWallPoint(Vector3 start, Vector3 end) { double distance = Vector3.Distance(start, end); for (uint i = 0; i < distance; i += 10) { var tempPosition = start.Extend(end, i); if (tempPosition.IsWall()) { return tempPosition.Extend(start, -35); } } return Vector3.Zero; }
public static bool IsOverWall(Vector3 start, Vector3 end) { double distance = Vector3.Distance(start, end); for (uint i = 0; i < distance; i += 10) { var tempPosition = start.Extend(end, i).To2D(); if (tempPosition.IsWall() || (!NavMesh.IsWallOfGrass(start, 65) && NavMesh.IsWallOfGrass(tempPosition.To3D(), 65))) { return true; } } return false; }
internal static bool DoPositionsCrossWall(Vector3 start, Vector3 end) { double distance = Vector3.Distance(start, end); for (uint i = 0; i < distance; i += 10) { var tempPosition = start.Extend(end, i).To2D(); if (tempPosition.IsWall()) { return true; } } return false; }
public static bool IsOverWall(Vector3 start, Vector3 end) { double distance = Vector3.Distance(start, end); for (uint i = 0; i < distance; i += 10) { var tempPosition = start.Extend(end, i).To3D(); var collFlags = NavMesh.GetCollisionFlags(tempPosition); if (collFlags.HasFlag(CollisionFlags.Wall) || collFlags.HasFlag(CollisionFlags.Building)) { return true; } } return false; }
private void CastW(Obj_AI_Hero target, Vector3 from, Vector3 to) { var positions = new List<Vector3>(); for (int i = 1; i < 11; i++) { positions.Add(from.Extend(to, 42 * i)); } var best = positions.OrderByDescending(p => p.Distance(target.Position)) .FirstOrDefault( p => !p.IsWall() && p.Distance(player.Position) < W.Range && p.Distance(target.Position) > 350); if (best != null && best.IsValid()) { W.Cast(best, config.Item("packets").GetValue<bool>()); } }
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 Point[] GetNeededPoinits( Vector3 startPosition, Vector3 endPosition, float startWidth, float endWidth = 0) { if (endWidth <= 0) { endWidth = startWidth; } endPosition = startPosition.Extend(endPosition, startPosition.Distance2D(endPosition) + endWidth / 2); var difference = startPosition - endPosition; var rotation = difference.Rotated(MathUtil.DegreesToRadians(90)); rotation.Normalize(); var start = rotation * startWidth; var end = rotation * endWidth; var rightStartPosition = startPosition + start; var leftStartPosition = startPosition - start; var rightEndPosition = endPosition + end; var leftEndPosition = endPosition - end; /*Vector2 leftStart, rightStart, leftEnd, rightEnd; Drawing.WorldToScreen(leftStartPosition, out leftStart); Drawing.WorldToScreen(rightStartPosition, out rightStart); Drawing.WorldToScreen(leftEndPosition, out leftEnd); Drawing.WorldToScreen(rightEndPosition, out rightEnd); Drawing.DrawLine(leftStart, rightStart, Color.Orange); Drawing.DrawLine(rightStart, rightEnd, Color.Orange); Drawing.DrawLine(rightEnd, leftEnd, Color.Orange); Drawing.DrawLine(leftEnd, leftStart, Color.Orange);*/ var p1 = new Point((int) rightStartPosition.X, (int) rightStartPosition.Y); var p2 = new Point((int) leftStartPosition.X, (int) leftStartPosition.Y); var p3 = new Point((int) rightEndPosition.X, (int) rightEndPosition.Y); var p4 = new Point((int) leftEndPosition.X, (int) leftEndPosition.Y); return new[] {p1, p2, p4, p3}; }
/// <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; }
internal static float GetWallLength(Vector3 start, Vector3 end) { double distance = Vector3.Distance(start, end); var firstPosition = Vector3.Zero; var lastPosition = Vector3.Zero; for (uint i = 0; i < distance; i += 10) { var tempPosition = start.Extend(end, i); if (tempPosition.IsWall() && firstPosition == Vector3.Zero) { firstPosition = tempPosition; } lastPosition = tempPosition; if (!lastPosition.IsWall() && firstPosition != Vector3.Zero) { break; } } return Vector3.Distance(firstPosition, lastPosition); }
public static bool IsWallBetween(Vector3 start, Vector3 end, int step = 3) { if (start.IsValid() && end.IsValid() && step > 0) { var distance = start.Distance(end); for (var i = 0; i < distance; i = i + step) { if (NavMesh.GetCollisionFlags(start.Extend(end, i)) == CollisionFlags.Wall) { return true; } } } return false; }
public static bool CheckWalls(Vector3 from, Vector3 to) { var steps = 6f; var stepLength = from.Distance(to)/steps; for (var i = 1; i < steps + 1; i++) { if (from.Extend(to, stepLength*i).IsWall()) { return true; } } return false; }
public static Geometry.Polygon GetPolyFromVector(Vector3 from, Vector3 to, float width) { var POS = to.Extend(from, from.Distance(to)); var direction = (POS - to.To2D()).Normalized(); var pos1 = (to.To2D() - direction.Perpendicular()*width/2f).To3D(); var pos2 = (POS + (POS - to.To2D()).Normalized() + direction.Perpendicular()*width/2f).To3D(); var pos3 = (to.To2D() + direction.Perpendicular()*width/2f).To3D(); var pos4 = (POS + (POS - to.To2D()).Normalized() - direction.Perpendicular()*width/2f).To3D(); var poly = new Geometry.Polygon(); poly.Add(pos1); poly.Add(pos3); poly.Add(pos2); poly.Add(pos4); return poly; }
private static void DrawHinh1(Vector3 center, float radius, Color color, int width = 5) { Render.Circle.DrawCircle(center, radius, color, width, false); return; var pos1y = center; pos1y.X = pos1y.X + radius; var pos1 = pos1y.To2D().RotateAround(center.To2D(), drawstate.AngleToRadian()); var pos1a = center.Extend(pos1.To3D(), radius * 5 / 8).To2D().RotateAround(center.To2D(), (18).AngleToRadian()); var pos2 = pos1.RotateAround(center.To2D(), (36).AngleToRadian()); var pos3 = pos1.RotateAround(center.To2D(), (72).AngleToRadian()); var pos4 = pos1.RotateAround(center.To2D(), (108).AngleToRadian()); var pos5 = pos1.RotateAround(center.To2D(), (144).AngleToRadian()); var pos6 = pos1.RotateAround(center.To2D(), (180).AngleToRadian()); var pos7 = pos1.RotateAround(center.To2D(), (216).AngleToRadian()); var pos8 = pos1.RotateAround(center.To2D(), (252).AngleToRadian()); var pos9 = pos1.RotateAround(center.To2D(), (288).AngleToRadian()); var pos10 = pos1.RotateAround(center.To2D(), (324).AngleToRadian()); var pos2a = pos1a.RotateAround(center.To2D(), (36).AngleToRadian()); var pos3a = pos1a.RotateAround(center.To2D(), (72).AngleToRadian()); var pos4a = pos1a.RotateAround(center.To2D(), (108).AngleToRadian()); var pos5a = pos1a.RotateAround(center.To2D(), (144).AngleToRadian()); var pos6a = pos1a.RotateAround(center.To2D(), (180).AngleToRadian()); var pos7a = pos1a.RotateAround(center.To2D(), (216).AngleToRadian()); var pos8a = pos1a.RotateAround(center.To2D(), (252).AngleToRadian()); var pos9a = pos1a.RotateAround(center.To2D(), (288).AngleToRadian()); var pos10a = pos1a.RotateAround(center.To2D(), (324).AngleToRadian()); Drawing.DrawLine(Drawing.WorldToScreen(pos1.To3D()), Drawing.WorldToScreen(pos1a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos2.To3D()), Drawing.WorldToScreen(pos1a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos2.To3D()), Drawing.WorldToScreen(pos2a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos3.To3D()), Drawing.WorldToScreen(pos2a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos3.To3D()), Drawing.WorldToScreen(pos3a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos4.To3D()), Drawing.WorldToScreen(pos3a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos4.To3D()), Drawing.WorldToScreen(pos4a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos5.To3D()), Drawing.WorldToScreen(pos4a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos5.To3D()), Drawing.WorldToScreen(pos5a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos6.To3D()), Drawing.WorldToScreen(pos5a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos6.To3D()), Drawing.WorldToScreen(pos6a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos7.To3D()), Drawing.WorldToScreen(pos6a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos7.To3D()), Drawing.WorldToScreen(pos7a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos8.To3D()), Drawing.WorldToScreen(pos7a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos8.To3D()), Drawing.WorldToScreen(pos8a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos9.To3D()), Drawing.WorldToScreen(pos8a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos9.To3D()), Drawing.WorldToScreen(pos9a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos10.To3D()), Drawing.WorldToScreen(pos9a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos10.To3D()), Drawing.WorldToScreen(pos10a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos1.To3D()), Drawing.WorldToScreen(pos10a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos1.To3D()), Drawing.WorldToScreen(pos2.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos3.To3D()), Drawing.WorldToScreen(pos2.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos3.To3D()), Drawing.WorldToScreen(pos4.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos5.To3D()), Drawing.WorldToScreen(pos4.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos5.To3D()), Drawing.WorldToScreen(pos6.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos7.To3D()), Drawing.WorldToScreen(pos6.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos7.To3D()), Drawing.WorldToScreen(pos8.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos9.To3D()), Drawing.WorldToScreen(pos8.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos9.To3D()), Drawing.WorldToScreen(pos10.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos1.To3D()), Drawing.WorldToScreen(pos10.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos1a.To3D()), Drawing.WorldToScreen(pos2a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos3a.To3D()), Drawing.WorldToScreen(pos2a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos3a.To3D()), Drawing.WorldToScreen(pos4a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos5a.To3D()), Drawing.WorldToScreen(pos4a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos5a.To3D()), Drawing.WorldToScreen(pos6a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos7a.To3D()), Drawing.WorldToScreen(pos6a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos7a.To3D()), Drawing.WorldToScreen(pos8a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos9a.To3D()), Drawing.WorldToScreen(pos8a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos9a.To3D()), Drawing.WorldToScreen(pos10a.To3D()), width, color); Drawing.DrawLine(Drawing.WorldToScreen(pos1a.To3D()), Drawing.WorldToScreen(pos10a.To3D()), width, color); DrawCircle(center, radius * 2 / 8, color, width, 10); if (Utils.GameTimeTickCount >= drawtick + 10) { drawtick = Utils.GameTimeTickCount; drawstate += 2; } }
private static void GapByWardJump(Obj_AI_Hero target, Vector3 posGap) { if (Variables.Orbwalker.CanMove()) { lastMoveTime = Variables.TickCount; Variables.Orbwalker.Move( posGap.Extend(GetPositionKickTo(target), -(GetDistBehind(target) + Player.BoundingRadius / 2))); } lastEndPos = GetPositionAfterKick(target); lastInsecTime = Variables.TickCount; lastJumpTime = Variables.TickCount; Variables.TargetSelector.SetTarget(target); WardManager.Place(posGap, true); }
private static void DrawLineIfWallBetween(Vector3 startPos, Obj_AI_Base target) { Vector3 endPos = YasuoCalcs.GetDashingEnd(target); List<Vector3> inbetweenPoints = new List<Vector3>(); Vector2 wallStartPosition = Vector2.Zero; Vector2 wallEndPosition = Vector2.Zero; //get every point between yasuo's position and the end position of the dash extended to a range of 1000. //1 point is every 1/100 of total length for (int i = 0; i <= 100; i++) inbetweenPoints.Add(startPos.Extend(startPos.Extend(endPos, 1000), i* (startPos.Distance(startPos.Extend(endPos, 1000)) / 100)).To3D()); //for every point in the list of points, find the beginning and the end of the wal foreach (Vector2 vec in inbetweenPoints) { if (vec.IsWall()) { if (wallStartPosition == Vector2.Zero) wallStartPosition = vec; } else if (wallEndPosition == Vector2.Zero && wallStartPosition != Vector2.Zero) wallEndPosition = vec; } //draw the wall in the color blue if (wallStartPosition != Vector2.Zero && wallEndPosition != Vector2.Zero) { double wallWidth = Math.Round(wallStartPosition.Distance(wallEndPosition)), distanceToWall = Math.Round(startPos.Distance(wallStartPosition)), totalDistance = Math.Round(wallStartPosition.Distance(wallEndPosition) + startPos.Distance(wallStartPosition)), monsterDist = Math.Round(target.Position.Distance(wallStartPosition)); Drawing.DrawLine(wallStartPosition.To3D().WorldToScreen(), wallEndPosition.To3D().WorldToScreen(), 10, System.Drawing.Color.Black); //if the end point of yasuos dash brings him at least halfway between the two points (closer to the wall end than to the walls beginning) //and the wall has to be thinner than yasuo's total dash range. TESTED THIS TO CONFIRM IT WORKS //if (endPos.Distance(wallEndPosition) < endPos.Distance(wallStartPosition) && wallStartPosition.Distance(wallEndPosition) <= Program.E.Range) if (totalDistance <= 630) Drawing.DrawLine(startPos.WorldToScreen(), startPos.Extend(endPos, 1000).To3D().WorldToScreen(), 3, System.Drawing.Color.Green); else Drawing.DrawLine(startPos.WorldToScreen(), startPos.Extend(endPos, 1000).To3D().WorldToScreen(), 3, System.Drawing.Color.Red); Drawing.DrawText(wallStartPosition.To3D().WorldToScreen(), System.Drawing.Color.Purple, wallStartPosition.Distance(wallEndPosition).ToString(), 15); Drawing.DrawText(startPos.Extend(endPos, 1000).To3D().WorldToScreen(), System.Drawing.Color.Purple, (wallStartPosition.Distance(wallEndPosition) + startPos.Distance(wallStartPosition)).ToString(), 15); Drawing.DrawCircle(endPos, 50, System.Drawing.Color.White); } }
public static Vector3 GetBestDaggerPoint(Vector3 position, Obj_AI_Base target) { if (target.Position.IsInRange(position, 150)) return position; return position.Extend(target, 150).To3D(); }
/// <summary> /// Gets a specified amount of Rotated Positions. Useful for getting safe dash positions. /// </summary> /// <param name="rotateAround">The source position</param> /// <param name="rotateTowards">The target position</param> /// <param name="degrees">It will get rotated positions from -degrees to +degrees</param> /// <param name="positionAmount">The amount of positions to get. Can be left blank</param> /// <param name="distance">Can be left blan</param> /// <returns></returns> public static List<Vector3> RotatedPositions(Vector3 rotateAround, Vector3 rotateTowards, int degrees, int positionAmount = 0, float distance = 0) { if (distance == 0) distance = rotateAround.Distance(rotateTowards); if (positionAmount == 0) positionAmount = degrees / 10; var realRotateTowards = rotateAround.Extend(rotateTowards, distance); var posList = new List<Vector3>(); var step = (degrees * 2) / positionAmount; for (var i = -degrees; i <= degrees; i += step) { var rotatedPosition = Deviation(rotateAround.To2D(), realRotateTowards, i); posList.Add(rotatedPosition.To3D()); } return posList; }
public static bool CheckWalls(Vector3 player, Vector3 enemy) { var distance = player.Distance(enemy); for (var i = 1; i < 6; i++) { if (player.Extend(enemy, distance + 55*i).IsWall()) { return true; } } return false; }
private static IEnumerable<Vector3> GetPossibleJumpPositions(Vector3 pos) { var pointList = new List<Vector3>(); for (var j = 680; j >= 50; j -= 50) { var offset = (int)(2 * Math.PI * j / 50); for (var i = 0; i <= offset; i++) { var angle = i * Math.PI * 2 / offset; var point = new Vector3((float)(pos.X + j * Math.Cos(angle)), (float)(pos.Y - j * Math.Sin(angle)), pos.Z); if (!NavMesh.GetCollisionFlags(point).HasFlag(CollisionFlags.Wall)&&point.Distance(ObjectManager.Player.Position)<pos.Distance(ObjectManager.Player.Position)-400&& point.Distance(pos.Extend(ObjectManager.Player.Position, 600)) <= 250) pointList.Add(point); } } return pointList; }
private static void wjumpflee() { if (WStage != WCastStage.First) _player.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos); else { if (_config.Item("wjmax").GetValue<bool>()) { _player.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos); WardJump(Game.CursorPos, true, true, true); } else if (_player.Distance(Game.CursorPos) >= 700 || walljump == true) { if (Game.CursorPos.Distance(wallcheck) > 50) { walljump = false; checker=false; for (var i = 0; i < 40; i++) { var p = Game.CursorPos.Extend(_player.Position, 10 * i); if (NavMesh.GetCollisionFlags(p).HasFlag(CollisionFlags.Wall)) { jumppoint = p; wallcheck = Game.CursorPos; walljump = true; break; } } if (walljump == true) { foreach ( var qPosition in GetPossibleJumpPositions(jumppoint) .OrderBy(qPosition => qPosition.Distance(jumppoint))) { if (_player.Position.Distance(qPosition) < _player.Position.Distance(jumppoint)) { movepoint = qPosition; if (movepoint.Distance(jumppoint) > 600) wpos = movepoint.Extend(jumppoint, 595); else wpos = jumppoint; break; } if (qPosition == null) movepoint = jumppoint; checker = true; break; } } } var jumpObj = ObjectManager.Get<Obj_AI_Base>() .OrderBy(obj => obj.Distance(_player.ServerPosition)) .FirstOrDefault(obj => obj.IsAlly && !obj.IsMe && obj.Distance(movepoint) <= 700 && (!(obj.Name.IndexOf("turret", StringComparison.InvariantCultureIgnoreCase) >= 0) && obj.Distance(jumppoint) <= 200)); if (walljump == false || movepoint.Distance(Game.CursorPos) > _player.Distance(Game.CursorPos) + 150) { movepoint = Game.CursorPos; jumppoint = Game.CursorPos; } if (jumpObj == null && Items.GetWardSlot() != null && Items.GetWardSlot().Stacks != 0) placeward(wpos); if (_player.Position.Distance(jumppoint) <= 700 && jumpObj != null) { CastW(jumpObj); walljump = false; } _player.IssueOrder(GameObjectOrder.MoveTo, movepoint); } else WardJump(jumppoint, true, true, false); } }
private static void Flee() { var pos = Game.CursorPos; return; if (pos.IsWall()) { return; } if (pos.Distance(ObjectManager.Player.Position) < ObjectManager.Player.BoundingRadius) { return; } WardJump(Game.CursorPos); return; if (ObjectManager.Player.Distance(Game.CursorPos) >= 700 || walljump) { if (Game.CursorPos.Distance(wallcheck) > 50) { walljump = false; checker = false; for (var i = 0; i < 40; i++) { var p = Game.CursorPos.Extend(ObjectManager.Player.Position, 10*i); if (NavMesh.GetCollisionFlags(p).HasFlag(CollisionFlags.Wall)) { jumppoint = p; wallcheck = Game.CursorPos; walljump = true; break; } } if (walljump) { foreach ( var qPosition in GetPossibleJumpPositions(jumppoint) .OrderBy(qPosition => qPosition.Distance(jumppoint))) { if (ObjectManager.Player.Position.Distance(qPosition) < ObjectManager.Player.Position.Distance(jumppoint)) { movepoint = qPosition; wpos = movepoint.Distance(jumppoint) > 600 ? movepoint.Extend(jumppoint, 595) : jumppoint; break; } checker = true; break; } } } var jumpObj = ObjectManager.Get<Obj_AI_Base>() .OrderBy(obj => obj.Distance(ObjectManager.Player.ServerPosition)) .FirstOrDefault(obj => obj.IsAlly && !obj.IsMe && obj.Distance(movepoint) <= 700 && (!(obj.Name.IndexOf("turret", StringComparison.InvariantCultureIgnoreCase) >= 0) && obj.Distance(jumppoint) <= 200)); if (walljump == false || movepoint.Distance(Game.CursorPos) > ObjectManager.Player.Distance(Game.CursorPos) + 150) { movepoint = Game.CursorPos; jumppoint = Game.CursorPos; } if (jumpObj == null && Items.GetWardSlot() != null && Items.GetWardSlot().Stacks != 0) { PutWard(wpos); } if (ObjectManager.Player.Position.Distance(jumppoint) <= 700 && jumpObj != null) { CastW(jumpObj); walljump = false; } ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, movepoint); } else WardJump(jumppoint); }
private static Vector3 ExtendWallpos(Obj_AI_Base ts, Vector3 point) { if (ts == null) throw new ArgumentNullException("ts"); return point.Extend(ts.Position, point.Distance(ts.Position) + 25); }
/// <summary> /// Simplfying Extend for me /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <param name="x"></param> /// <returns></returns> public static Vector3 Extend(Vector3 from, Vector3 to, float x) { return from.Extend(to, x); }
public void SetUnavailableTrees(Vector3 start, Vector3 end, Chakram chakram) { var precision = chakram.Radius; var count = (int)Math.Ceiling(start.Distance2D(end) / precision); var ping = Game.Ping / 1000; var time = Game.RawGameTime; for (var i = 1; i <= count; i++) { var position = i == count ? end : start.Extend(end, precision * i); unavailableTrees.Add( Tuple.Create( position, chakram.Radius, chakram.CastPoint + ping + start.Distance2D(position) / chakram.Speed + time)); } }
private static void GapByWardJump(Obj_AI_Hero target, Vector3 posGap) { if (Variables.Orbwalker.CanMove()) { lastGapClose = Variables.TickCount; Variables.Orbwalker.Move( posGap.Extend(ExpectedEndPosition(target), -(DistBehind(target) + Player.BoundingRadius / 2))); } posSetting = EndPosition(target); lastSettingPos = Variables.TickCount; lastJump = Variables.TickCount; Variables.TargetSelector.SetTarget(target); var objJump = GameObjects.AllyHeroes.Where(i => !i.IsMe) .Cast<Obj_AI_Base>() .Concat( GameObjects.AllyMinions.Where( i => i.IsMinion() || i.IsPet() || SpecialPet.Contains(i.CharData.BaseSkinName.ToLower())) .Concat(GameObjects.AllyWards.Where(i => i.IsWard()))) .Where(i => i.IsValidTarget(W.Range, false) && i.Distance(posGap) <= target.BoundingRadius) .MinOrDefault(i => i.Distance(posGap)); if (objJump != null && objJump.Distance(target) < objJump.Distance(ExpectedEndPosition(target))) { W.CastOnUnit(objJump); } else { WardManager.Place(posGap, true); } }