Class Game

java.lang.Object
it.polimi.ingsw.server.model.Game

public class Game
extends java.lang.Object
Represents the game with its main components. Allows to create the board where the game will be held and to add the players that will participate to it.
  • Constructor Details

    • Game

      public Game​(int numberOfPlayers)
      Creates a new game.
      Parameters:
      numberOfPlayers - Number of players of the game.
  • Method Details

    • addPlayer

      public Player addPlayer​(java.lang.String nickname, VirtualView virtualView)
      Adds a new player to the game. and chooses challenger if target number of players has been reached.
      Parameters:
      nickname - Nickname chosen by the player.
      virtualView - instance of the client virtual view.
      Returns:
      player that was just created.
    • addGodChosenByChallenger

      public void addGodChosenByChallenger​(God godChosenByChallenger)
      Lets the Challenger choose the Gods that will be used in the game.
      Parameters:
      godChosenByChallenger - God chosen by the Challenger.
    • getBoard

      public Board getBoard()
    • getNumberOfPlayers

      public int getNumberOfPlayers()
    • setNumberOfPlayers

      public void setNumberOfPlayers​(java.lang.Integer numberOfPlayers)
    • getPlayers

      public java.util.ArrayList<Player> getPlayers()
    • getChallenger

      public Player getChallenger()
    • getChosenGods

      public java.util.ArrayList<God> getChosenGods()
    • removePlayer

      public void removePlayer​(Player loser)
      Removes a player from the game.
      Parameters:
      loser - The player that will be removed.