obj
Class Entity

java.lang.Object
  extended by obj.Entity
Direct Known Subclasses:
Character, Exit, Item, NPC, Room

public class Entity
extends java.lang.Object


Constructor Summary
Entity()
          Default blank constructor.
Entity(java.lang.String name, java.lang.String description)
          Constructor, missing identifiers and roomDesc.
Entity(java.lang.String name, java.lang.String[] identifiers, java.lang.String description, java.lang.String roomDescription)
          Full constructor.
Entity(java.lang.String name, java.lang.String description, java.lang.String roomDescription)
          Constructor, missing identifiers.
Entity(java.lang.String name, java.lang.String identifier, java.lang.String description, java.lang.String roomDescription)
          Alternative full constructor, but instead of taking an array of identifiers, takes a single identifier.
 
Method Summary
 void addIdentifier(java.lang.String ident)
          Adds an identifier to the entity.
 void addIdentifiers(java.lang.String[] ident)
          Adds a list of identifiers to the entity.
 java.lang.String getDesc()
           
 java.lang.String getName()
           
 java.lang.String getRoomDesc()
           
 boolean hasIdentifier(java.lang.String name)
           
 void makeInvisible()
          Makes the object invisible to the player.
 void makeVisible()
          Makes the object visible to the player.
 void setDesc(java.lang.String description)
          Sets object's description, which is printed when the object is examined.
 void setIdentifiers(java.lang.String[] ident)
          Sets the identifiers for the entity.
 void setName(java.lang.String name)
          Sets the object's name.
 void setRoomDesc(java.lang.String roomDescription)
          Sets the room description.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Entity

public Entity()
Default blank constructor.


Entity

public Entity(java.lang.String name,
              java.lang.String[] identifiers,
              java.lang.String description,
              java.lang.String roomDescription)
Full constructor.


Entity

public Entity(java.lang.String name,
              java.lang.String identifier,
              java.lang.String description,
              java.lang.String roomDescription)
Alternative full constructor, but instead of taking an array of identifiers, takes a single identifier.


Entity

public Entity(java.lang.String name,
              java.lang.String description,
              java.lang.String roomDescription)
Constructor, missing identifiers.


Entity

public Entity(java.lang.String name,
              java.lang.String description)
Constructor, missing identifiers and roomDesc.

Method Detail

setName

public void setName(java.lang.String name)
Sets the object's name.


getName

public java.lang.String getName()
Returns:
object's Name (in all lowercase).

setDesc

public void setDesc(java.lang.String description)
Sets object's description, which is printed when the object is examined.


getDesc

public java.lang.String getDesc()
Returns:
object's description.

setRoomDesc

public void setRoomDesc(java.lang.String roomDescription)
Sets the room description. The room description is what is printed when the player uses the Look command in the room. Instead of printing a list of items, or NPC'S (You see the following items: x, y, and z.) this will make things read a little more like a story. The room description should be something like "You see a sad man leaning against the wall in the corner of the room." or "There's a matchbox on the table."


getRoomDesc

public java.lang.String getRoomDesc()
Returns:
object's room description.

makeVisible

public void makeVisible()
Makes the object visible to the player. If the object is already visible, nothing changes.


makeInvisible

public void makeInvisible()
Makes the object invisible to the player. If the object is already invisible, nothing changes.


setIdentifiers

public void setIdentifiers(java.lang.String[] ident)
Sets the identifiers for the entity. Identifiers are another way of getting access to an entity. For example, you might have an NPC with the identifiers John, and man. They both will give you access to the same object. If the game first introduces the player to the NPC only as man, they obviously won't know that the man's name is John. Therefore, they need a way to interact with the character without knowing the character's name. For example, examine man. Identifiers to the rescue!


addIdentifier

public void addIdentifier(java.lang.String ident)
Adds an identifier to the entity.


addIdentifiers

public void addIdentifiers(java.lang.String[] ident)
Adds a list of identifiers to the entity.


hasIdentifier

public boolean hasIdentifier(java.lang.String name)
Returns:
Returns true if the Entity has the identifier specified, false if it doesn't.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
object's description.