Package it.polimi.ingsw.eriantys.model
Class SchoolBoard
java.lang.Object
it.polimi.ingsw.eriantys.model.SchoolBoard
This class models a
Player's school board: it contains an entrance and a dining room
(both StudentContainers) and an integer representing the number of towers it contains.
It exposes methods to get and put towers from and into the board and
a method to check if the Player who owns the board should receive a coin based on the students it contains.-
Constructor Summary
ConstructorsConstructorDescriptionSchoolBoard(int entranceSize, int towerNumber) Constructs aSchoolBoardinitially containing the maximum number of towers, with an emptyentranceof maximum size according to the game rules and an emptydiningRoom. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckForCoins(Color color) Returnstrueif and only if thePlayerwho owns thisSchoolBoardis entitled to receive a coin based on the number of students of colorcolortheirDiningRoomcontains.booleanIf thisSchoolBoardhas at least one tower prior to this method's invocation, decreases the number of towers by 1 and returnstrue, otherwise returnsfalse.A getter for the object's dining room.A getter for the object's entrance.intA helper-getter method to fulfill theBoardStatuscreation process.booleanIf thisSchoolBoardhas less than the maximum number of towers prior to this method's invocation, increases the number of towers by 1 and returnstrue, otherwise returnsfalse.
-
Constructor Details
-
SchoolBoard
public SchoolBoard(int entranceSize, int towerNumber) Constructs aSchoolBoardinitially containing the maximum number of towers, with an emptyentranceof maximum size according to the game rules and an emptydiningRoom.- Parameters:
entranceSize- the maximum number of students which the entrance can holdtowerNumber- the maximum number of towers which the schoolboard can hold
-
-
Method Details
-
getEntrance
A getter for the object's entrance.- Returns:
- this
SchoolBoard's entrance
-
getDiningRoom
A getter for the object's dining room.- Returns:
- this
SchoolBoard's dining room
-
checkForCoins
Returnstrueif and only if thePlayerwho owns thisSchoolBoardis entitled to receive a coin based on the number of students of colorcolortheirDiningRoomcontains.- Parameters:
color- theColorwhose amount of students is checked- Returns:
trueif and only if thePlayerwho owns thisDiningRoomis entitled to receive a coin based on the number of students of colorcolortheirDiningRoomcontains
-
deployTower
public boolean deployTower()If thisSchoolBoardhas at least one tower prior to this method's invocation, decreases the number of towers by 1 and returnstrue, otherwise returnsfalse.- Returns:
trueif and only if thisSchoolBoardcan deploy an additional tower
-
returnTower
public boolean returnTower()If thisSchoolBoardhas less than the maximum number of towers prior to this method's invocation, increases the number of towers by 1 and returnstrue, otherwise returnsfalse.- Returns:
trueif and only if thisSchoolBoardcan contain an additional tower
-
getTowerQuantity
public int getTowerQuantity()A helper-getter method to fulfill theBoardStatuscreation process.- Returns:
- a representation for the number of towers owned by the
Player
-