us.asciiroth.client.items
Class AbstractItem

java.lang.Object
  extended by us.asciiroth.client.core.AbstractPiece
      extended by us.asciiroth.client.items.AbstractItem
All Implemented Interfaces:
Item, Piece
Direct Known Subclasses:
Agentray, AmmoBow, AmmoGun, AmmoParalyzer, AmmoSling, Apple, Arrow, BlueRing, Bomb, Bone, Bow, Bread, Bullet, Chalice, Chalk, CopperPill, Crowbar, Crystal, Dagger, EmptyHanded, EuclideanShard, Fish, FishingPole, GlassEye, GoldCoin, GoldenHarp, Grenade, Gun, Hammer, Head, Healer, HelmOfTheAsciiroth, KelpSmoothie, Key, Kiwi, MirrorShield, Mushroom, Parabullet, Paralyzer, PeachElixir, PoisonDart, ProteinBar, PurpleMushroom, RedRing, Rock, Scroll, SilverAnkh, Sling, SlingRock, Stoneray, Sword, TerminusEst, Weakray

public abstract class AbstractItem
extends AbstractPiece
implements Item

Abstract do-nothing implementation of an item.


Constructor Summary
AbstractItem(java.lang.String name, int flags, Color color, Symbol symbol)
          Constructor
AbstractItem(java.lang.String name, int flags, Symbol symbol)
          Constructor.
 
Method Summary
 java.lang.String getDefiniteNoun(java.lang.String phrase)
          Produce the phrase with the {0} token replaced with the name of this item using a definite article.
 java.lang.String getIndefiniteNoun(java.lang.String phrase)
          Produce the phrase with the {0} token replaced with the name of this item using an indefinite article.
 void onDeselect(Event event, Cell cell)
          Notification that the user is trying to deselect the item.
 void onDrop(Event event, Cell cell)
          Notification that the item is about to be dropped.
 Item onFire(Event event)
          If this item can fire any kind of projectile, it should return it when this method is executed.
 void onHit(Event event, Cell agentLoc, Agent agent)
          Item has touched an agent either as a result of being thrown against the agent, or as a result of the player walking into the agent while holding the item.
 void onSelect(Context context, Cell cell)
          Notification that the user is trying to select the item.
 void onSteppedOn(Event event, Cell agentLoc, Agent agent)
          Notification that an agent has entered the same square as this item.
 void onThrow(Event event, Cell cell)
          Notification that the item is about to be thrown.
 void onThrowEnd(Event event, Cell cell)
          Notification that this item, having been thrown, has fallen to the ground at the indicated cell.
 void onUse(Event event)
          The player has used the item without indicating any particular direction for use.
 
Methods inherited from class us.asciiroth.client.core.AbstractPiece
getColor, getName, getSymbol, is, not
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface us.asciiroth.client.core.Piece
getColor, getName, getSymbol, is, not
 

Constructor Detail

AbstractItem

public AbstractItem(java.lang.String name,
                    int flags,
                    Color color,
                    Symbol symbol)
Constructor

Parameters:
name -
flags -
color -
symbol -

AbstractItem

public AbstractItem(java.lang.String name,
                    int flags,
                    Symbol symbol)
Constructor.

Parameters:
name -
flags -
symbol -
Method Detail

getDefiniteNoun

public java.lang.String getDefiniteNoun(java.lang.String phrase)
Description copied from interface: Item
Produce the phrase with the {0} token replaced with the name of this item using a definite article.

Specified by:
getDefiniteNoun in interface Item

getIndefiniteNoun

public java.lang.String getIndefiniteNoun(java.lang.String phrase)
Description copied from interface: Item
Produce the phrase with the {0} token replaced with the name of this item using an indefinite article.

Specified by:
getIndefiniteNoun in interface Item

onDeselect

public void onDeselect(Event event,
                       Cell cell)
Description copied from interface: Item
Notification that the user is trying to deselect the item. Cancelling the event prevents the item from being deselected.

Specified by:
onDeselect in interface Item

onDrop

public void onDrop(Event event,
                   Cell cell)
Description copied from interface: Item
Notification that the item is about to be dropped. Cancelling the event at this time prevents the item from leaving the agent's possession (it cannot be dropped for some reason).

Specified by:
onDrop in interface Item

onFire

public Item onFire(Event event)
Description copied from interface: Item
If this item can fire any kind of projectile, it should return it when this method is executed.

Specified by:
onFire in interface Item
Returns:
an item that is the ammunition for this item when fired.

onHit

public void onHit(Event event,
                  Cell agentLoc,
                  Agent agent)
Description copied from interface: Item
Item has touched an agent either as a result of being thrown against the agent, or as a result of the player walking into the agent while holding the item. Cancelling the event within this method has no effect.

Specified by:
onHit in interface Item

onSelect

public void onSelect(Context context,
                     Cell cell)
Description copied from interface: Item
Notification that the user is trying to select the item. Cancelling the event has no effect because it creates an odd game experience, but you can undertake work in this method if the item changes the environment

Specified by:
onSelect in interface Item

onSteppedOn

public void onSteppedOn(Event event,
                        Cell agentLoc,
                        Agent agent)
Description copied from interface: Item
Notification that an agent has entered the same square as this item.

Specified by:
onSteppedOn in interface Item

onThrow

public void onThrow(Event event,
                    Cell cell)
Description copied from interface: Item
Notification that the item is about to be thrown. If the event is canceled at this time, the item will not be thrown and it stays in the possession of the agent.

Specified by:
onThrow in interface Item

onThrowEnd

public void onThrowEnd(Event event,
                       Cell cell)
Description copied from interface: Item
Notification that this item, having been thrown, has fallen to the ground at the indicated cell. If you cancel the event, the item will disappear from the board.

Specified by:
onThrowEnd in interface Item

onUse

public void onUse(Event event)
Description copied from interface: Item
The player has used the item without indicating any particular direction for use. Even if the item has no intrinsic use, it's helpful to cancel the event with a message explaining that the item requires a direction to be useful.

Specified by:
onUse in interface Item

0.7

2009 Alx Dark