Exemplo n.º 1
0
 public override void DoAction()
 {
     try
     {
         CaptureTheBaseMode handler = (CaptureTheBaseMode)Bot.Game.GameModeHandler;
         handler.ResetBases();
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine(ex);
     }
 }
Exemplo n.º 2
0
 public override void DoAction()
 {
     try
     {
         CaptureTheBaseMode handler = (CaptureTheBaseMode)Bot.Game.GameModeHandler;
         Base b = handler.GetBaseByID(baseEventId);
         b.InflictDamage(damageAmount, isDestroyed);
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine(ex);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Get a path ideal to the current state and current game mode.
        /// </summary>
        /// <returns></returns>
        public Path GetIdealPath(VTankBot bot, Player player)
        {
            if (refreshSpawnPointList)
            {
                RefreshSpawnPointList();
            }

            Path path = null;

            if (State == BotState.SEEK_AND_DESTROY)
            {
                path = GetSeekAndDestroyPath(player);
            }
            else if (State == BotState.COMPLETE_OBJECTIVE)
            {
                GameModeHandler handler = bot.Game.GameModeHandler;
                if (handler is CaptureTheBaseMode)
                {
                    const int          RANGE_MINIMUM = 50;
                    CaptureTheBaseMode mode          = (CaptureTheBaseMode)handler;
                    Base targetBase = mode.GetAttackableBase(player);
                    if (targetBase != null)
                    {
                        Point  p1       = player.GetPosition();
                        Point  p2       = targetBase.GetPosition();
                        double distance = GetDistance(p1, p2);

                        if (distance > RANGE_MINIMUM)
                        {
                            int      tilePositionX = (int)Math.Round((p2.x));
                            int      tilePositionY = (int)Math.Round(-(p2.y));
                            TileNode node          = new TileNode(tilePositionX, tilePositionY);
                            path = PathFinder.FindPath(CurrentMap, player, node.X, node.Y);
                        }
                    }
                }
                // TODO: CTF.
                else
                {
                    path = GetSeekAndDestroyPath(player);
                }
            }

            if (spawnPointIndex >= spawnPointList.Count)
            {
                spawnPointIndex = 0;
            }

            return(path);
        }
Exemplo n.º 4
0
        public override void DoAction()
        {
            try
            {
                CaptureTheBaseMode handler = (CaptureTheBaseMode)Bot.Game.GameModeHandler;
                Base b = handler.GetBaseByID(baseEventId);
                b.Health = Base.DEFAULT_BASE_HEALTH;
                b.Team   = newBaseColor;

                handler.DetectAttackableBases();
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Get a list of targets available from the current game mode, if there are any.
        /// </summary>
        /// <returns></returns>
        private List <ITarget> GetGameModeTargets()
        {
            List <ITarget> results = new List <ITarget>();

            GameModeHandler handler = Game.GameModeHandler;

            if (handler != null && handler is CaptureTheBaseMode)
            {
                CaptureTheBaseMode mode = (CaptureTheBaseMode)handler;
                Base b = mode.GetAttackableBase(Player);
                if (b != null)
                {
                    results.Add(b);
                }
            }

            return(results);
        }