com.TeamHEC.LocomotionCommotion.Player
Class Player

java.lang.Object
  extended by com.TeamHEC.LocomotionCommotion.Player.Player
All Implemented Interfaces:
RouteListener

public class Player
extends java.lang.Object
implements RouteListener

Author:
Matthew Taylor , Callum Hewitt , Elliot Bray , Richard Brierley This class defines the object of player and all of the things the player owns, resources and trains etc.

Field Summary
 boolean isPlayer1
           
 
Constructor Summary
Player(java.lang.String name, Score score, Gold gold, Coal coal, Electric electric, Nuclear nuclear, Oil oil, java.util.ArrayList<Card> cards, java.util.ArrayList<Goal> goals, java.util.ArrayList<Train> trains)
           
 
Method Summary
 void addCard(Card card)
           
 void addFuel(java.lang.String fuelType, int quantity)
           
 void addGold(int value)
           
 void addScore(int value)
           
 void addTrain(java.lang.String trainType)
          Adds a train of the type specified to the player's trains.
 void buyCard(int quantity)
           
 void buyCoal(int quantity)
           
 void buyElectric(int quantity)
           
 void buyNuclear(int quantity)
           
 void buyOil(int quantity)
           
 void discardCard(Card card)
           
 java.util.ArrayList<Card> getCards()
           
 int getFuel(java.lang.String fuelType)
           
 java.util.ArrayList<Goal> getGoals()
           
 int getGold()
           
 int[] getLines()
           
 java.lang.String getName()
           
 int getNumCards()
           
 int getNumStations()
           
 int getScore()
           
 Shop getShop()
           
 java.util.ArrayList<Station> getStations()
           
 java.util.ArrayList<Train> getTrains()
           
 void lineBonuses()
          calculates the bonus for each individual station based on how many other stations on the same line are owned
 void purchaseStation(Station station)
           
 void sellStation(Station station)
           
 void stationPassed(Station station, Train train)
           
 void stationRewards()
          Generates fuel from stations.
 void subFuel(java.lang.String fuelType, int quantity)
           
 void subGold(int value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isPlayer1

public boolean isPlayer1
Constructor Detail

Player

public Player(java.lang.String name,
              Score score,
              Gold gold,
              Coal coal,
              Electric electric,
              Nuclear nuclear,
              Oil oil,
              java.util.ArrayList<Card> cards,
              java.util.ArrayList<Goal> goals,
              java.util.ArrayList<Train> trains)
Method Detail

getName

public java.lang.String getName()
Returns:
returns the players name

getScore

public int getScore()
Returns:
returns the player's score

addScore

public void addScore(int value)
Parameters:
value - amount to be added to the player's score

getShop

public Shop getShop()
Returns:
returns the player's instance of shop

buyCoal

public void buyCoal(int quantity)
Parameters:
quantity - is the amount on coal to be added to the player's stockpile

buyOil

public void buyOil(int quantity)
Parameters:
quantity - is the amount on Oil to be added to the player's stockpile

buyElectric

public void buyElectric(int quantity)
Parameters:
quantity - is the amount on Electric to be added to the player's stockpile

buyNuclear

public void buyNuclear(int quantity)
Parameters:
quantity - is the amount on Nuclear to be added to the player's stockpile

buyCard

public void buyCard(int quantity)

getFuel

public int getFuel(java.lang.String fuelType)
Parameters:
fuelType - the kind of fuel that the query will return the amount of.
Returns:
the amount of fuel of type fuelType

addFuel

public void addFuel(java.lang.String fuelType,
                    int quantity)
Parameters:
fuelType - the kind of fuel that the function will add the amount of.
quantity - the amount to increment the fuel value

subFuel

public void subFuel(java.lang.String fuelType,
                    int quantity)
Parameters:
fuelType - the kind of fuel that the function will subtract the amount of.
quantity - the amount to decrement the fuel value

addTrain

public void addTrain(java.lang.String trainType)
Adds a train of the type specified to the player's trains.

Parameters:
trainType - fuel type for the train

getGold

public int getGold()
Returns:
the amount of gold the player has

addGold

public void addGold(int value)
Parameters:
value - the amount to increment the gold value

subGold

public void subGold(int value)
Parameters:
value - the amount to decrement the gold value

addCard

public void addCard(Card card)
Parameters:
card - an object of type Card to add the the player's stockpile

discardCard

public void discardCard(Card card)
Parameters:
card - an object of type card to discard from the player's hand

getNumCards

public int getNumCards()
Returns:
the number of cards the player owns

getCards

public java.util.ArrayList<Card> getCards()
Returns:
returns the array of cards the player owns

getNumStations

public int getNumStations()
Returns:
returns the number of stations owned by the player

getStations

public java.util.ArrayList<Station> getStations()
Returns:
returns the array list of stations

getLines

public int[] getLines()
Returns:
returns the array containing how much of each line a player owns

purchaseStation

public void purchaseStation(Station station)
Parameters:
station - purchases the station for the player and keeps track of lines owned

sellStation

public void sellStation(Station station)

stationPassed

public void stationPassed(Station station,
                          Train train)
Specified by:
stationPassed in interface RouteListener

lineBonuses

public void lineBonuses()
calculates the bonus for each individual station based on how many other stations on the same line are owned


stationRewards

public void stationRewards()
Generates fuel from stations.


getGoals

public java.util.ArrayList<Goal> getGoals()
Returns:
the goals of a player as an arraylist

getTrains

public java.util.ArrayList<Train> getTrains()
Returns:
the trains that a player owns as an arraylist