|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmegamek.common.Building
public class Building
This class represents a single, possibly multi-hex building on the board.
| Nested Class Summary | |
|---|---|
class |
Building.DemolitionCharge
|
| Field Summary | |
|---|---|
static int |
FORTRESS
|
static int |
GUN_EMPLACEMENT
|
static int |
HANGAR
|
static int |
HARDENED
|
static int |
HEAVY
|
static int |
LIGHT
Various construction types. |
static int |
MEDIUM
|
static int |
STANDARD
Various building types |
protected static int |
UNKNOWN
Generic flag for uninitialized values. |
static int |
WALL
|
| Constructor Summary | |
|---|---|
Building(Coords coords,
IBoard board,
int structureType)
Construct a building for the given coordinates from the board's information. |
|
Building(int bldgClass,
int type,
int id,
java.lang.String name,
java.util.Vector<Coords> coords)
Creates a new building of the specified type, name, ID, and coordinates. |
|
| Method Summary | |
|---|---|
void |
addDemolitionCharge(int playerId,
int damage)
|
boolean |
equals(java.lang.Object other)
Override Object#equals(Object). |
int |
getAbsorbtion(Coords pos)
|
int |
getArmor(Coords coords)
|
int |
getBldgClass()
Get the building class, per TacOps rules. |
int |
getCollapsedHexCount()
|
java.util.Enumeration<Coords> |
getCoords()
Get the coordinates that the building occupies. |
int |
getCurrentCF(Coords coords)
Get the current construction factor of the building hex at the passed coords. |
double |
getDamageFromScale()
|
double |
getDamageToScale()
|
static int |
getDefaultCF(int type)
Get the default construction factor for the given type of building. |
int |
getId()
Get the ID of this building. |
java.lang.String |
getName()
Get the name of this building. |
int |
getOriginalHexCount()
|
int |
getPhaseCF(Coords coords)
Get the construction factor of the building hex at the passed coords at the start of the current phase. |
int |
getType()
Get the construction type of the building. |
boolean |
hasCFIn(Coords coords)
Determins if the coord exist in the currentCF has. |
protected void |
include(Coords coords,
IBoard board,
int structureType)
Update this building to include the new hex (and all hexes off the new hex, which aren't already included). |
boolean |
isBurning(Coords coords)
Determine if this building is on fire. |
boolean |
isIn(Coords coords)
Determine if the building occupies given coordinates. |
void |
removeHex(Coords coords)
Remove one building hex from the building |
void |
setArmor(int a,
Coords coords)
|
void |
setBurning(boolean onFire,
Coords coords)
Set the flag that indicates that this building is on fire. |
void |
setCurrentCF(int cf,
Coords coords)
Set the current construction factor of the building hex. |
void |
setPhaseCF(int cf,
Coords coords)
Set the construction factor of the building hex for the start of the next phase. |
java.lang.String |
toString()
Get a String for this building. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int UNKNOWN
public static final int LIGHT
public static final int MEDIUM
public static final int HEAVY
public static final int HARDENED
public static final int WALL
public static final int STANDARD
public static final int HANGAR
public static final int FORTRESS
public static final int GUN_EMPLACEMENT
| Constructor Detail |
|---|
public Building(Coords coords,
IBoard board,
int structureType)
coords - - the Coords of a hex of the building. If
the building covers multiple hexes, this constructor will
include them all in this building automatically.board - - the game's Board object.
an - IllegalArgumentException will be thrown if
the given coordinates do not contain a building, or if the
building covers multiple hexes with different CFs.
public Building(int bldgClass,
int type,
int id,
java.lang.String name,
java.util.Vector<Coords> coords)
type - The int type of the building.id - The int ID of this building.name - The String name of this building.coords - The Vector of Coords
for this building. This object is used directly
without being copied.
- Throws:
an - IllegalArgumentException will be thrown if
the given coordinates do not contain a building, or if the
building covers multiple hexes with different CFs.| Method Detail |
|---|
protected void include(Coords coords,
IBoard board,
int structureType)
coords - - the Coords of the new hex.board - - the game's IBoard object.
an - IllegalArgumentException will be thrown if
the given coordinates do not contain a building, or if the
building covers multiple hexes with different CF.public int getId()
int ID of the building.public boolean isIn(Coords coords)
coords - - the Coords being examined.
true if the building occupies the coordinates.
false otherwise.public boolean hasCFIn(Coords coords)
coords - - the Coords being examined.
true if the building has CF at the coordinates.
false otherwise.public java.util.Enumeration<Coords> getCoords()
Enumeration of the Coord
objects.public int getType()
int code of the building's construction type.public int getBldgClass()
int code of the building's classification.public int getCurrentCF(Coords coords)
coords - - the Coords> of the hex in question
- Returns:
- the
int value of the building hex's current
construction factor. This value will be greater than or equal to
zero. public int getPhaseCF(Coords coords)
coords - - the Coords> of the hex in question
- Returns:
- the
int value of the building's construction
factor at the start of this phase. This value will be greater
than or equal to zero. public int getArmor(Coords coords)
public void setCurrentCF(int cf,
Coords coords)
coords - - the Coords> of the hex in questioncf - - the int value of the building hex's current
construction factor. This value must be greater than or equal
to zero.
- Throws:
If - the passed value is less than zero, an
IllegalArgumentException is thrown.
public void setPhaseCF(int cf,
Coords coords)
coords - - the Coords> of the hex in questioncf - - the int value of the building's current
construction factor. This value must be greater than or equal
to zero.
- Throws:
If - the passed value is less than zero, an
IllegalArgumentException is thrown.
public void setArmor(int a,
Coords coords)
public java.lang.String getName()
String name of this building.public static int getDefaultCF(int type)
type - - the int construction type of the building.
int default construction factor for that type
of building. If a bad type value is passed, the constant
Building.UNKNOWN will be returned instead.public boolean equals(java.lang.Object other)
Object#equals(Object).
equals in class java.lang.Objectother - - the other Object to compare to this
Building.
true if the other object is the same as this
Building. The value false will be
returned if the other object is null, is not a
Buildig, or if it is not the same as this
Building.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isBurning(Coords coords)
true if the building is on fire.
public void setBurning(boolean onFire,
Coords coords)
onFire - - a boolean value that indicates whether
this building is on fire.
public void addDemolitionCharge(int playerId,
int damage)
public void removeHex(Coords coords)
coords - - the Coords of the hex to be removedpublic int getOriginalHexCount()
public int getCollapsedHexCount()
public double getDamageFromScale()
public double getDamageToScale()
public int getAbsorbtion(Coords pos)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||