Class CardPlayable

java.lang.Object
it.polimi.ingsw.am13.model.card.Card
it.polimi.ingsw.am13.model.card.CardPlayable
All Implemented Interfaces:
CardIF, CardPlayableIF, Serializable
Direct Known Subclasses:
CardGold, CardResource, CardStarter

public abstract class CardPlayable extends Card implements CardPlayableIF
Represents a card that can be played in player's field sometime during the game. Hence, it could be a resource card, a gold card or a starter card. It stores the information about the 2 sides belonging to the card. Other information about the card played during the game are inherited from Card
See Also:
  • Field Details

    • front

      private final CardSidePlayable front
      Front (playable) side of this playable card
    • back

      private final CardSidePlayable back
      Back (playable) side of this playable card
  • Constructor Details

    • CardPlayable

      public CardPlayable(String id, CardSidePlayable front, CardSidePlayable back)
      Sets all immutable parameters of a playable card while creating a new one. The card is created not visible in field
      Parameters:
      id - Id of the card
      front - Front side of the card
      back - Back side of the card
  • Method Details

    • getSide

      public CardSidePlayable getSide(Side side)
      Specified by:
      getSide in interface CardPlayableIF
      Parameters:
      side - Side whose card side is to be retrieved
      Returns:
      Card side corresponding to specified side
    • getPlayedCardSide

      public CardSidePlayable getPlayedCardSide()
      If the card is visible in field, retrieves the side that is visible
      Specified by:
      getPlayedCardSide in interface CardPlayableIF
      Returns:
      Visible card side of the card. Null if the card is not visible.