Class CardContainer<TCard>Abstract

Base class for general card containers, like decks and hands. We don't assume anything about how cards are stored.

Type Parameters

Hierarchy

Implements

Constructors

  • Base class for general card containers, like decks and hands.

    Type Parameters

    Parameters

    • CardType: CardType<TCard>

      Constructor for the type of card stored in this container. Used to find the card dimensions.

    Returns CardContainer<TCard>

Properties

_lastActionIndex: number
hiddenName?: string

Optional display name for this object when hidden.

name?: string

Optional display name for this object.

Accessors

  • get count(): number
  • Gets the number of cards in this container.

    Returns number

  • get isEmpty(): boolean
  • If true, this container has no cards.

    Returns boolean

  • get localBounds(): Bounds
  • How much space does this object take up.

    Returns Bounds

Methods

  • Add a single card to the default place in this container.

    Parameters

    • card: TCard

      Card to add.

    Returns void

  • Add a whole wad of cards to the default place in this container.

    Parameters

    • cards: Iterable<TCard> | TCard[]

      Cards to add.

    Returns void

  • Parameters

    • card: TCard

    Returns boolean

  • Called when a card is to be added to this container.

    Parameters

    • card: TCard

      Card to add.

    Returns void

  • Called when a card is to be removed from this container.

    Parameters

    • card: TCard

      Card to remove.

    Returns void

  • Called when cards matching a predicate are to be removed.

    Parameters

    • Optional predicate: ((card) => boolean)

      Function that returns true for cards that should be removed.

        • (card): boolean
        • Parameters

          • card: TCard

          Returns boolean

    Returns TCard[]

  • Remove a specific card from this container. The given card must actually be inside this container.

    Parameters

    • card: TCard

      Card to remove.

    Returns TCard

    The removed card.

  • Remove all cards from this container.

    Returns TCard[]

    The removed cards.

  • Remove the given cards from this container.

    Parameters

    • cards: Iterable<TCard>

    Returns TCard[]

    The removed cards.

  • Remove all cards matching a predicate from this container.

    Parameters

    • predicate: ((card) => boolean)

      Predicate to match for each card.

        • (card): boolean
        • Parameters

          • card: TCard

          Returns boolean

    Returns TCard[]

    The removed cards.

  • Builds a view of this object from the perspective of a player.

    Parameters

    • ctx: RenderContext

      Information about where the object is in the scene, and who's viewing it.

    Returns IView

Generated using TypeDoc