private Movement GetMovementTo(Point point, int distance) { var player = _client.GetPlayerTank(); if (point.IsNegativePoint() || point.GetDistance(player) <= distance) { return(GetRandomMovement()); } var horisontalMovement = player.GetHorisontalDirectionTo(point); var verticalMovement = player.GetVerticalDirectionTo(point); if (horisontalMovement == Movement.Stop) { return(verticalMovement); } if (verticalMovement == Movement.Stop) { return(horisontalMovement); } _moveType = MoveType.MovementTo; return(_randomValueGenerator.Next(1) == 1 ? verticalMovement : horisontalMovement); }
public static Point GetClosestEnemyPosition(BattleNetClient client, out List <Movement> movements, int maxTurnsToCalculate) { var enemyPosition = PointUtility.CreateNegativePoint(); movements = new List <Movement>(); List <List <Point> > checkedPoints = new List <List <Point> >(new [] { new List <Point>(new [] { client.GetPlayerTank() }) }); List <List <Movement> > movementsInProcess = new List <List <Movement> >(new [] { new List <Movement>(new [] { Movement.Stop }) }); List <Point> currentRangePoints = new List <Point>(new[] { client.GetPlayerTank() }); for (int count = 0; count < maxTurnsToCalculate && enemyPosition.IsNegativePoint(); count++) { enemyPosition = GetClosestEnemyPosition(client, checkedPoints, movementsInProcess, currentRangePoints, out movements); } if (movements.Any()) { movements.RemoveAt(0); return(enemyPosition); } else { return(PointUtility.CreateNegativePoint()); } }
public bool CanBeUsed() { var player = _client.GetPlayerTank(); var iterators = MapUtility.IterationMap; DangerDirections = new HashSet <Direction>(); var bulets = _client.GetBullets(); var iterationPoints = iterators.ToDictionary(x => x.Key, x => _client.GetPlayerTank()); for (int lengthCounter = 0; lengthCounter < 2; lengthCounter++) { foreach (var iterator in iterators) { var key = iterator.Key; iterationPoints[key] = iterator.Value(iterationPoints[key]); if (bulets.Exists(x => x.X == iterationPoints[key].X && x.Y == iterationPoints[key].Y)) { DangerDirections.Add(key); } } } return(DangerDirections.Count > 0); }
public static List <Movement> GetRoad(BattleNetClient client, Point targetPoint) { var road = new List <Movement>(); List <List <Point> > checkedPoints = new List <List <Point> >(new[] { new List <Point>(new[] { client.GetPlayerTank() }) }); List <List <Movement> > movementsInProcess = new List <List <Movement> >(new[] { new List <Movement>(new[] { Movement.Stop }) }); List <Point> currentRangePoints = new List <Point>(new[] { client.GetPlayerTank() }); while (road.Count == 0) { road = GetRoad(client, targetPoint, checkedPoints, movementsInProcess, currentRangePoints); } road.RemoveAt(0); return(road); }
public static Point GetClosestConstructionPosition(BattleNetClient client, out List <Movement> movements) { movements = new List <Movement>(); return(GetClosestConstructionPosition(client, client.GetPlayerTank(), new List <Point>(), movements)); }
public static bool IsInClosureArea(BattleNetClient client, Region area) => IsInClosureArea(client, client.GetPlayerTank(), area, new List <Point>());
public bool CanBeUsed(List <MapPoint> enemiesInArea) { var player = _client.GetPlayerTank(); return(enemiesInArea?.Count > 0); }