Home Reference Source Repository
import Round from 'deckster/src/models/round.js'
public class | source

Round

Represents a round of a game. Most of the player interactions happen in this class.

Member Summary

Public Members
public get

Gets the cards in the deck, by order.

public get

Gets the cards shown on the table.

public get

Gets the seed used for initially shuffling the deck.

public get

Gets the players in the round.

Method Summary

Public Methods
public

deal(amount: number, players: ...Player)

Deals a specific amount of cards to a single or multiple players.

public

drawToTable(amount: number)

Draws a specific amount of cards to the table, so every player in the round can see them.

public

Gets a player in the round by ID.

Public Members

public get cardsInDeck: Card[] source

Gets the cards in the deck, by order.

public get cardsOnTable: Card[] source

Gets the cards shown on the table. These cards can be seen by every player in the round.

public get deckSeed: string | number | number[] source

Gets the seed used for initially shuffling the deck.

public get players: Player[] source

Gets the players in the round.

Public Methods

public deal(amount: number, players: ...Player) source

Deals a specific amount of cards to a single or multiple players. Once the deck becomes empty, no more cards are dealt.

Params:

NameTypeAttributeDescription
amount number

The amount of cards which should be dealt to each of the players.

players ...Player

Players to whom cards should be dealt. If empty, everyone in the round gets cards.

public drawToTable(amount: number) source

Draws a specific amount of cards to the table, so every player in the round can see them. Once the deck becomes empty, no more cards are dealt.

Params:

NameTypeAttributeDescription
amount number

The amount of cards which should be drawn.

public getPlayerById(id: number | string): Player source

Gets a player in the round by ID.

Params:

NameTypeAttributeDescription
id number | string

Return:

Player

Returns a player object or null if the player could not be found.