Пример #1
0
        public override DoublePoint GetGoal()
        {
            bool player1 = Game.Player1.Minions.ContainsValue(_owner);
            //List<WaypointNode> target_nodes = new List<WaypointNode>();
            /*      These are guesses for base nodes: ...?
                    <Waypoint X="231" Y="1586" />
                    <Waypoint X="326" Y="1760" />
                    <Waypoint X="495" Y="1777" />

                    <Waypoint X="160" Y="47" />
                    <Waypoint X="499" Y="44" />
                    <Waypoint X="810" Y="37" />
                 * */
            if (target == null || WaypointGraph.GetClosestWaypoint((int)_owner.Pos.X, (int)_owner.Pos.Y) == target)
            {
                if (player1)
                {
                    Random random = new Random();
                    int randX = random.Next(0, 1000);
                    int randY = random.Next(0, 900);

                    target = WaypointGraph.GetClosestWaypoint(randX, randY);
                }
                else
                {
                    Random random = new Random();
                    int randX = random.Next(0, 1000);
                    int randY = random.Next(900, 1800);

                    target = WaypointGraph.GetClosestWaypoint(randX, randY);
                }
            }
            WaypointNode myNode = WaypointGraph.GetClosestWaypoint((int)_owner.Pos.X, (int)_owner.Pos.Y);
            List<WaypointNode> path = new List<WaypointNode>();
            /*
             * int length = Int32.MaxValue;
            foreach(WaypointNode target in target_nodes){
                List<WaypointNode> p = WaypointGraph.pathfindDijkstra(myNode, target);
                if (p.Count < length){
                    path = p;
                    length = p.Count;
                }
            }
             * */
            path = WaypointGraph.pathfindDijkstra(myNode, target);
            //path.Add(new WaypointNode((int)closest.Pos.X, (int)closest.Pos.Y, new List<WaypointNode>()));
            FollowPath fp = new FollowPath(_owner, path);

            return fp.GetGoal(); ;
        }
Пример #2
0
        public override DoublePoint GetGoal()
        {
            bool player1 = Game.Player1.Minions.ContainsValue(_owner);
            //List<WaypointNode> target_nodes = new List<WaypointNode>();
            WaypointNode target;
            /*      These are guesses for base nodes: ...?
                    <Waypoint X="231" Y="1586" />
                    <Waypoint X="326" Y="1760" />
                    <Waypoint X="495" Y="1777" />

                    <Waypoint X="160" Y="47" />
                    <Waypoint X="499" Y="44" />
                    <Waypoint X="810" Y="37" />
                 * */
            if (player1)
            {
                //target_nodes.Add(WaypointGraph.getNode(231,1586));
                //target_nodes.Add(WaypointGraph.getNode(326, 1760));
                //target_nodes.Add(WaypointGraph.getNode(495, 1777));
                target = WaypointGraph.getNode(495, 1777);
            }
            else
            {
                //target_nodes.Add(WaypointGraph.getNode(160, 47));
                //target_nodes.Add(WaypointGraph.getNode(499, 44));
                //target_nodes.Add(WaypointGraph.getNode(810, 37));
                target = WaypointGraph.getNode(499, 44);
            }
            WaypointNode myNode = WaypointGraph.GetClosestWaypoint((int)_owner.Pos.X, (int)_owner.Pos.Y);
            List<WaypointNode> path = new List<WaypointNode>();
            /*
             * int length = Int32.MaxValue;
            foreach(WaypointNode target in target_nodes){
                List<WaypointNode> p = WaypointGraph.pathfindDijkstra(myNode, target);
                if (p.Count < length){
                    path = p;
                    length = p.Count;
                }
            }
             * */
            path = WaypointGraph.pathfindDijkstra(myNode, target);
            //path.Add(new WaypointNode((int)closest.Pos.X, (int)closest.Pos.Y, new List<WaypointNode>()));
            FollowPath fp = new FollowPath(_owner, path);

            return fp.GetGoal(); ;
        }
