Class Board
java.lang.Object
it.polimi.ingsw.gc14.Model.GamePackage.Board
- All Implemented Interfaces:
Serializable
Board manages all the elements during the game such as decks, upper and lower rows, totems, tiles...
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ArrayList<List<BuildingCard>> All building card lists grouped by era; index 0 = era 1, index 1 = era 2, etc.private intCurrent era of the gameprivate final List<BuildingCard> Contains all the building cards of the lower list.The lower row of the tribe card.private final intNumber of playersslotList contains the ordered list of slots (tiles).tribeDeck is the deck from where you draw tribe cards as characters and events.private final List<BuildingCard> Contains all the building cards of the upper list.The upper row of tribe cards. -
Constructor Summary
ConstructorsConstructorDescriptionBoard(int nTotem) Creates and initializes a new board: - Generate the slotList using a method of DecksCreator -
Method Summary
Modifier and TypeMethodDescriptiongenerateTribeDeck(int nPlayers) Creates the tribeDeck.intgetEra()Returns the lower row of building cards.Returns the lower row of tribe cards.Creates and returns a new list containing the slots (tiles) of the game.intReturns the upper row of building cards.Returns the upper row of tribe cards.private voidnextEra()Changes the era of the game: - Increase the era attributeintGoes to the next roundbooleanremoveLowerBuildingCard(BuildingCard buildingCard) Take the selected card from the lower building list of the board.booleanremoveLowerTribeCard(TribeCard tribeCard) Take the selected card from the lower tribe list of the board.booleanremoveUpperBuildingCard(BuildingCard buildingCard) Take the selected card from the upper building list of the board.booleanremoveUpperTribeCard(TribeCard tribeCard) Take the selected card from the upper tribe list of the board.
-
Field Details
-
slotList
-
tribeDeck
-
upperListTribe
-
lowerListTribe
The lower row of the tribe card. During the first round, there will be (num. of players + 1) character cards. During the following rounds, lower row will be emptied and populated with upper row's cards. When an Event card gets in the lower row, the event effect will be activated at the end of the round. -
upperListBuilding
Contains all the building cards of the upper list. When a new era starts, all its building cards are placed here. -
lowerListBuilding
Contains all the building cards of the lower list. When a new era starts, the old era's buildings are moved from the upper to the lower list. -
buildingCardsAllEras
All building card lists grouped by era; index 0 = era 1, index 1 = era 2, etc. -
nTotem
private final int nTotemNumber of players -
era
private int eraCurrent era of the game
-
-
Constructor Details
-
Board
public Board(int nTotem) Creates and initializes a new board: - Generate the slotList using a method of DecksCreator. - Generate the tribeDeck. - Populate the lower list (if there is an event card, it's added to the upper list). - Populate the upper list. - Generate the buildingDeck using a method of DecksCreator.- Parameters:
nTotem- the number of players.
-
-
Method Details
-
getUpperListTribe
-
getLowerListTribe
-
getUpperListBuilding
Returns the upper row of building cards.- Returns:
- the live upper building card list.
-
getLowerListBuilding
Returns the lower row of building cards.- Returns:
- the live lower building card list.
-
getSlotList
-
getTribeDeckSize
public int getTribeDeckSize()- Returns:
- the size of the TribeDeck
-
getEra
public int getEra()- Returns:
- the game era
-
generateTribeDeck
Creates the tribeDeck. Loads the cards from each era, shuffle them, and then combine them in the final deck. In the end, two special events (Sustenance and ShamanicRitual) are added.- Parameters:
nPlayers- the number of players.- Returns:
- a queue containing the cards in this order: - Era 1. - Era 2. - Era 3. - Special events.
-
getPendingEvents
-
removeUpperTribeCard
Take the selected card from the upper tribe list of the board.- Parameters:
tribeCard- is the card to remove.- Returns:
- true if the card is successfully removed.
-
removeLowerTribeCard
Take the selected card from the lower tribe list of the board.- Parameters:
tribeCard- is the card to remove.- Returns:
- true if succeed in removing the card.
-
removeUpperBuildingCard
Take the selected card from the upper building list of the board.- Parameters:
buildingCard- is the card to remove.- Returns:
- true if succeed in removing the card.
-
removeLowerBuildingCard
Take the selected card from the lower building list of the board.- Parameters:
buildingCard- is the card to remove.- Returns:
- true if succeed in removing the card.
-
nextRound
public int nextRound()Goes to the next round. - Clear the lower tribe row. - Moves the upper tribe row to the lower one. - Populate the upper tribe row.- Returns:
- the current era after moving to the next round.
-
nextEra
private void nextEra()Changes the era of the game: - Increase the era attribute. - Clear the lower building list and replace it with the upper building list. - Repopulate the upper building list.
-