public static void JunglerTimer() { if (AIOmode != 1 && Config.Item("timer").GetValue <bool>() && jungler != null && jungler.IsValid) { if (jungler.IsDead) { timer = (int)(enemySpawn.Position.Distance(Player.Position) / 370); } else if (jungler.IsVisible) { float Way = 0; var JunglerPath = Player.GetPath(Player.Position, jungler.Position); var PointStart = Player.Position; if (JunglerPath == null) { return; } foreach (var point in JunglerPath) { var PSDistance = PointStart.Distance(point); if (PSDistance > 0) { Way += PSDistance; PointStart = point; } } timer = (int)(Way / jungler.MoveSpeed); } } }
public static void WardJump(Vector3 pos, bool useWard = true, bool checkObjects = true, bool fullRange = false) { if (WStage != WCastStage.First) { return; } pos = fullRange ? _player.ServerPosition.To2D().Extend(pos.To2D(), 600).To3D() : pos; WardCastPosition = NavMesh.GetCollisionFlags(pos).HasFlag(CollisionFlags.Wall) ? _player.GetPath(pos).Last() : pos; var jumpObject = ObjectManager.Get <Obj_AI_Base>() .OrderBy(obj => obj.Distance(_player.ServerPosition)) .FirstOrDefault( obj => obj.IsAlly && !obj.IsMe && (!(obj.Name.IndexOf("turret", StringComparison.InvariantCultureIgnoreCase) >= 0) && Vector3.DistanceSquared(pos, obj.ServerPosition) <= 150 * 150)); if (jumpObject != null && checkObjects && WStage == WCastStage.First) { CastW(jumpObject); return; } if (!useWard) { return; } if (Items.GetWardSlot() == null || Items.GetWardSlot().Stacks == 0) { return; } placeward(WardCastPosition); }
public static void useESmart(Obj_AI_Base target) { if (!E.IsReady()) { return; } float trueAARange = Player.AttackRange + target.BoundingRadius; float trueERange = target.BoundingRadius + E.Range; float dist = Player.Distance(target); var path = Player.GetPath(target.Position); if (!target.IsMoving && dist < trueERange) { Player.IssueOrder(GameObjectOrder.MoveTo, target.Position); E.Cast(path.Count() > 1 ? path[1] : target.ServerPosition); } if ((dist > trueAARange && dist < trueERange) || rushDown) { E.Cast(path.Count() > 1 ? path[1] : target.ServerPosition); } }
public static float GetNeededMoveTimeHeavy(Obj_AI_Hero hero, Vector3 moveTo) { var path = hero.GetPath(moveTo); var time = (path[0] - hero.Position).Length() / hero.MoveSpeed; for (int i = 1; i < path.Length; i++) time += (path[i] - path[i - 1]).Length() / hero.MoveSpeed; return time; }
public static float GetNeededMoveTimeHeavy(Obj_AI_Hero hero, Vector3 moveTo) { var path = hero.GetPath(moveTo); var time = (path[0] - hero.Position).Length() / hero.MoveSpeed; for (int i = 1; i < path.Length; i++) { time += (path[i] - path[i - 1]).Length() / hero.MoveSpeed; } return(time); }
private void DrawWaypoint(Obj_AI_Hero hero, Vector3 endPos) { List <Vector3> waypoints = hero.GetPath(endPos).ToList(); for (int i = 0; i < waypoints.Count - 1; i++) { Vector2 oWp = Drawing.WorldToScreen(waypoints[i]); Vector2 nWp = Drawing.WorldToScreen(waypoints[i + 1]); Drawing.DrawLine(oWp[0], oWp[1], nWp[0], nWp[1], 1, System.Drawing.Color.GreenYellow); } }
public static float GetNeededMoveTimeWithoutMsHeavy(Obj_AI_Hero hero, Vector3 moveTo) { Console.WriteLine(hero.Name); var path = hero.GetPath(moveTo); var time = (path[0] - hero.Position).Length(); for (int i = 1; i < path.Length; i++) { time += (path[i] - path[i - 1]).Length(); } return(time); }
public static float GetPath(Obj_AI_Hero hero, Vector3 b) { var path = hero.GetPath(b); var lastPoint = path[0]; var distance = 0f; foreach (var point in path.Where(point => !point.Equals(lastPoint))) { distance += lastPoint.Distance(point); lastPoint = point; } return(distance); }
public static Vector3 GetPointAfterTimeFromPath(Obj_AI_Hero hero, Vector3 b, float timeInSec) { var path = hero.GetPath(b); var lastPoint = path[0]; var distance = 0f; var maxDist = hero.MoveSpeed * timeInSec; foreach (var point in path.Where(point => !point.Equals(lastPoint))) { if (distance > maxDist) { break; } distance += lastPoint.Distance(point); lastPoint = point; } return(lastPoint); }
public static float realDistanceTill(AttackableUnit unit) { float dist = 0; var dists = player.GetPath(unit.Position); if (dists.Count() == 0) { return(0); } Vector3 from = dists[0]; foreach (var to in dists) { dist += Vector3.Distance(from, to); from = to; } return(dist); }
public static void JunglerTimer() { if (Config.Item("timer").GetValue <bool>() && jungler != null && jungler.IsValid) { foreach (var enemy in Enemies.Where(enemy => enemy.IsValid)) { if (Config.Item("ro" + enemy.ChampionName) != null && Config.Item("ro" + enemy.ChampionName).GetValue <bool>()) { jungler = enemy; } } if (jungler.IsDead) { enemySpawn = ObjectManager.Get <Obj_SpawnPoint>().FirstOrDefault(x => x.IsEnemy); timer = (int)(enemySpawn.Position.Distance(ObjectManager.Player.Position) / 370); } else if (jungler.IsVisible && jungler.IsValid) { float Way = 0; var JunglerPath = Player.GetPath(Player.Position, jungler.Position); var PointStart = Player.Position; if (JunglerPath == null) { return; } foreach (var point in JunglerPath) { if (PointStart.Distance(point) > 0) { Way += PointStart.Distance(point); PointStart = point; } } timer = (int)(Way / jungler.MoveSpeed); } } }
public static float GetNeededMoveTimeWithoutMsHeavy(Obj_AI_Hero hero, Vector3 moveTo) { Console.WriteLine(hero.Name); var path = hero.GetPath(moveTo); var time = (path[0] - hero.Position).Length(); for (int i = 1; i < path.Length; i++) time += (path[i] - path[i - 1]).Length(); return time; }
public static void OnFlee() { bool useWalljump = Config.BoolLinks["fleeWalljump"].Value; bool useAA = Config.BoolLinks["fleeAA"].Value; // A jump has been triggered, move into the set direction and // return the function to stop further calculations in the flee code if (wallJumpTarget.HasValue) { // Move to the target player.IssueOrder(GameObjectOrder.MoveTo, wallJumpTarget.Value); // This is only to validate when the jump get aborted by, for example, stuns if (Environment.TickCount - wallJumpInitTime > 500) { wallJumpTarget = null; wallJumpInitTime = null; } else { return; } } // Quick AAing without jumping over walls if (useAA && !useWalljump) { var dashObjects = VectorHelper.GetDashObjects(); Orbwalking.Orbwalk(dashObjects.Count > 0 ? dashObjects[0] : null, Game.CursorPos); } // Wall jumping with possible AAing aswell if (useWalljump) { // We need to define a new move position since jumping over walls // requires you to be close to the specified wall. Therefore we set the move // point to be that specific piont. People will need to get used to it, // but this is how it works. var wallCheck = VectorHelper.GetFirstWallPoint(player.Position, Game.CursorPos); // Be more precise if (wallCheck != null) { wallCheck = VectorHelper.GetFirstWallPoint((Vector3)wallCheck, Game.CursorPos, 5); } // Define more position point Vector3 movePosition = wallCheck != null ? (Vector3)wallCheck : Game.CursorPos; // Update fleeTargetPosition var tempGrid = NavMesh.WorldToGrid(movePosition.X, movePosition.Y); fleeTargetPosition = NavMesh.GridToWorld((short)tempGrid.X, (short)tempGrid.Y); // Also check if we want to AA aswell Obj_AI_Base target = null; if (useAA) { var dashObjects = VectorHelper.GetDashObjects(); if (dashObjects.Count > 0) { target = dashObjects[0]; } } // Reset walljump indicators wallJumpPossible = false; // Only calculate stuff when our Q is up and there is a wall inbetween if (Q.IsReady() && wallCheck != null) { // Get our wall position to calculate from Vector3 wallPosition = movePosition; // Check 300 units to the cursor position in a 160 degree cone for a valid non-wall spot Vector2 direction = (Game.CursorPos.To2D() - wallPosition.To2D()).Normalized(); float maxAngle = 80; float step = maxAngle / 20; float currentAngle = 0; float currentStep = 0; bool jumpTriggered = false; while (true) { // Validate the counter, break if no valid spot was found in previous loops if (currentStep > maxAngle && currentAngle < 0) { break; } // Check next angle if ((currentAngle == 0 || currentAngle < 0) && currentStep != 0) { currentAngle = (currentStep) * (float)Math.PI / 180; currentStep += step; } else if (currentAngle > 0) { currentAngle = -currentAngle; } Vector3 checkPoint; // One time only check for direct line of sight without rotating if (currentStep == 0) { currentStep = step; checkPoint = wallPosition + 300 * direction.To3D(); } // Rotated check else { checkPoint = wallPosition + 300 * direction.Rotated(currentAngle).To3D(); } // Check if the point is not a wall if (!checkPoint.IsWall()) { // Check if there is a wall between the checkPoint and wallPosition wallCheck = VectorHelper.GetFirstWallPoint(checkPoint, wallPosition); if (wallCheck != null) { // There is a wall inbetween, get the closes point to the wall, as precise as possible Vector3 wallPositionOpposite = (Vector3)VectorHelper.GetFirstWallPoint((Vector3)wallCheck, wallPosition, 5); // Check if it's worth to jump considering the path length if (player.GetPath(wallPositionOpposite).ToList().To2D().PathLength() - player.Distance(wallPositionOpposite) > 200) { // Check the distance to the opposite side of the wall if (player.Distance(wallPositionOpposite, true) < Math.Pow(300 - player.BoundingRadius / 2, 2)) { // Make the jump happen wallJumpInitTime = Environment.TickCount; wallJumpTarget = wallPositionOpposite; Q.Cast(wallPositionOpposite); // Update jumpTriggered value to not orbwalk now since we want to jump jumpTriggered = true; // Break the loop break; } // If we are not able to jump due to the distance, draw the spot to // make the user notice the possibliy else { // Update indicator values wallJumpPossible = true; } } } } } // Check if the loop triggered the jump, if not just orbwalk if (!jumpTriggered) { Orbwalking.Orbwalk(target, movePosition, 90f, 0f, false, false); } } // Either no wall or Q on cooldown, just move towards to wall then else { Orbwalking.Orbwalk(target, movePosition, 90f, 0f, false, false); } } }
private void DrawWaypoint(Obj_AI_Hero hero, Vector3 endPos) { List<Vector3> waypoints = hero.GetPath(endPos).ToList(); for (int i = 0; i < waypoints.Count - 1; i++) { Vector2 oWp = Drawing.WorldToScreen(waypoints[i]); Vector2 nWp = Drawing.WorldToScreen(waypoints[i + 1]); Drawing.DrawLine(oWp[0], oWp[1], nWp[0], nWp[1], 1, System.Drawing.Color.GreenYellow); } }
public static Vector3 GetPointAfterTimeFromPath(Obj_AI_Hero hero, Vector3 b, float timeInSec) { var path = hero.GetPath(b); var lastPoint = path[0]; var distance = 0f; var maxDist = hero.MoveSpeed * timeInSec; foreach (var point in path.Where(point => !point.Equals(lastPoint))) { if (distance > maxDist) { break; } distance += lastPoint.Distance(point); lastPoint = point; } return lastPoint; }
public static float GetPath(Obj_AI_Hero hero, Vector3 b) { var path = hero.GetPath(b); var lastPoint = path[0]; var distance = 0f; foreach (var point in path.Where(point => !point.Equals(lastPoint))) { distance += lastPoint.Distance(point); lastPoint = point; } return distance; }
private static void Flee() { if (!_player.IsCougar() && _aspectOfTheCougar.IsReady() && CW < 0.2) { _aspectOfTheCougar.Cast(); } // We need to define a new move position since jumping over walls // requires you to be close to the specified wall. Therefore we set the move // point to be that specific piont. People will need to get used to it, // but this is how it works. var wallCheck = VectorHelper.GetFirstWallPoint(_player.Position, Game.CursorPos); // Be more precise if (wallCheck != null) { wallCheck = VectorHelper.GetFirstWallPoint((Vector3)wallCheck, Game.CursorPos, 5); } // Define more position point var movePosition = wallCheck != null ? (Vector3)wallCheck : Game.CursorPos; // Update fleeTargetPosition var tempGrid = NavMesh.WorldToGrid(movePosition.X, movePosition.Y); _fleeTargetPosition = NavMesh.GridToWorld((short)tempGrid.X, (short)tempGrid.Y); // Also check if we want to AA aswell // Reset walljump indicators // Only calculate stuff when our Q is up and there is a wall inbetween if (_player.IsCougar() && _pounce.IsReady() && wallCheck != null) { // Get our wall position to calculate from var wallPosition = movePosition; // Check 300 units to the cursor position in a 160 degree cone for a valid non-wall spot Vector2 direction = (Game.CursorPos.To2D() - wallPosition.To2D()).Normalized(); const float maxAngle = 80; const float step = maxAngle / 20; float currentAngle = 0; float currentStep = 0; bool jumpTriggered = false; while (true) { // Validate the counter, break if no valid spot was found in previous loops if (currentStep > maxAngle && currentAngle < 0) { break; } // Check next angle if ((Math.Abs(currentAngle) < 0.001 || currentAngle < 0) && Math.Abs(currentStep) > 0.000) { currentAngle = (currentStep) * (float)Math.PI / 180; currentStep += step; } else if (currentAngle > 0) { currentAngle = -currentAngle; } Vector3 checkPoint; // One time only check for direct line of sight without rotating if (Math.Abs(currentStep) < 0.001) { currentStep = step; checkPoint = wallPosition + _pounce.Range * direction.To3D(); } // Rotated check else { checkPoint = wallPosition + _pounce.Range * direction.Rotated(currentAngle).To3D(); } // Check if the point is not a wall if (!checkPoint.IsWall()) { // Check if there is a wall between the checkPoint and wallPosition wallCheck = VectorHelper.GetFirstWallPoint(checkPoint, wallPosition); if (wallCheck != null) { // There is a wall inbetween, get the closes point to the wall, as precise as possible Vector2?firstWallPoint = VectorHelper.GetFirstWallPoint( (Vector3)wallCheck, wallPosition, 5); if (firstWallPoint != null) { Vector3 wallPositionOpposite = (Vector3)firstWallPoint; // Check if it'spell worth to jump considering the path length if (_player.GetPath(wallPositionOpposite).ToList().To2D().PathLength() - _player.Distance(wallPositionOpposite) > 200) { // Check the distance to the opposite side of the wall if (_player.Distance(wallPositionOpposite, true) < Math.Pow(375 - _player.BoundingRadius / 2, 2)) { _pounce.Cast(wallPositionOpposite); jumpTriggered = true; } } else { Render.Circle.DrawCircle(Game.CursorPos, 35, Color.Red, 2); } } } } } // Check if the loop triggered the jump, if not just orbwalk if (!jumpTriggered) { Orbwalking.Orbwalk(null, Game.CursorPos, 90f, 0f, false, false); } } // Either no wall or W on cooldown, just move towards to wall then else { Orbwalking.Orbwalk(null, Game.CursorPos, 90f, 0f, false, false); if (_player.IsCougar() && _pounce.IsReady()) { _pounce.Cast(Game.CursorPos); } } }