Class PlayableCard

java.lang.Object
it.polimi.ingsw.gc14.Model.PlayableCard
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BuildingCard, TribeCard

public abstract class PlayableCard extends Object implements Serializable
Abstract base class for all playable cards. A PlayableCard is characterized by an era value.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The era associated with this playable card.
    private final String
    The image identifier of the playable card.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlayableCard(int era)
    Creates a playable card with the specified era.
    PlayableCard(String idIMG, int era)
    Creates a playable card with the specified image id and era.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the era of this playable card.
    Returns the image identifier of this playable card.
    abstract String
    Returns the representation shown on the board (offer track cards).
    abstract String
    Returns the compact representation shown in the player hand panel.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • idIMG

      private final String idIMG
      The image identifier of the playable card.
    • era

      private final int era
      The era associated with this playable card.
  • Constructor Details

    • PlayableCard

      public PlayableCard(int era) throws IllegalArgumentException
      Creates a playable card with the specified era.
      Parameters:
      era - the era of the playable card.
      Throws:
      IllegalArgumentException - if era <= 0 or era >= 4.
    • PlayableCard

      public PlayableCard(String idIMG, int era) throws IllegalArgumentException
      Creates a playable card with the specified image id and era.
      Parameters:
      idIMG - the image identifier of the playable card.
      era - the era of the playable card.
      Throws:
      IllegalArgumentException - if era <= 0 or era >= 4.
  • Method Details

    • getIdIMG

      public String getIdIMG()
      Returns the image identifier of this playable card.
      Returns:
      the image identifier of this playable card.
    • getEra

      public int getEra()
      Returns the era of this playable card.
      Returns:
      the era of this playable card.
    • toStringPlayer

      public abstract String toStringPlayer()
      Returns the compact representation shown in the player hand panel.
      Returns:
      the player-hand string representation of this card.
    • toStringBoard

      public abstract String toStringBoard()
      Returns the representation shown on the board (offer track cards).
      Returns:
      the board string representation of this card.