Пример #3
0
        public override DoublePoint GetGoal()
        {
            bool player1 = Game.Player1.Minions.ContainsValue(_owner);
            Minion closest;
            if (player1)
            {
                closest = Game.Player2.Minions.Values.OrderBy(e => WaypointGraph.getDistance((int)_owner.Pos.X, (int)e.Pos.X, (int)_owner.Pos.Y, (int)e.Pos.Y)).First();
            }
            else
            {
                closest = Game.Player1.Minions.Values.OrderBy(e => WaypointGraph.getDistance((int)_owner.Pos.X, (int)e.Pos.X, (int)_owner.Pos.Y, (int)e.Pos.Y)).First();
            }

            WaypointNode farthest = WaypointGraph.GetFarthestWaypoint((int)closest.Pos.X, (int)closest.Pos.Y);
            WaypointNode myNode = WaypointGraph.GetClosestWaypoint((int)_owner.Pos.X, (int)_owner.Pos.Y);
            List<WaypointNode> path = WaypointGraph.pathfindDijkstra(myNode, farthest, (int)closest.Pos.X, (int)closest.Pos.Y);
            FollowPath fp = new FollowPath(_owner, path);
            return fp.GetGoal();
        }
Пример #4
0
        public override DoublePoint GetGoal()
        {
            bool player1 = Game.Player1.Minions.ContainsValue(_owner);
            Minion closest;
            if (player1)
            {
                closest = Game.Player2.Minions.Values.OrderBy(e => WaypointGraph.getDistance((int)_owner.Pos.X, (int)e.Pos.X, (int)_owner.Pos.Y, (int)e.Pos.Y)).First();
            }
            else
            {
                closest = Game.Player1.Minions.Values.OrderBy(e => WaypointGraph.getDistance((int)_owner.Pos.X, (int)e.Pos.X, (int)_owner.Pos.Y, (int)e.Pos.Y)).First();
            }
            //TODO: update curNode at some point
            WaypointNode enemyNode = WaypointGraph.GetClosestWaypoint((int)closest.Pos.X, (int)closest.Pos.Y);
            WaypointNode myNode = WaypointGraph.GetClosestWaypoint((int)_owner.Pos.X, (int)_owner.Pos.Y);
            List<WaypointNode> path = WaypointGraph.pathfindDijkstra(myNode, enemyNode);
            path.Add(new WaypointNode((int)closest.Pos.X, (int)closest.Pos.Y, new List<WaypointNode>()));
            FollowPath fp = new FollowPath(_owner, path);

            return fp.GetGoal();
        }
Пример #5
0
        public override DoublePoint GetGoal()
        {
            bool player1 = Game.Player1.Minions.ContainsValue(_owner);
            WaypointNode target;
            if (player1)
                {
                    Minion special = Game.Player1.Minions.Values.Where(e => e.IsSpecial).FirstOrDefault();
                    if (special != null)
                        target = WaypointGraph.GetClosestWaypoint((int)special.Pos.X, (int)special.Pos.Y + 400);
                    else
                        target = WaypointGraph.GetClosestWaypoint((int)_owner.Pos.X, (int)_owner.Pos.Y);
                }
                else
                {
                    Minion special = Game.Player2.Minions.Values.Where(e => e.IsSpecial).FirstOrDefault();
                    if (special != null)
                        target = WaypointGraph.GetClosestWaypoint((int)special.Pos.X, (int)special.Pos.Y - 400);
                    else
                        target = WaypointGraph.GetClosestWaypoint((int)_owner.Pos.X, (int)_owner.Pos.Y);
                }
            WaypointNode myNode = WaypointGraph.GetClosestWaypoint((int)_owner.Pos.X, (int)_owner.Pos.Y);
            List<WaypointNode> path = new List<WaypointNode>();
            /*
             * int length = Int32.MaxValue;
            foreach(WaypointNode target in target_nodes){
                List<WaypointNode> p = WaypointGraph.pathfindDijkstra(myNode, target);
                if (p.Count < length){
                    path = p;
                    length = p.Count;
                }
            }
             * */
            path = WaypointGraph.pathfindDijkstra(myNode, target);
            //path.Add(new WaypointNode((int)closest.Pos.X, (int)closest.Pos.Y, new List<WaypointNode>()));
            FollowPath fp = new FollowPath(_owner, path);

            return fp.GetGoal(); ;
        }