//
//  player.java
//  cribbage
//

public abstract class Player {
	private String name;
	private int playerID;
	private Hand hand;
	private Hand peggingHand;
	private int score;
	
	// constructor
	public Player(String name,int playerID) {
		this.name = new String(name);
		this.playerID = playerID;
		hand = new Hand();
		score = 0;
	}
	
	// accessors
	public String getName() {return name;}
	public int getScore() {return score;}
	public Hand getHand() {return hand;}
	public Hand getPeggingHand() {return peggingHand;}
	public int getPlayerID() {return playerID;}
	
	// mutators
	public void setScore(int newScore) {
		score = newScore;
	}
	
	public abstract void addScore(int pointsScored);
	
	public abstract void putCard(Card aCard);
	
	public void setPeggingHand (Hand myHand) {
		peggingHand = myHand;
	}
	
	public void tallyHand () {
		score += hand.tally();
		
		if (score > 120) {
			System.out.println(name+" pegs "+(hand.tally())+" points for the show. Totaling "+score+" points.");
		}
		
	}
	
	public abstract int getDiscardCard (Cribbage gameManger);
	
	public abstract int getPeggingCard (CurrentPlay cardsInPlay, Cribbage gameManger);
	
	public void display(){
		hand.display();
	}
	
}
