OGS Java API Spec

ogs.core
Class Entity

java.lang.Object
  |
  +--ogs.support.Object
        |
        +--ogs.core.Entity
All Implemented Interfaces:
EventListener
Direct Known Subclasses:
Creature, Item

public class Entity
extends Object

An object that exists in the game world. The Entity class is an abstract class that contains attributes and operations common to all entities.


Field Summary
protected  int currentHealth
           
protected  Defense defense
           
protected  int maximumHealth
           
protected  Size size
           
protected  double weight
           
 
Fields inherited from class ogs.support.Object
listeners
 
Constructor Summary
protected Entity()
          Create a new entity.
 
Method Summary
 int getCurrentHealth()
          Determine the current health (also known as hit points) of this entity.
 Defense getDefense()
          Determine the current defense rating of this entity.
 int getMaximumHealth()
          Determine the maximum health of this entity.
 Size getSize()
          Determine the current size category of this entity.
 double getWeight()
          Determine the current weight of this entity.
 void setCurrentHealth(int health)
          Change the current health of this entity.
 void setMaximumHealth(int health)
          Change the maximum health of this entity.
 void setWeight(double weight)
          Change the current weight of this entity.
 
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

weight

protected double weight

size

protected Size size

defense

protected Defense defense

currentHealth

protected int currentHealth

maximumHealth

protected int maximumHealth
Constructor Detail

Entity

protected Entity()
Create a new entity. This constructor is protected so only derived classes can call it. It initializes weight and health attributes to zero (0), size to medium, defense to base (10), with no features. The size modifier is automatically added to defense. So any change in size will automatically be reflected in the defense.

Method Detail

getWeight

public double getWeight()
Determine the current weight of this entity. Units for weight are locale dependent.

Returns:
current weight

setWeight

public void setWeight(double weight)
Change the current weight of this entity. Units for weight are locale dependent.


getSize

public Size getSize()
Determine the current size category of this entity.

Returns:
current size category

getDefense

public Defense getDefense()
Determine the current defense rating of this entity.

Returns:
current defense rating

getCurrentHealth

public int getCurrentHealth()
Determine the current health (also known as hit points) of this entity.

Returns:
current health

setCurrentHealth

public void setCurrentHealth(int health)
Change the current health of this entity. If the health is greater than the maximum health, the current health is set to the maximum health.

Parameters:
health - current health

getMaximumHealth

public int getMaximumHealth()
Determine the maximum health of this entity.

Returns:
maximum health

setMaximumHealth

public void setMaximumHealth(int health)
Change the maximum health of this entity.

Parameters:
health - maximum health

OGS Java API Spec