Options
All
  • Public
  • Public/Protected
  • All
Menu

The client-side Cards document which extends the common BaseCards model. Each Cards document contains CardsData which defines its data schema.

mixes

ClientDocumentMixin

see

CardStacks The world-level collection of Cards documents

see

CardsConfig The Cards configuration application

Hierarchy

  • any
    • Cards

Index

Constructors

  • Returns Cards

Accessors

  • get thumbnail(): string
  • Provide a thumbnail image path used to represent this document.

    Returns string

  • get availableCards(): Card[]
  • The Card documents within this stack which are available to be drawn.

    Returns Card[]

  • get drawnCards(): Card[]
  • The Card documents which belong to this stack but have already been drawn.

    Returns Card[]

  • get typeLabel(): string
  • Returns the localized Label for the type of Card Stack this is

    Returns string

  • get canClone(): boolean
  • Can this Cards document be cloned in a duplicate workflow?

    Returns boolean

Methods

  • _preCreate(data: any, options: any, user: any): Promise<void>
  • inheritdoc

    Parameters

    • data: any
    • options: any
    • user: any

    Returns Promise<void>

  • deal(to: Cards[], number?: number, [options={}]?: { how: number; updateData: any; action: string; chatNotification: boolean }): Promise<Cards>
  • Deal one or more cards from this Cards document to each of a provided array of Cards destinations. Cards are allocated from the top of the deck in cyclical order until the required number of Cards have been dealt.

    Parameters

    • to: Cards[]

      An array of other Cards documents to which cards are dealt

    • number: number = 1
    • [options={}]: { how: number; updateData: any; action: string; chatNotification: boolean } = {}

      Options which modify how the deal operation is performed

      • how: number
      • updateData: any
      • action: string
      • chatNotification: boolean

    Returns Promise<Cards>

    This Cards document after the deal operation has completed

  • pass(to: Cards, ids: string[], [options={}]?: { updateData: any; action: string; chatNotification: boolean }): Promise<Card[]>
  • Pass an array of specific Card documents from this document to some other Cards stack.

    Parameters

    • to: Cards

      Some other Cards document that is the destination for the pass operation

    • ids: string[]

      The embedded Card ids which should be passed

    • [options={}]: { updateData: any; action: string; chatNotification: boolean } = {}

      Additional options which modify the pass operation

      • updateData: any
      • action: string
      • chatNotification: boolean

    Returns Promise<Card[]>

    An array of the Card embedded documents created within the destination stack

  • draw(from: Cards, number?: number, [options={}]?: { how: number; updateData: any }): Promise<Card[]>
  • Draw one or more cards from some other Cards document.

    Parameters

    • from: Cards

      Some other Cards document from which to draw

    • number: number = 1
    • [options={}]: { how: number; updateData: any } = {}

      Options which modify how the draw operation is performed

      • how: number
      • updateData: any

    Returns Promise<Card[]>

    An array of the Card documents which were drawn

  • shuffle([options={}]?: { updateData: any; chatNotification: boolean }): Promise<Cards>
  • Shuffle this Cards stack, randomizing the sort order of all the cards it contains.

    Parameters

    • [options={}]: { updateData: any; chatNotification: boolean } = {}

      Options which modify how the shuffle operation is performed.

      • updateData: any
      • chatNotification: boolean

    Returns Promise<Cards>

    The Cards document after the shuffle operation has completed

  • recall(options: { updateData: any; chatNotification: boolean }): Promise<Cards>
  • Recall the Cards stack, retrieving all original cards from other stacks where they may have been drawn if this is a deck, otherwise returning all the cards in this stack to the decks where they originated.

    Parameters

    • options: { updateData: any; chatNotification: boolean }
      • updateData: any
      • chatNotification: boolean

    Returns Promise<Cards>

    The Cards document after the recall operation has completed.

  • _onUpdate(data: any, options: any, userId: any): void
  • override

    Parameters

    • data: any
    • options: any
    • userId: any

    Returns void

  • _preDelete(options: any, user: any): Promise<any>
  • inheritdoc

    Parameters

    • options: any
    • user: any

    Returns Promise<any>

  • dealDialog(): Promise<Cards>
  • Display a dialog which prompts the user to deal cards to some number of hand-type Cards documents.

    see

    {@link Cards#deal}

    Returns Promise<Cards>

  • drawDialog(): Promise<Card[]>
  • Display a dialog which prompts the user to draw cards from some other deck-type Cards documents.

    see

    {@link Cards#draw}

    Returns Promise<Card[]>

  • passDialog(): Promise<Cards>
  • Display a dialog which prompts the user to pass cards from this document to some other Cards document.

    see

    {@link Cards#deal}

    Returns Promise<Cards>

  • Display a dialog which prompts the user to play a specific Card to some other Cards document

    see

    {@link Cards#pass}

    Parameters

    • card: Card

      The specific card being played as part of this dialog

    Returns Promise<Card[]>

  • resetDialog(): Promise<false | Cards>
  • Display a confirmation dialog for whether or not the user wishes to reset a Cards stack

    see

    {@link Cards#recall}

    Returns Promise<false | Cards>

  • deleteDialog(options?: {}): Promise<any>
  • inheritdoc

    Parameters

    • options: {} = {}

      Returns Promise<any>

    • A sorting function that is used to determine the standard order of Card documents within an un-shuffled stack.

      Parameters

      • a: Card

        The card being sorted

      • b: Card

        Another card being sorted against

      Returns number

    • A sorting function that is used to determine the order of Card documents within a shuffled stack.

      Parameters

      • a: Card

        The card being sorted

      • b: Card

        Another card being sorted against

      Returns number

    • _drawCards(number: number, how: number): Card[]
    • An internal helper method for drawing a certain number of Card documents from this Cards stack.

      Parameters

      • number: number

        The number of cards to draw

      • how: number

        A draw mode from CONST.CARD_DRAW_MODES

      Returns Card[]

      An array of drawn Card documents

    • _resetDeck([options={}]?: { updateData: any; chatNotification: boolean }): Promise<Cards>
    • Perform a reset operation for a deck, retrieving all original cards from other stacks where they may have been drawn.

      Parameters

      • [options={}]: { updateData: any; chatNotification: boolean } = {}

        Options which modify the reset operation.

        • updateData: any
        • chatNotification: boolean

      Returns Promise<Cards>

      The Cards document after the reset operation has completed.

    • _resetStack([options={}]?: { updateData: any; chatNotification: boolean }): Promise<Cards>
    • Return all cards in this stack to their original decks.

      Parameters

      • [options={}]: { updateData: any; chatNotification: boolean } = {}

        Options which modify the return operation.

        • updateData: any
        • chatNotification: boolean

      Returns Promise<Cards>

      The Cards document after the return operation has completed.

    • Create a ChatMessage which provides a notification of the operation which was just performed. Visibility of the resulting message is linked to the default roll mode selected in the chat log dropdown.

      Parameters

      • source: Cards

        The source Cards document from which the action originated

      • action: string

        The localization key which formats the chat message notification

      • context: any

        Data passed to the Localization#format method for the localization key

      Returns ChatMessage

      A created ChatMessage document

    • createDocuments(data?: any[], context?: {}): Promise<any>
    • inheritdoc

      Parameters

      • data: any[] = []
      • context: {} = {}

        Returns Promise<any>

      • createDialog(data?: {}, __namedParameters?: { parent: any; pack: any }): Promise<any>
      • override

        Parameters

        • data: {} = {}
          • __namedParameters: { parent: any; pack: any } = {}
            • parent: any
            • pack: any

          Returns Promise<any>

        Properties

        _sheet: any