Ejemplo n.º 1
0
        public void GameModeQuestion()
        {
            _consoleMicroservice.GameMasterSpeech("If you wish to duel with another human intellectual, type 'PVP'!\n");
            _consoleMicroservice.GameMasterSpeech("However, if you have no rivals, then type 'PVE' and fight against an AI!\n");

            var input = _consoleMicroservice.GetInput("What was that? I didn't catch that");

            switch (input.ToLower())
            {
            case "pvp":
                _consoleMicroservice.GameMasterSpeech("PvP it is then.\n");
                (_player1, _player2, _board1, _board2, _gameMode) = _boardService.SetupPvPBoards();
                break;

            case "pve":
                _consoleMicroservice.GameMasterSpeech("You cannot win against the AI. Feel free to try anyway.\n");
                (_player1, _player2, _board1, _board2, _gameMode) = _boardService.SetupPvEBoards();
                break;

            default:
                _consoleMicroservice.GameMasterSpeech("What was that? I didn't catch that. Let's get this going already.\n");
                _consoleMicroservice.GameMasterSpeech("I think I'll just go ahead and pin you into the arena against the AI.\n");
                (_player1, _player2, _board1, _board2, _gameMode) = _boardService.SetupPvEBoards();
                break;
            }
        }
Ejemplo n.º 2
0
        public bool PlaceFleet(Board board1, Board board2, int fleetCap, int shipSize, string gmSassyRemark)
        {
            var shipsLeftToPlace = fleetCap;

            Console.Write("Coordinates [x-y]: ");
            while (shipsLeftToPlace != 0)
            {
                var input = _consoleMicroservice.GetInput("Invalid coordinates. Ships must be within the field of operations. Try again mate.\n");

                if (input.ToLower() == "r")
                {
                    _consoleMicroservice.GameMasterSpeech(gmSassyRemark);
                    board1 = PlaceShipsRandomly(board1, shipSize, shipsLeftToPlace);

                    _consoleMicroservice.RadarOperatorAlliedBoard(board1.Owner.Name);
                    _consoleMicroservice.ShowBattleMap(board1.Owner, board1, ConsoleColor.Cyan, "[Current Allied Ship Positions]:\n");

                    return(true);
                }

                var result = PlaceShip(board1, input, shipSize);
                if (result)
                {
                    shipsLeftToPlace = shipsLeftToPlace - 1;
                    _consoleMicroservice.ShipInPosition(shipsLeftToPlace, board1.Owner.Name);
                }
                else
                {
                    _consoleMicroservice.GameMasterSpeech("Invalid coordinates. Put your ship within the board.\n");
                }

                _consoleMicroservice.RadarOperatorAlliedBoard(board1.Owner.Name);
                _consoleMicroservice.ShowBattleMap(board1.Owner, board1, ConsoleColor.Cyan, "[Current Allied Ship Positions]:\n");
            }

            return(true);
        }