Package it.polimi.ingsw.Server.Model
Class Player
java.lang.Object
it.polimi.ingsw.Server.Model.Player
This class represent all player's info and finalize shelf insertion and score update operation
-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
Boolean attributes that indicate if one of the two common goals is achievedprivate boolean
Boolean attributes that indicate if one of the two common goals is achievedprivate CommonGoalCard
First common goal card referenceprivate CommonGoalCard
Second common goal card referenceprivate boolean
Boolean attribute used to check player's presence in the ongoing gameprivate final Map<ScoreCard,
CommonGoalCard> private final String
Player's nicknameprivate PersonalGoalCard
Player's personal goal cardprivate int
Player's position relative to the first player clockwiseprivate int
Player's scoreList of ScoreCards achieved by the playerprivate Shelf
Player's shelf reference -
Constructor Summary
ConstructorDescriptionPlayer's class constructorPlayer
(String nickname, PersonalGoalCard pgCard, CommonGoalCard cgCard1, CommonGoalCard cgCard2, int position, Board board) Player's class constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method gives to the first player that has fulfilled the shelf an EndGameCardThis is a getter method for the PersonalGoalCardint
This is a getter method for the position attributeint
getScore()
This is a getter method for the score attributegetShelf()
This is a getter method for the shelf attributeboolean
isInGame()
This method returns player's game statusvoid
refreshEntities
(CommonGoalCard cgCard1, CommonGoalCard cgCard2) Refreshment strategy, related to persistency management strategyvoid
setGameParameters
(PersonalGoalCard pgCard, CommonGoalCard cgCard1, CommonGoalCard cgCard2, Board board) Setter for initial Game parametersvoid
This method set the inGame parameter at falsevoid
setPosition
(int position) void
This method updates player's score checking the possible point obtained from the common and personal goal cards
-
Field Details
-
nickname
Player's nickname -
scoreCards
List of ScoreCards achieved by the player -
lastAchieved
-
position
private int positionPlayer's position relative to the first player clockwise -
score
private int scorePlayer's score -
cgCard1
First common goal card reference -
cgCard2
Second common goal card reference -
shelf
Player's shelf reference -
pgCard
Player's personal goal card -
inGame
private boolean inGameBoolean attribute used to check player's presence in the ongoing game -
achievedCG1
private boolean achievedCG1Boolean attributes that indicate if one of the two common goals is achieved -
achievedCG2
private boolean achievedCG2Boolean attributes that indicate if one of the two common goals is achieved
-
-
Constructor Details
-
Player
Player(String nickname, PersonalGoalCard pgCard, CommonGoalCard cgCard1, CommonGoalCard cgCard2, int position, Board board) throws RemoteException Player's class constructor- Parameters:
nickname
- (1st parameter)pgCard
- (2nd parameter)cgCard1
- (3rd parameter)cgCard2
- (4th parameter)position
- (5th parameter)board
- (6th parameter)- Throws:
RemoteException
-
Player
Player's class constructor- Parameters:
nickname
- (1st parameter)- Throws:
RemoteException
- related to RMI
-
-
Method Details
-
setGameParameters
public void setGameParameters(PersonalGoalCard pgCard, CommonGoalCard cgCard1, CommonGoalCard cgCard2, Board board) Setter for initial Game parameters- Parameters:
pgCard
- Personal Goal Card for the playercgCard1
- First Common Goal Card for the gamecgCard2
- Second Common Goal Card for the gameboard
- Board for the game
-
getNickname
- Returns:
- Player's nickname
-
getPosition
public int getPosition()This is a getter method for the position attribute- Returns:
- int player's position
-
setPosition
public void setPosition(int position) - Parameters:
position
- Player's clockwise position in the game
-
getScore
public int getScore()This is a getter method for the score attribute- Returns:
- int player's score
-
getShelf
This is a getter method for the shelf attribute- Returns:
- Player's shelf
-
getPersonalGoalCard
This is a getter method for the PersonalGoalCard- Returns:
- PersonalGoalCard
-
updateScore
This method updates player's score checking the possible point obtained from the common and personal goal cards- Throws:
Exception
- related to Model management
-
isInGame
public boolean isInGame()This method returns player's game status- Returns:
- boolean true if the player is still in game, false otherwise.
-
setOutOfTurn
public void setOutOfTurn()This method set the inGame parameter at false -
firstShelfFull
This method gives to the first player that has fulfilled the shelf an EndGameCard- Throws:
RemoteException
- related to RMI
-
refreshEntities
Refreshment strategy, related to persistency management strategy- Parameters:
cgCard1
- new Common Goal Card 1 objectcgCard2
- new Common Goal Card 2 object- Throws:
RemoteException
- related to RMI
-
getLastAchieved
- Returns:
- lastly achieved Common Goal Cards objectives
-
getScoreCards
- Returns:
- Player's ScoreCards
-