Item

Item

Base class for all item types.

Items can be picked up, carried, used, thrown, and fired. They do not block movement into a cell. All callbacks are no-ops by default.

Constructor

new Item()

Source:

Methods

getDefiniteNoun()

Description:
  • Return a phrase with the item name using a definite article (e.g., "the sword").

Source:

getIndefiniteNoun()

Description:
  • Return a phrase with the item name using an indefinite article (e.g., "a sword").

Source:

onDeselect()

Description:
  • This item is about to be deselected. Cancel event to prevent deselection.

Source:

onDrop()

Description:
  • This item is about to be dropped. Cancel event to prevent the drop.

Source:

onFire()

Description:
  • The player is firing this item (ranged weapon). Return the ammunition piece to launch, or null if unable to fire. Cancel event to abort firing.

Source:

onHit()

Description:
  • This item has struck an agent (thrown or wielded).

Source:

onSelect()

Description:
  • This item was selected in the player's inventory.

Source:

onSteppedOn()

Description:
  • An agent has stepped onto the same cell as this item.

Source:

onThrow()

Description:
  • The player is about to throw this item. Cancel event to prevent the throw.

Source:

onThrowEnd()

Description:
  • This item, having been thrown, has landed at the given cell. Cancel event to make the item disappear instead of landing.

Source:

onUse()

Description:
  • The player used this item without specifying a direction. Cancel event with a message if the item requires a direction.

Source: