Class City
Class City
java.lang.Object
|
+----City
- public class City
- extends Object
- Version:
- 1.1
Datatype for a City
- Author:
- Nicklas Hjalmarsson, Torbjörn Nilsson
-
City()
- Default constructor.
-
City(Area)
- This is the normally used contructor.
-
City(Area, String)
- Use this contructor if you know both where to put the city
and what to name it.
-
City(String)
- Constructor to make a City from a form
do not use for creating new Citys
-
attack()
-
-
colonize(Area[][])
- This method is used when a city grows beyond its capacity
-
conquer(short)
- Call when a city is conquered, takes as argument the conquering players name.
-
defence()
-
-
getArea(Area[][])
- Given a map, the area in which the city is situated is returned.
-
getName()
-
-
getOwner()
-
-
incDef(int)
- use to alter defence value
-
incDev(int)
- use to alter development value
-
increasePopulation()
- Use each turn so the cities grow.
-
increasePopulation(int)
- Use to alter population
-
isHomeCity(Playerinfo[])
-
-
main(String[])
- USe for test only
-
noOwner()
-
-
setOwner(int)
- Set a new current owner.
-
tax()
- Use to collect tax and check Uprising
-
Toform()
- Use to get a form to pass through sockets from a City
-
toString()
-
-
tuneValues()
- use to correct eventual malformed values
City
public City()
- Default constructor. Do NOT use!
City
public City(Area a)
- This is the normally used contructor.
City
public City(Area a,
String name)
- Use this contructor if you know both where to put the city
and what to name it.
City
public City(String str)
- Constructor to make a City from a form
do not use for creating new Citys
getName
public String getName()
attack
public int attack()
- Returns:
- the attackvalue of the city
defence
public int defence()
- Returns:
- the defencevalue of the city
tax
public int tax()
- Use to collect tax and check Uprising
increasePopulation
public void increasePopulation()
- Use each turn so the cities grow.
increasePopulation
public void increasePopulation(int ppl)
- Use to alter population
conquer
public void conquer(short playernumber)
- Call when a city is conquered, takes as argument the conquering players name.
isHomeCity
public boolean isHomeCity(Playerinfo players[])
- Returns:
- s true if the city is someones HomeCity
incDef
public void incDef(int x)
- use to alter defence value
incDev
public void incDev(int x)
- use to alter development value
tuneValues
public void tuneValues()
- use to correct eventual malformed values
Toform
public String Toform()
- Use to get a form to pass through sockets from a City
getOwner
public int getOwner()
- Returns:
- The nr of the owner of this city.
noOwner
public boolean noOwner()
- Returns:
- true if no player owns the city
setOwner
public void setOwner(int own)
- Set a new current owner.
getArea
public Area getArea(Area map[][])
- Given a map, the area in which the city is situated is returned.
colonize
public City colonize(Area map[][])
- This method is used when a city grows beyond its capacity
toString
public String toString()
- Overrides:
- toString in class Object
main
public static void main(String args[])
- USe for test only