Package it.polimi.ingsw.server.model
Class Player
java.lang.Object
it.polimi.ingsw.server.model.Player
public class Player
extends java.lang.Object
A player of the game.
Every player corresponds to a specific client that is connected to play the game.
It's characterized by a unique nickname, a color and a God card.
Two workers are assigned to play the game on the board of the game.
-
Constructor Summary
Constructors Constructor Description Player(Game game, java.lang.String nickname, VirtualView virtualView)Creates a Player. -
Method Summary
Modifier and Type Method Description booleangetCanMoveUp()booleangetCanWinInPerimeter()VirtualViewgetClient()ColorgetColor()GamegetGame()GodgetGod()java.lang.StringgetNickname()java.util.ArrayList<Worker>getWorkers()voidlose()States that the player has lost and removes him and his workers from the game.voidsetColor(Color color)voidsetGod(God god)Assigns to the player a God from the available Gods of the current gamevoidsetPermissionToMoveUp(boolean value)Decides if the player has some restriction to move a worker to a cell which has an higher level than the one the selected worker is currently on.voidsetPermissionToWinInPerimeter(boolean value)Decides if the player has some restriction to win a perimeter cell of the board.
-
Constructor Details
-
Player
Creates a Player.- Parameters:
game- Represents the belonging game of the player.nickname- The name chosen by the user for the belonging game.virtualView- Instance of the client associated to this player.
-
-
Method Details
-
lose
public void lose()States that the player has lost and removes him and his workers from the game. -
getClient
-
getNickname
public java.lang.String getNickname() -
getGod
-
setGod
Assigns to the player a God from the available Gods of the current game- Parameters:
god- god to be assigned.
-
getColor
-
setColor
-
setPermissionToWinInPerimeter
public void setPermissionToWinInPerimeter(boolean value)Decides if the player has some restriction to win a perimeter cell of the board.- Parameters:
value- true allows the player to win in perimeter, false otherwise
-
setPermissionToMoveUp
public void setPermissionToMoveUp(boolean value)Decides if the player has some restriction to move a worker to a cell which has an higher level than the one the selected worker is currently on.- Parameters:
value- true allows the player to move up, false otherwise
-
getCanMoveUp
public boolean getCanMoveUp()- Returns:
- True if the Player can move up, false if this player can not move up for the current turn
-
getCanWinInPerimeter
public boolean getCanWinInPerimeter()- Returns:
- True if the Player can win with a worker on the perimeter, false otherwise
-
getWorkers
-
getGame
-