Search in sources :

Example 1 with Board

use of tel.discord.rtab.board.Board in project RtaB6 by Telnaior.

the class GameController method startTheGameAlready.

/**
 * Close signups and run game initialisation stuff.
 */
public void startTheGameAlready() {
    // If the game's already running or no one's in it, just don't
    if ((gameStatus != GameStatus.SIGNUPS_OPEN && gameStatus != GameStatus.ADD_BOT_QUESTION) || players.size() == 0) {
        return;
    }
    // Potentially ask to add bots
    if (gameStatus == GameStatus.SIGNUPS_OPEN && botCount - botsInGame > 0 && players.size() > botsInGame && players.size() < maxPlayers && // Either we're below the playercount we decided earlier we wanted, or it's a big game already and we're feeling nice
    (players.size() < nextGamePlayers || (players.size() >= averagePlayers && Math.random() < 0.1))) {
        addBotQuestion();
        return;
    } else // If we don't have enough players and for some reason didn't add bots, call the game off
    if (players.size() < minPlayers) {
        channel.sendMessage("Not enough players. Game aborted.").queue();
        reset();
    }
    // Declare game in progress so we don't get latecomers
    channel.sendMessage("Starting game...").queue();
    gameStatus = GameStatus.BOMB_PLACEMENT;
    // Generate board
    boardSize = 5 + (5 * players.size());
    spacesLeft = boardSize;
    gameboard = new Board(boardSize, players.size());
    pickedSpaces = new boolean[boardSize];
    // Then do bomb placement
    sendBombPlaceMessages();
}
Also used : Board(tel.discord.rtab.board.Board)

Aggregations

Board (tel.discord.rtab.board.Board)1