java.lang.Object
it.polimi.ingsw.am13.client.gamestate.FieldState
All Implemented Interfaces:
Serializable

public class FieldState extends Object implements Serializable
Representation of one player's field. It stores information about the placed cards, and the available coordinates where to place new cards
See Also:
  • Field Details

    • field

      private final Map<Coordinates,CardSidePlayableIF> field
      Map between coordinates and cards placed on them Once placed, a card cannot be removed
    • availableCoords

      private List<Coordinates> availableCoords
      List of available coordinates where to place other cards during the game
  • Constructor Details

    • FieldState

      public FieldState(FieldIF field)
      Creates a new representation of a player's field starting from the interface of that field itself
      Parameters:
      field - Field to build the representation of
  • Method Details

    • getPlacedCoords

      public List<Coordinates> getPlacedCoords()
      Returns:
      List of coordinates where there is a card placed. The list is ordered from the first placed coordinates to the latest ones
    • getCardSideAtCoord

      public CardSidePlayableIF getCardSideAtCoord(Coordinates coord)
      Parameters:
      coord - Coordinates of the placed card to retrieve
      Returns:
      Card side of the card placed on the given coordinates, or null if no card is placed on those coordinates
    • placeCardSideAtCoord

      void placeCardSideAtCoord(Coordinates coord, CardSidePlayableIF cardSide)
      Sets the given coordinates with the given card side placed on them
      Parameters:
      coord - Coordinates where the card is placed
      cardSide - Card side placed on the given coordinates
    • getAvailableCoords

      public List<Coordinates> getAvailableCoords()
      Returns:
      List of available coordinates where to place other cards during the game
    • setAvailableCoords

      void setAvailableCoords(List<Coordinates> availableCoords)
      Sets the list of available coordinates where to place other cards during the game. (It does not create another list)
      Parameters:
      availableCoords - New list of available coordinates where to place other cards during the game
    • getResourcesInField

      public Map<Resource,Integer> getResourcesInField()