예제 #1
0
        public static List <Pirate> RemoveDecoyFromList(this List <Pirate> list)
        {
            if (!DecoyDetector.IsActive())
            {
                return(list);
            }

            var newList = new List <Pirate>();

            for (var i = 0; i < list.Count; i++)
            {
                if (list[i].GetHashCode() == DecoyDetector.GetDecoyHashcode())
                {
                    continue;
                }

                newList.Add(list[i]);
            }

            return(newList);
        }
예제 #2
0
        public void DoTurn(PirateGame game)
        {
            Globals.Game   = game;
            Globals.Drones = new DroneGroups();

            // Debug initialization
            if (Globals.Game.GetTurn() == 1)
            {
                Globals.Game.Debug(" - Javier, v3.0.0");
            }

            // Handle challenges
            Debug.Write("Opponent: " + Globals.Game.GetOpponentName());
            if (Challenge.Handle(Globals.Game.GetOpponentName()))
            {
                return;
            }

            // Handle enemy decoy
            DecoyDetector.Update(game.GetEnemyLivingPirates());
            DecoyDetector.Detect();

            // Move drones towards home
            DroneHandler.Handle();

            // Handle friendly decoy
            int id = -1;

            DecoyHandler.Handle(ref id);

            // Handle pirates
            HandlePirates(id);

            // Handle decoy movement
            HandleDecoyMovement();
        }