Package it.polimi.ingsw.server.model
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 Summary
Constructors Constructor Description Game(int numberOfPlayers)Creates a new game. -
Method Summary
Modifier and Type Method Description voidaddGodChosenByChallenger(God godChosenByChallenger)Lets the Challenger choose the Gods that will be used in the game.PlayeraddPlayer(java.lang.String nickname, VirtualView virtualView)Adds a new player to the game.BoardgetBoard()PlayergetChallenger()java.util.ArrayList<God>getChosenGods()intgetNumberOfPlayers()java.util.ArrayList<Player>getPlayers()voidremovePlayer(Player loser)Removes a player from the game.voidsetNumberOfPlayers(java.lang.Integer numberOfPlayers)
-
Constructor Details
-
Game
public Game(int numberOfPlayers)Creates a new game.- Parameters:
numberOfPlayers- Number of players of the game.
-
-
Method Details
-
addPlayer
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
Lets the Challenger choose the Gods that will be used in the game.- Parameters:
godChosenByChallenger- God chosen by the Challenger.
-
getBoard
-
getNumberOfPlayers
public int getNumberOfPlayers() -
setNumberOfPlayers
public void setNumberOfPlayers(java.lang.Integer numberOfPlayers) -
getPlayers
-
getChallenger
-
getChosenGods
-
removePlayer
Removes a player from the game.- Parameters:
loser- The player that will be removed.
-