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
    boolean getCanMoveUp()  
    boolean getCanWinInPerimeter()  
    VirtualView getClient()  
    Color getColor()  
    Game getGame()  
    God getGod()  
    java.lang.String getNickname()  
    java.util.ArrayList<Worker> getWorkers()  
    void lose()
    States that the player has lost and removes him and his workers from the game.
    void setColor​(Color color)  
    void setGod​(God god)
    Assigns to the player a God from the available Gods of the current game
    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.
    void setPermissionToWinInPerimeter​(boolean value)
    Decides if the player has some restriction to win a perimeter cell of the board.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Player

      public Player​(Game game, java.lang.String nickname, VirtualView virtualView)
      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

      public VirtualView getClient()
    • getNickname

      public java.lang.String getNickname()
    • getGod

      public God getGod()
    • setGod

      public void setGod​(God god)
      Assigns to the player a God from the available Gods of the current game
      Parameters:
      god - god to be assigned.
    • getColor

      public Color getColor()
    • setColor

      public void setColor​(Color color)
    • 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

      public java.util.ArrayList<Worker> getWorkers()
    • getGame

      public Game getGame()