com.TeamHEC.LocomotionCommotion.Player
Class Player
java.lang.Object
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.
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
isPlayer1
public boolean isPlayer1
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)
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