Class TribeCard

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

public abstract class TribeCard extends PlayableCard implements Serializable
Abstract base class for all tribe cards. A TribeCard is a PlayableCard that may either be an event card or a non-event card, and may optionally specify a minimum number of players.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final boolean
    Indicates whether this tribe card is an event card.
    private final int
    The minimum number of players required for this tribe card.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TribeCard(int Era, boolean isEventCard)
    Creates a tribe card with the specified era and event-card flag.
    TribeCard(int Era, boolean isEventCard, int nMin)
    Creates a tribe card with the specified era, event-card flag, and minimum number of players.
    TribeCard(String idIMG, int Era, boolean isEventCard)
    Creates a tribe card with the specified image id, era and event-card flag.
    TribeCard(String idIMG, int Era, boolean isEventCard, int nMin)
    Creates a tribe card with the specified image id, era, event-card flag, and minimum number of players.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract TribeCard
    Creates and returns a copy of this tribe card.
    int
    Returns the minimum number of players required for this tribe card.
    boolean
    Returns whether this tribe card is an event card.

    Methods inherited from class PlayableCard

    getEra, getIdIMG, toStringBoard, toStringPlayer

    Methods inherited from class Object

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

    • isEventCard

      private final boolean isEventCard
      Indicates whether this tribe card is an event card.
    • nMin

      private final int nMin
      The minimum number of players required for this tribe card.
  • Constructor Details

    • TribeCard

      public TribeCard(int Era, boolean isEventCard)
      Creates a tribe card with the specified era and event-card flag. The minimum number of players is set to 0.
      Parameters:
      Era - the era of the tribe card.
      isEventCard - whether the card is an event card.
    • TribeCard

      public TribeCard(String idIMG, int Era, boolean isEventCard)
      Creates a tribe card with the specified image id, era and event-card flag. The minimum number of players is set to 0.
      Parameters:
      idIMG - the image identifier of the tribe card.
      Era - the era of the tribe card.
      isEventCard - whether the card is an event card.
    • TribeCard

      public TribeCard(int Era, boolean isEventCard, int nMin)
      Creates a tribe card with the specified era, event-card flag, and minimum number of players.
      Parameters:
      Era - the era of the tribe card.
      isEventCard - whether the card is an event card.
      nMin - the minimum number of players required for the card.
    • TribeCard

      public TribeCard(String idIMG, int Era, boolean isEventCard, int nMin)
      Creates a tribe card with the specified image id, era, event-card flag, and minimum number of players.
      Parameters:
      idIMG - the image identifier of the tribe card.
      Era - the era of the tribe card.
      isEventCard - whether the card is an event card.
      nMin - the minimum number of players required for the card.
  • Method Details

    • isEventCard

      public boolean isEventCard()
      Returns whether this tribe card is an event card.
      Returns:
      true if this card is an event card, false otherwise.
    • getNMin

      public int getNMin()
      Returns the minimum number of players required for this tribe card.
      Returns:
      the minimum number of players required for this tribe card.
    • clone

      public abstract TribeCard clone()
      Creates and returns a copy of this tribe card.
      Overrides:
      clone in class Object
      Returns:
      a clone of this tribe card.