cardation
Version:
fundation of card games, card model
38 lines (37 loc) • 947 B
TypeScript
import Card from '../card/Card';
import Collection from './Collection';
/**
* A hand is a collection of cards.
* @todo 可以考慮再做一個IHand
*/
declare class Hand extends Collection {
/**
* Form a hand from a card array.
* @param hands
* @returns
*/
static from(...hands: Hand[]): Hand;
constructor(cardArray?: Card[]);
/**
* Get a baccarat based point of the hand.
* @returns {number} the point of the hand
*/
getPoint(): number;
pushCard(...card: Card[]): void;
/**
* Get the first card in the array.
* @returns {Card[]} the first card of the hand
*/
getFirstCard(): Card | undefined;
/**
* Get the last card in the array.
* @returns {Card} the last card of the hand
*/
getLastCard(): Card | undefined;
play(): void;
/**
* Clear the hand, all cards will be removed.
*/
clear(): void;
}
export default Hand;