An Item with which the Player can interact.

In order for an Item to have any function, a developer must override the onInvoke method, the onObtain method or both.

Each Item has two properties: obtainable and obtainableEver to represent different types of Items.

An Item that is obtainable is also obtainableEver and is able to be put into the Player’s inventory.

An Item that is not obtainable, but is obtainableEver implies that this Item needs to be unlocked in some way to be put into the inventory.

An Item that is not obtainableEver implies that it is also not obtainable and can never be put into the Player’s inventory but can still be activated through the Use command. i.e. A switch on a wall.

extends:
WObject

implements:
InvokableItem

package: constructs;

Contents

Constructors

Item(String name, String description)

Creates a new Item with the given name and description

Methods

boolean isObtainable()

Returns true if this object is able to be put into the Player’s inventory; false otherwise.

Defaut is true;

boolean isObtainabeEver()

Returns true if this object can ever be put into the Player’s inventory; false otherwise.

Default is true;

void setObtainable(boolean val)

Set if this item can be obtained by the Player.

void setObtainableEver(boolean val)

Set if this item can EVER be obtained.

void onInvoke(Player p, Map m)

Called when a Player performs the Use command on this Item to activate it.

Implemented from InvokableItem.

void onObtain(Player p, Map m)

Called when a Player tries to use the Get command on this Item.

Implemented from InvokableItem