All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sso.GameObject

java.lang.Object
   |
   +----sso.Persistant
           |
           +----sso.GameObject

public class GameObject
extends Persistant
implements ActionEventListener

Variable Index

 o actions
 o contents
 o DEAD
 o description
 o EAST
 o effects
 o facing
 o FACING_DIR_COUNT
 o FACING_MOD_COUNT
 o flags
 o graphic
 o LIE
 o location
 o moveListeners
 o name
 o NORTH
 o propertyChangeListeners
 o resistances
 o RUN
 o SIT
 o SOUTH
 o STAND
 o WALK
 o WEST

Constructor Index

 o GameObject()
Constructor.

Method Index

 o accept(GameObject)
Return true if this object can accept the spec.
 o addAction(String)
Add an action.
 o addEffect(Effect)
Add an effect.
 o addMoveListener(MoveListener)
Add move event listener.
 o addPropertyChangeListener(PropertyChangeListener)
Add a property changed event listener.
 o addResistance(Resistance)
Add a resistance to this.
 o createGameObject()
Factory method.
 o createRows()
Create the rows needed to store this object.
 o getActions()
Get the list of actions this Object can handle.
 o getContents()
Get the contents of the GameObject.
 o getDescription()
Get the description of the GameObject.
 o getEffects()
Get the list of effects in place on the GameObject.
 o getEffectsByType(String)
Get a list of effects of a particular effect type.
 o getFacing()
Get the Facing for this GameObject.
 o getFlags()
Get the int representing the flags.
 o getGraphic()
Get the Graphic for this GameObject.
 o getLocation()
Get the current location.
 o getName()
Get the name of the GameObject.
 o getResistance(int)
Get a resistance (total) for a given resistance type.
 o getResistances()
Get resistances.
 o getX()
Get the X location of this object.
 o getY()
Get the Y location of this object.
 o getZ()
Get the Z location of this object.
 o give(GameObject)
Actually place the spec in this object's inventory.
 o handleAction(String)
Handle an action.
 o handleActionEvent(ActionEvent)
Handle action events Subclasses provide more specialized behavior.
 o has(GameObject)
Returns true is GameObject in this or any of contents.
 o init()
For creating new instances of this object only.
 o load()
Loads the object from the database.
 o loadGameObject(int)
Load the object from the database.
 o main(String[])
Tester
 o move(GameObject)
Move to another location.
 o moved(GameObject)
Fire move event.
 o propChanged(String)
Fire a property change event.
 o removeAction(String)
Remove an action.
 o removeEffect(Effect)
Remove an effect.
 o removeMoveListener(MoveListener)
Remove move event listener.
 o removePropertyChangeListener(PropertyChangeListener)
Remove a property change event listener.
 o removeResistance(Resistance)
Remove a resistance from this.
 o setDescription(String)
Set the description of the GameObject.
 o setFacing(int)
Set the Facing for this GameObject.
 o setFlag(int)
Toggle a flag on.
 o setGraphic(Graphic)
Set the Graphic for this GameObject.
 o setLocation(GameObject)
Move to another location.
 o setName(String)
Set the name of the GameObject.
 o store()
Store the object in the database.
 o unregister()
Unregister the GameObject from the database.
 o unsetFlag(int)
Toggle a flag off.

Variables

 o name
 protected String name
 o description
 protected String description
 o flags
 protected int flags
 o location
 protected GameObject location
 o graphic
 protected Graphic graphic
 o facing
 protected int facing
 o actions
 protected Vector actions
 o contents
 protected Vector contents
 o effects
 protected Vector effects
 o resistances
 protected Vector resistances
 o moveListeners
 protected Vector moveListeners
 o propertyChangeListeners
 protected Vector propertyChangeListeners
 o NORTH
 public static final int NORTH
 o EAST
 public static final int EAST
 o SOUTH
 public static final int SOUTH
 o WEST
 public static final int WEST
 o STAND
 public static final int STAND
 o SIT
 public static final int SIT
 o LIE
 public static final int LIE
 o DEAD
 public static final int DEAD
 o WALK
 public static final int WALK
 o RUN
 public static final int RUN
 o FACING_DIR_COUNT
 public static final int FACING_DIR_COUNT
 o FACING_MOD_COUNT
 public static final int FACING_MOD_COUNT

Constructors

 o GameObject
 protected GameObject()
Constructor. Never called directly. Use a factory method instead.

Methods

 o createGameObject
 public static GameObject createGameObject()
