|
OGS Java API Spec | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ogs.support.Object | +--ogs.core.Entity | +--ogs.core.Item
An item is a entity that can be used by a creature. An item has
various attributes that determine how much "health" it has and thus
its current condition and how hard it is to destroy. The density of
an item determines how many health points an item has per unit of
thickness. Thus, density multiplied by thickness determines the
maximum health of an item. Materials are used to specify a
predefined density. Some common materials are provided by this
class. An item made of wood for example has a density of 5.
Finally, the hardness of an item determines how resistant to damage
it is. When damage is applied to an item, the hardness is
subtracted from the damage. Thus harder items take less damage.
Note that the health of an item can be specified directly (through
Entity
operations) in spite of these attributes. These
attributes should be used in cases where specific values for health
have not been provided and approximate values are required.
An item also has worth. Worth determines how valuable an item
is usually expressed as a monetary value. Since worth is a relative
concept; the units of worth are locale-dependent.
Field Summary | |
static int |
GLASS
An item made of glass has a density of 1. |
static int |
IRON
An item made of iron has a density of 10. |
static int |
PAPER
An item made of paper has a density of 2. |
static int |
STONE
An item made of stone has a density of 8. |
static int |
UNKNOWN
Some unknown material. |
static int |
WOOD
An item made of wood has a density of 5. |
Fields inherited from class ogs.core.Entity |
currentHealth, defense, maximumHealth, size, weight |
Fields inherited from class ogs.support.Object |
listeners |
Constructor Summary | |
Item()
|
Method Summary | |
int |
getDensity()
|
byte |
getHardness()
Determine the hardness of this item. |
int |
getMaterial()
Determine the material that this item is made of. |
double |
getThickness()
Determine the thickness of this item. |
double |
getWorth()
Determine the worth of this item. |
void |
setDensity(int density)
|
void |
setHardness(byte hardness)
Change the hardness of this item. |
void |
setMaterial(int material)
Change the material that this item is made of. |
void |
setThickness(double thickness)
Change the thickness of this item. |
void |
setWorth(double worth)
Change the worth of this item. |
protected void |
updateHealthPoints()
Update the maximum health points of this item using the current thickness and density. |
Methods inherited from class ogs.core.Entity |
getCurrentHealth, getDefense, getMaximumHealth, getSize, getWeight, setCurrentHealth, setMaximumHealth, setWeight |
Methods inherited from class ogs.support.Object |
addListener, handleEvent, notifyListeners, removeListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int UNKNOWN
setDensity
operation.
public static final int PAPER
public static final int GLASS
public static final int WOOD
public static final int STONE
public static final int IRON
Constructor Detail |
public Item()
Method Detail |
public int getMaterial()
public void setMaterial(int material)
material
- Material that this item is made of.public byte getHardness()
public void setHardness(byte hardness)
hardness
- Hardness of this item.public double getThickness()
public void setThickness(double thickness)
public int getDensity()
public void setDensity(int density)
public double getWorth()
public void setWorth(double worth)
worth
- Worth of this item.protected void updateHealthPoints()
|
OGS Java API Spec | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |