UNPKG

shoehive

Version:

WebSocket-based multiplayer game framework for real-time, event-driven gameplay

66 lines (65 loc) 1.69 kB
import { Card } from './types'; /** * A deck of [Card](/core/card/types#card)s. * * Supports shuffling, drawing cards, and resetting from the discard pile. */ export declare class Deck { private cards; private discardPile; constructor(numberOfDecks?: number); /** * Initializes the deck. * * @param numberOfDecks The number of decks to initialize. */ private initialize; /** * Shuffles the deck. */ shuffle(): void; /** * Draws a card from the deck. * * @param isVisible Whether the card should be visible. * @returns The drawn card or null if the deck is empty. */ drawCard({ isVisible }?: { isVisible?: boolean; }): Card | null; /** * Draws multiple cards from the deck. * * @param count The number of cards to draw. * @param isVisible Whether the cards should be visible. * @returns An array of drawn cards or an empty array if the deck is empty. */ drawCards({ count, isVisible }: { count: number; isVisible?: boolean; }): Card[]; /** * Adds a card to the discard pile. * * @param card The card to add to the discard pile. */ addToDiscard({ card }: { card: Card; }): void; /** * Resets the deck from the discard pile. */ resetFromDiscard(): void; /** * Gets the number of remaining cards in the deck. * * @returns The number of remaining cards in the deck. */ getRemainingCards(): number; /** * Gets the number of discarded cards. * * @returns The number of discarded cards. */ getDiscardedCards(): number; }