public class Station extends MapObj
Modifier and Type | Field and Description |
---|---|
double |
mindistance |
actor, connections, x, y
Constructor and Description |
---|
Station(java.lang.String name,
int baseValue,
Resource resourceType,
int baseFuelOut,
Line[] line,
int rentValue,
float x,
float y) |
Station(java.lang.String name,
int baseValue,
Resource resourceType,
int baseFuelOut,
Line[] line,
int rentValue,
float x,
float y,
boolean locked) |
Modifier and Type | Method and Description |
---|---|
void |
addLine(Line colour) |
void |
addRentValueMod(int add) |
void |
addResourceOutMod(int add) |
void |
addValueMod(int add) |
boolean |
equals(Station station) |
void |
fixFaulty()
fix the station
|
int |
getBaseRentValue() |
int |
getBaseResourceOut() |
int |
getBaseValue() |
double |
getFaultRate() |
Line[] |
getLineType() |
Player |
getOwner() |
int |
getRentValueMod() |
int |
getResourceOutMod() |
java.lang.String |
getResourceString() |
Resource |
getResourceType() |
Station |
getStation() |
Game_Map_Station |
getStationActor() |
int |
getTotalRent() |
int |
getTotalResourceOut() |
int |
getTotalValue() |
int |
getValueMod() |
boolean |
isFaulty() |
void |
makeFaulty()
makes the station faulty
|
void |
notifyStationPurchased(Station station,
Player player)
Called when you want to notify listeners that a station has changed ownership, such as
changing the texture on the map or setting the text of the players gold
|
void |
register(StationListener newListener)
Registers an object implementing the StationListener by adding it to the listeners array
|
void |
removeLine(Line colour) |
void |
setBaseRentValue(int newVal) |
void |
setBaseResourceOut(int newVal) |
void |
setBaseValue(int newVal) |
void |
setOwner(Player newOwner)
Changes the owner of this station and notifies listeners
|
void |
setRentValueMod(int value) |
void |
setResourceOutMod(int mod) |
void |
setResourceType(Resource newResourceType) |
void |
setValueMod(int value) |
void |
subRentValueMod(int sub) |
void |
subResourceOutMod(int sub) |
void |
subValueMod(int sub) |
java.lang.String |
toJSON()
Recursively generates a JSON of the Station instance
|
void |
unregister(StationListener s)
Removes object implementing StationListener so it no longer recieves updates
|
public Station(java.lang.String name, int baseValue, Resource resourceType, int baseFuelOut, Line[] line, int rentValue, float x, float y)
name
- baseValue
- The value of the stationresourceType
- The type of resource the station producesbaseFuelOut
- The amount of resource the station produces each turn, without up line bonusesline
- Array of lines the station belongs torentValue
- How much it costs to rentx
- Coordinate of position x on mapy
- Coordinate of position y on mappublic Station getStation()
getStation
in class MapObj
public Game_Map_Station getStationActor()
public java.lang.String getResourceString()
public int getBaseValue()
public void setBaseValue(int newVal)
newVal
- the new base value of the stationpublic int getValueMod()
public void setValueMod(int value)
public void addValueMod(int add)
public void subValueMod(int sub)
public int getTotalValue()
public Resource getResourceType()
public void setResourceType(Resource newResourceType)
public int getBaseResourceOut()
public void setBaseResourceOut(int newVal)
public int getResourceOutMod()
public void setResourceOutMod(int mod)
mod
- the amount resourceOut will be increased by, Total = Base + Modpublic void addResourceOutMod(int add)
public void subResourceOutMod(int sub)
public int getTotalResourceOut()
public int getBaseRentValue()
public void setBaseRentValue(int newVal)
newVal
- the new rent valuepublic int getRentValueMod()
public void setRentValueMod(int value)
public void addRentValueMod(int add)
public void subRentValueMod(int sub)
public int getTotalRent()
public Player getOwner()
public void setOwner(Player newOwner)
newOwner
- public Line[] getLineType()
public void addLine(Line colour)
public void removeLine(Line colour)
public void register(StationListener newListener)
newListener
- the object to be addedpublic void unregister(StationListener s)
s
- the object to be removedpublic void notifyStationPurchased(Station station, Player player)
station
- player
- public boolean isFaulty()
public void makeFaulty()
public void fixFaulty()
public double getFaultRate()
public boolean equals(Station station)
different
- station