obj
Class Item
java.lang.Object
obj.Entity
obj.Item
public class Item
- extends Entity
Constructor Summary |
Item(java.lang.String name,
java.lang.String description,
java.lang.String roomDescription,
int numUses,
Command cmd)
Creates a new item. |
Methods inherited from class obj.Entity |
addIdentifier, addIdentifiers, getDesc, getName, getRoomDesc, hasIdentifier, makeInvisible, makeVisible, setDesc, setIdentifiers, setName, setRoomDesc, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Item
public Item(java.lang.String name,
java.lang.String description,
java.lang.String roomDescription,
int numUses,
Command cmd)
- Creates a new item.
setCmd
public void setCmd(Command c)
- Sets the command that the item is associated with.
setNumUses
public void setNumUses(int n)
- Sets how many times the item can be used.
getCmd
public Command getCmd()
getNumUses
public int getNumUses()
use
public void use(Player p)
- The item has a command assoicated with it.
Each instance of an item has a unique command.
This is invoked by calling this use method.
The use method is called by the Use class,
which is a general command, so that "use item"
can be called instead of the specific command
name associated with a particular item.