com.TeamHEC.LocomotionCommotion.Player
Class Shop

java.lang.Object
  extended by com.TeamHEC.LocomotionCommotion.Player.Shop

public class Shop
extends java.lang.Object

Author:
Callum Hewitt The shop object used by a player to buy and sell fuel and cards.

Field Summary
static int cardPrice
           
static float cardSellPrice
           
static int coalPrice
           
static float coalSellPrice
           
static int coalTrainPrice
           
static int coalTrainSellPrice
           
static int electricPrice
           
static float electricSellPrice
           
static int electricTrainPrice
           
static int electricTrainSellPrice
           
static int nuclearPrice
           
static float nuclearSellPrice
           
static int nuclearTrainPrice
           
static int nuclearTrainSellPrice
           
static int oilPrice
           
static float oilSellPrice
           
static int oilTrainPrice
           
static int oilTrainSellPrice
           
 
Constructor Summary
Shop(Player customer)
          The initialiser for shop.
 
Method Summary
 void buyCard(boolean testCase)
          Purchases a card for the player
 void buyFuel(java.lang.String fuelType, int quantity, boolean testCase)
          Purchases fuel from the shop using the customer's money.
 void buyTrain(java.lang.String trainType, int quantity, boolean testCase)
          lets a player buy a train.
 void repairStation(Station station, boolean testCase)
          Repairs a specified station.
 void sellFuel(java.lang.String fuelType, int quantity, boolean testCase)
           
 void upgradeStation(Station station, boolean testCase)
          Upgrades a station Reduces the player's gold by the cost of upgrading a station and increases the station level by 1
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coalPrice

public static final int coalPrice
See Also:
Constant Field Values

coalSellPrice

public static final float coalSellPrice
See Also:
Constant Field Values

oilPrice

public static final int oilPrice
See Also:
Constant Field Values

oilSellPrice

public static final float oilSellPrice
See Also:
Constant Field Values

electricPrice

public static final int electricPrice
See Also:
Constant Field Values

electricSellPrice

public static final float electricSellPrice
See Also:
Constant Field Values

nuclearPrice

public static final int nuclearPrice
See Also:
Constant Field Values

nuclearSellPrice

public static final float nuclearSellPrice
See Also:
Constant Field Values

coalTrainPrice

public static final int coalTrainPrice
See Also:
Constant Field Values

coalTrainSellPrice

public static final int coalTrainSellPrice
See Also:
Constant Field Values

oilTrainPrice

public static final int oilTrainPrice
See Also:
Constant Field Values

oilTrainSellPrice

public static final int oilTrainSellPrice
See Also:
Constant Field Values

electricTrainPrice

public static final int electricTrainPrice
See Also:
Constant Field Values

electricTrainSellPrice

public static final int electricTrainSellPrice
See Also:
Constant Field Values

nuclearTrainPrice

public static final int nuclearTrainPrice
See Also:
Constant Field Values

nuclearTrainSellPrice

public static final int nuclearTrainSellPrice
See Also:
Constant Field Values

cardPrice

public static final int cardPrice
See Also:
Constant Field Values

cardSellPrice

public static final float cardSellPrice
See Also:
Constant Field Values
Constructor Detail

Shop

public Shop(Player customer)
The initialiser for shop. Creates cardFactory and assigns customer.

Parameters:
customer - The player who will be buying and selling things from this shop object.
Method Detail

buyFuel

public void buyFuel(java.lang.String fuelType,
                    int quantity,
                    boolean testCase)
Purchases fuel from the shop using the customer's money. If the player doesn't have enough gold it will display a warning window (unless testing)

Parameters:
fuelType - The type of fuel as string the player will obtain: "Coal", "Oil", "Electric", "Nuclear"
quantity - The amount of fuel the player will purchase
testCase - Determines if the run is a testCase or not.

buyTrain

public void buyTrain(java.lang.String trainType,
                     int quantity,
                     boolean testCase)
lets a player buy a train. Reduced the player's gold by the cost of the train and then adds a train to the players list of trains

Parameters:
trainType - - Train type with capital
quantity - - Number of trains being bought
testCase - - If it is a JUnit test

repairStation

public void repairStation(Station station,
                          boolean testCase)
Repairs a specified station. Reduces the player's gold by the cost of the repair and then removes the station fault

Parameters:
station - - the station to be repaired
testCase - - If this is a JUnit test

upgradeStation

public void upgradeStation(Station station,
                           boolean testCase)
Upgrades a station Reduces the player's gold by the cost of upgrading a station and increases the station level by 1

Parameters:
station - - the station to be upgraded
testCase - - if this is a JUnit test

sellFuel

public void sellFuel(java.lang.String fuelType,
                     int quantity,
                     boolean testCase)

buyCard

public void buyCard(boolean testCase)
Purchases a card for the player

Parameters:
testCase - A boolean deciding if this is a testCase run or not.