Factory method. Intended for new object only. For loading objects from the database, use the factory method load().

 o init
 protected void init()
For creating new instances of this object only. Called by create().

Overrides:
init in class Persistant
 o getName
 public String getName()
Get the name of the GameObject.

 o setName
 public void setName(String name)
Set the name of the GameObject.

 o getDescription
 public String getDescription()
Get the description of the GameObject.

 o setDescription
 public void setDescription(String desc)
Set the description of the GameObject.

 o getFlags
 public int getFlags()
Get the int representing the flags.

 o setFlag
 public void setFlag(int newFlag)
Toggle a flag on.

 o unsetFlag
 public void unsetFlag(int newFlag)
Toggle a flag off.

 o getLocation
 public GameObject getLocation()
Get the current location.

 o setLocation
 protected boolean setLocation(GameObject destination)
Move to another location. Returns true on success. This method should not be called directly. Rather, move(dest) should be the call for general movement of objects from one place to another. Hence, this method is protected.

 o move
 public boolean move(GameObject destination)
Move to another location. Calls setLocation(). This is the publically accesible method for moving objects and should be the one used in most cases. It will tend to be overridden by children to specialize movement rules, while setLocation() will be left alone to perform the actual movement.

 o accept
 protected boolean accept(GameObject spec)
Return true if this object can accept the spec.

 o give
 protected void give(GameObject spec)
Actually place the spec in this object's inventory. Change the spec's location property. This method should never be called directly because it bypasses the checks that may be put in place by accept(). This method should only be called by setLocation().

 o getGraphic
 public Graphic getGraphic()
Get the Graphic for this GameObject.

 o setGraphic
 public void setGraphic(Graphic g)
Set the Graphic for this GameObject.

 o getFacing
 public int getFacing()
Get the Facing for this GameObject.

 o setFacing
 public void setFacing(int facing)
Set the Facing for this GameObject.

 o getX
 public int getX()
Get the X location of this object. Should be overriden by certain children (Tile).

 o getY
 public int getY()
Get the Y location of this object. Should be overriden by certain children (Tile).

 o getZ
 public int getZ()
Get the Z location of this object. Should be overriden by certain children (Tile, PC if flying).

 o getActions
 public Vector getActions()
Get the list of actions this Object can handle.

 o addAction
 public void addAction(String action)
Add an action.

 o removeAction
 public void removeAction(String action)
Remove an action.

 o handleAction
 public void handleAction(String action)
Handle an action.

 o getContents
 public Vector getContents()
Get the contents of the GameObject.

 o getEffects
 public Vector getEffects()
Get the list of effects in place on the GameObject.

 o getEffectsByType
 public Vector getEffectsByType(String effectClass)
Get a list of effects of a particular effect type.

 o addEffect
 public void addEffect(Effect ef)
Add an effect.

 o removeEffect
 public void removeEffect(Effect ef)
Remove an effect. Intended to be called by Effect.

 o getResistances
 public Vector getResistances()
Get resistances.

 o getResistance
 public int getResistance(int resistance)
Get a resistance (total) for a given resistance type.

 o addResistance
 public void addResistance(Resistance rest)
Add a resistance to this.

 o removeResistance
 public void removeResistance(Resistance rest)
Remove a resistance from this.

 o has
 public boolean has(GameObject target)
Returns true is GameObject in this or any of contents.

 o createRows
 protected void createRows()
Create the rows needed to store this object.

Overrides:
createRows in class Persistant
 o store
 public void store()
Store the object in the database.

Overrides:
store in class Persistant
 o loadGameObject
 public static GameObject loadGameObject(int id)
Load the object from the database.

 o load
 protected void load()
Loads the object from the database. Internal method called by loadGameObject().

Overrides:
load in class Persistant
 o unregister
 public void unregister()
Unregister the GameObject from the database.

Overrides:
unregister in class Persistant
 o addMoveListener
 public void addMoveListener(MoveListener ml)
Add move event listener.

 o removeMoveListener
 public void removeMoveListener(MoveListener ml)
Remove move event listener.

 o moved
 protected void moved(GameObject from)
Fire move event.

 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener pl)
Add a property changed event listener.

 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener pl)
Remove a property change event listener.

 o propChanged
 protected void propChanged(String propertyName)
Fire a property change event.

 o handleActionEvent
 public void handleActionEvent(ActionEvent evt)
Handle action events Subclasses provide more specialized behavior.

 o main
 public static void main(String args[])
Tester


All Packages  Class Hierarchy  This Package  Previous  Next  Index