public abstract class Train
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
fuelPerTurn |
Route |
route |
Constructor and Description |
---|
Train(java.lang.String name,
Fuel fuelType,
int baseSpeed,
int speedMod,
int value,
boolean inStation,
Route route,
Player owner)
The superclass of Train types, Creates a Train for player.
|
Modifier and Type | Method and Description |
---|---|
void |
addUpgrade(TrainUpgrade upgrade)
Adds an upgrade to the current train:
|
void |
decreaseFuelPerTurn(int by) |
Game_Map_Train |
getActor() |
int |
getBaseSpeed() |
int |
getFuelLengthCost(float length) |
int |
getFuelPerTurn() |
int |
getFuelRouteCost() |
java.lang.String |
getFuelType() |
java.lang.String |
getName() |
Obstacle |
getObstacle() |
double |
getObstacleSpeedFactor() |
Player |
getOwner() |
Route |
getRoute() |
int |
getSpeed()
Returns the speed of the train.
|
int |
getSpeedMod() |
int |
getValue() |
boolean |
hasObstacle() |
void |
increaseSpeedMod(int by) |
void |
instantMoveTrain()
Instantly completes the trains movement for this turn
|
boolean |
isInStation() |
void |
moveTrain()
Moves the train through it's route
|
void |
removeUpgrade(TrainUpgrade upgrade)
Removes an upgrade from a train
|
void |
setFuelPerTurn(int fuelPerTurn) |
void |
setInStation(boolean inStation) |
void |
setObstacle(Obstacle o) |
void |
setSpeedMod(int speedMod) |
java.lang.String |
toJSON() |
public int fuelPerTurn
public final Route route
public Train(java.lang.String name, Fuel fuelType, int baseSpeed, int speedMod, int value, boolean inStation, Route route, Player owner)
fuelType
- Type of fuel the train consumesspeedMod
- Any speed modifications made to the trainvalue
- The price of the traininStation
- whether the train is currently in a stationroute
- The route the train is currently usingowner
- The owner of the trainpublic java.lang.String toJSON()
public Game_Map_Train getActor()
public java.lang.String getName()
public int getValue()
public Player getOwner()
public int getSpeed()
public int getBaseSpeed()
public int getSpeedMod()
public double getObstacleSpeedFactor()
public int getFuelPerTurn()
public int getFuelRouteCost()
public int getFuelLengthCost(float length)
length
- the length of distance you want to travelpublic java.lang.String getFuelType()
public Route getRoute()
public void setSpeedMod(int speedMod)
public void setFuelPerTurn(int fuelPerTurn)
public void increaseSpeedMod(int by)
public void decreaseFuelPerTurn(int by)
public void setInStation(boolean inStation)
public boolean isInStation()
public void moveTrain()
public void instantMoveTrain()
public void addUpgrade(TrainUpgrade upgrade)
upgrade
- The upgrade to be addedpublic void removeUpgrade(TrainUpgrade upgrade)
upgrade
- the upgrade to be removedpublic boolean hasObstacle()
public Obstacle getObstacle()
public void setObstacle(Obstacle o)