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
-
actions
-
-
contents
-
-
DEAD
-
-
description
-
-
EAST
-
-
effects
-
-
facing
-
-
FACING_DIR_COUNT
-
-
FACING_MOD_COUNT
-
-
flags
-
-
graphic
-
-
LIE
-
-
location
-
-
moveListeners
-
-
name
-
-
NORTH
-
-
propertyChangeListeners
-
-
resistances
-
-
RUN
-
-
SIT
-
-
SOUTH
-
-
STAND
-
-
WALK
-
-
WEST
-
-
GameObject()
- Constructor.
-
accept(GameObject)
- Return true if this object can accept the spec.
-
addAction(String)
- Add an action.
-
addEffect(Effect)
- Add an effect.
-
addMoveListener(MoveListener)
- Add move event listener.
-
addPropertyChangeListener(PropertyChangeListener)
- Add a property changed event listener.
-
addResistance(Resistance)
- Add a resistance to this.
-
createGameObject()
- Factory method.
-
createRows()
- Create the rows needed to store this object.
-
getActions()
- Get the list of actions this Object can handle.
-
getContents()
- Get the contents of the GameObject.
-
getDescription()
- Get the description of the GameObject.
-
getEffects()
- Get the list of effects in place on the GameObject.
-
getEffectsByType(String)
- Get a list of effects of a particular effect type.
-
getFacing()
- Get the Facing for this GameObject.
-
getFlags()
- Get the int representing the flags.
-
getGraphic()
- Get the Graphic for this GameObject.
-
getLocation()
- Get the current location.
-
getName()
- Get the name of the GameObject.
-
getResistance(int)
- Get a resistance (total) for a given resistance type.
-
getResistances()
- Get resistances.
-
getX()
- Get the X location of this object.
-
getY()
- Get the Y location of this object.
-
getZ()
- Get the Z location of this object.
-
give(GameObject)
- Actually place the spec in this object's inventory.
-
handleAction(String)
- Handle an action.
-
handleActionEvent(ActionEvent)
- Handle action events
Subclasses provide more specialized behavior.
-
has(GameObject)
- Returns true is GameObject in this or any of contents.
-
init()
- For creating new instances of this object only.
-
load()
- Loads the object from the database.
-
loadGameObject(int)
- Load the object from the database.
-
main(String[])
- Tester
-
move(GameObject)
- Move to another location.
-
moved(GameObject)
- Fire move event.
-
propChanged(String)
- Fire a property change event.
-
removeAction(String)
- Remove an action.
-
removeEffect(Effect)
- Remove an effect.
-
removeMoveListener(MoveListener)
- Remove move event listener.
-
removePropertyChangeListener(PropertyChangeListener)
- Remove a property change event listener.
-
removeResistance(Resistance)
- Remove a resistance from this.
-
setDescription(String)
- Set the description of the GameObject.
-
setFacing(int)
- Set the Facing for this GameObject.
-
setFlag(int)
- Toggle a flag on.
-
setGraphic(Graphic)
- Set the Graphic for this GameObject.
-
setLocation(GameObject)
- Move to another location.
-
setName(String)
- Set the name of the GameObject.
-
store()
- Store the object in the database.
-
unregister()
- Unregister the GameObject from the database.
-
unsetFlag(int)
- Toggle a flag off.
name
protected String name
description
protected String description
flags
protected int flags
location
protected GameObject location
graphic
protected Graphic graphic
facing
protected int facing
actions
protected Vector actions
contents
protected Vector contents
effects
protected Vector effects
resistances
protected Vector resistances
moveListeners
protected Vector moveListeners
propertyChangeListeners
protected Vector propertyChangeListeners
NORTH
public static final int NORTH
EAST
public static final int EAST
SOUTH
public static final int SOUTH
WEST
public static final int WEST
STAND
public static final int STAND
SIT
public static final int SIT
LIE
public static final int LIE
DEAD
public static final int DEAD
WALK
public static final int WALK
RUN
public static final int RUN
FACING_DIR_COUNT
public static final int FACING_DIR_COUNT
FACING_MOD_COUNT
public static final int FACING_MOD_COUNT
GameObject
protected GameObject()
- Constructor. Never called directly.
Use a factory method instead.
createGameObject
public static GameObject createGameObject()
- Factory method. Intended for new object only.
For loading objects from the database, use the factory method load().
init
protected void init()
- For creating new instances of this object only.
Called by create().
- Overrides:
- init in class Persistant
getName
public String getName()
- Get the name of the GameObject.
setName
public void setName(String name)
- Set the name of the GameObject.
getDescription
public String getDescription()
- Get the description of the GameObject.
setDescription
public void setDescription(String desc)
- Set the description of the GameObject.
getFlags
public int getFlags()
- Get the int representing the flags.
setFlag
public void setFlag(int newFlag)
- Toggle a flag on.
unsetFlag
public void unsetFlag(int newFlag)
- Toggle a flag off.
getLocation
public GameObject getLocation()
- Get the current location.
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.
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.
accept
protected boolean accept(GameObject spec)
- Return true if this object can accept the spec.
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().
getGraphic
public Graphic getGraphic()
- Get the Graphic for this GameObject.
setGraphic
public void setGraphic(Graphic g)
- Set the Graphic for this GameObject.
getFacing
public int getFacing()
- Get the Facing for this GameObject.
setFacing
public void setFacing(int facing)
- Set the Facing for this GameObject.
getX
public int getX()
- Get the X location of this object.
Should be overriden by certain children (Tile).
getY
public int getY()
- Get the Y location of this object.
Should be overriden by certain children (Tile).
getZ
public int getZ()
- Get the Z location of this object.
Should be overriden by certain children (Tile, PC if flying).
getActions
public Vector getActions()
- Get the list of actions this Object can handle.
addAction
public void addAction(String action)
- Add an action.
removeAction
public void removeAction(String action)
- Remove an action.
handleAction
public void handleAction(String action)
- Handle an action.
getContents
public Vector getContents()
- Get the contents of the GameObject.
getEffects
public Vector getEffects()
- Get the list of effects in place on the GameObject.
getEffectsByType
public Vector getEffectsByType(String effectClass)
- Get a list of effects of a particular effect type.
addEffect
public void addEffect(Effect ef)
- Add an effect.
removeEffect
public void removeEffect(Effect ef)
- Remove an effect. Intended to be called by Effect.
getResistances
public Vector getResistances()
- Get resistances.
getResistance
public int getResistance(int resistance)
- Get a resistance (total) for a given resistance type.
addResistance
public void addResistance(Resistance rest)
- Add a resistance to this.
removeResistance
public void removeResistance(Resistance rest)
- Remove a resistance from this.
has
public boolean has(GameObject target)
- Returns true is GameObject in this or any of contents.
createRows
protected void createRows()
- Create the rows needed to store this object.
- Overrides:
- createRows in class Persistant
store
public void store()
- Store the object in the database.
- Overrides:
- store in class Persistant
loadGameObject
public static GameObject loadGameObject(int id)
- Load the object from the database.
load
protected void load()
- Loads the object from the database. Internal method called by
loadGameObject().
- Overrides:
- load in class Persistant
unregister
public void unregister()
- Unregister the GameObject from the database.
- Overrides:
- unregister in class Persistant
addMoveListener
public void addMoveListener(MoveListener ml)
- Add move event listener.
removeMoveListener
public void removeMoveListener(MoveListener ml)
- Remove move event listener.
moved
protected void moved(GameObject from)
- Fire move event.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener pl)
- Add a property changed event listener.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener pl)
- Remove a property change event listener.
propChanged
protected void propChanged(String propertyName)
- Fire a property change event.
handleActionEvent
public void handleActionEvent(ActionEvent evt)
- Handle action events
Subclasses provide more specialized behavior.
main
public static void main(String args[])
- Tester
All Packages Class Hierarchy This Package Previous Next Index