package game;
import hand.BlackJackHand;
import hand.Hand;
import hand.HandBehaviour;
/**
* A player that has a hand and a hand behaviour. The hand behaviour determines
* the amount of cards in the hand.
* @author TJ Renninger
*
*/
public class Player
{
private Hand hand;
private boolean firstDraw;
protected HandBehaviour handBehaviour;
public Player()
{
this(new BlackJackHand());
}
/**
* Create a player and set their hand type
* @param handBehaviour for the game
*/
public Player(HandBehaviour handBehaviour)
{
this.handBehaviour = handBehaviour;
hand = this.handBehaviour.setHand();
firstDraw = true;
}
/**
* If first draw, draw whole hand otherwise draw a single card
*/
public void draw()
{
if (firstDraw)
{
hand.drawHand();
firstDraw = false;
}
else hand.drawCard();
}
/**
*
* @return the players hand object
*/
public Hand getHand()
{
return hand;
}
/**
*
* @return the players hand behaviour.
*/
public HandBehaviour getHandBehaviour()
{
return handBehaviour;
}
}