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

Constructor Index

 o City()
Default constructor.
 o City(Area)
This is the normally used contructor.
 o City(Area, String)
Use this contructor if you know both where to put the city and what to name it.
 o City(String)
Constructor to make a City from a form do not use for creating new Citys

Method Index

 o attack()
 o colonize(Area[][])
This method is used when a city grows beyond its capacity
 o conquer(short)
Call when a city is conquered, takes as argument the conquering players name.
 o defence()
 o getArea(Area[][])
Given a map, the area in which the city is situated is returned.
 o getName()
 o getOwner()
 o incDef(int)
use to alter defence value
 o incDev(int)
use to alter development value
 o increasePopulation()
Use each turn so the cities grow.
 o increasePopulation(int)
Use to alter population
 o isHomeCity(Playerinfo[])
 o main(String[])
USe for test only
 o noOwner()
 o setOwner(int)
Set a new current owner.
 o tax()
Use to collect tax and check Uprising
 o Toform()
Use to get a form to pass through sockets from a City
 o toString()
 o tuneValues()
use to correct eventual malformed values

Constructors

 o City
  public City()
Default constructor. Do NOT use!
 o City
  public City(Area a)
This is the normally used contructor.
 o City
  public City(Area a,
              String name)
Use this contructor if you know both where to put the city and what to name it.
 o City
  public City(String str)
Constructor to make a City from a form do not use for creating new Citys

Methods

 o getName
  public String getName()
 o attack
  public int attack()
Returns:
the attackvalue of the city
 o defence
  public int defence()
Returns:
the defencevalue of the city
 o tax
  public int tax()
Use to collect tax and check Uprising
 o increasePopulation
  public void increasePopulation()
Use each turn so the cities grow.
 o increasePopulation
  public void increasePopulation(int ppl)
Use to alter population
 o conquer
  public void conquer(short playernumber)
Call when a city is conquered, takes as argument the conquering players name.
 o isHomeCity
  public boolean isHomeCity(Playerinfo players[])
Returns:
s true if the city is someones HomeCity
 o incDef
  public void incDef(int x)
use to alter defence value
 o incDev
  public void incDev(int x)
use to alter development value
 o tuneValues
  public void tuneValues()
use to correct eventual malformed values
 o Toform
  public String Toform()
Use to get a form to pass through sockets from a City
 o getOwner
  public int getOwner()
Returns:
The nr of the owner of this city.
 o noOwner
  public boolean noOwner()
Returns:
true if no player owns the city
 o setOwner
  public void setOwner(int own)
Set a new current owner.
 o getArea
  public Area getArea(Area map[][])
Given a map, the area in which the city is situated is returned.
 o colonize
  public City colonize(Area map[][])
This method is used when a city grows beyond its capacity
 o toString
  public String toString()
Overrides:
toString in class Object
 o main
  public static void main(String args[])
USe for test only