RosettaStone::Hand Class Reference

Hand class. More...

#include <Rosetta/Models/Hand.hpp>

Public Member Functions

 Hand ()
 Default constructor. More...
 
PlayerGetOwner () const
 
void SetOwner (Player &owner)
 
bool IsFull () const
 
bool IsEmpty () const
 
std::size_t GetNumOfCards () const
 
EntityGetCard (std::size_t pos)
 
std::vector< Entity * > GetAllCards ()
 
std::optional< std::size_t > FindCardPos (Entity &card)
 
void AddCard (Entity &card)
 
void RemoveCard (Entity &card)
 
void SwapCard (Entity &card1, Entity &card2)
 

Detailed Description

Hand class.

This class is where each player keeps the cards currently available to them. The player can see their hand face-up at the bottom of the screen, while the opponent's hand is shown face-down at the top of the screen.

Constructor & Destructor Documentation

◆ Hand()

RosettaStone::Hand::Hand ( )

Default constructor.

Member Function Documentation

◆ AddCard()

void RosettaStone::Hand::AddCard ( Entity card)

Adds a card to hand.

Parameters
cardThe card to add to hand.

◆ FindCardPos()

std::optional<std::size_t> RosettaStone::Hand::FindCardPos ( Entity card)

Returns the position of card in hand.

Returns
The position of card in hand.

◆ GetAllCards()

std::vector<Entity*> RosettaStone::Hand::GetAllCards ( )

Returns all cards in hand.

Returns
A list of cards in hand.

◆ GetCard()

Entity* RosettaStone::Hand::GetCard ( std::size_t  pos)

Returns card in hand.

Parameters
posThe position of card in hand.
Returns
A card in hand at pos.

◆ GetNumOfCards()

std::size_t RosettaStone::Hand::GetNumOfCards ( ) const

Returns the number of cards in hand.

Returns
The number of cards in hand.

◆ GetOwner()

Player& RosettaStone::Hand::GetOwner ( ) const

Returns the owner of hand.

Returns
The owner of hand.

◆ IsEmpty()

bool RosettaStone::Hand::IsEmpty ( ) const

Finds out if hand is empty.

Returns
true if hand is empty, and false otherwise.

◆ IsFull()

bool RosettaStone::Hand::IsFull ( ) const

Finds out if hand is full.

Returns
true if hand is full, and false otherwise.

◆ RemoveCard()

void RosettaStone::Hand::RemoveCard ( Entity card)

Removes a card from hand.

Parameters
cardThe card to remove from hand.

◆ SetOwner()

void RosettaStone::Hand::SetOwner ( Player owner)

Sets the owner of hand.

Parameters
ownerThe owner of hand.

◆ SwapCard()

void RosettaStone::Hand::SwapCard ( Entity card1,
Entity card2 
)

Swaps two cards in hand.

Parameters
card1First card to swap.
card2Second card to swap.

The documentation for this class was generated from the following file: