org.starhope.appius.game.inventory.effects
Class Shovel

java.lang.Object
  extended by org.starhope.appius.game.inventory.ItemEffects
      extended by org.starhope.appius.game.inventory.effects.Shovel

public class Shovel
extends ItemEffects

The stock item of many games: The Shovel. It's possible that someone might want to override this, but unlike the Simple* classes in this package, it's actually fairly reasonable to assign this effect directly to an item.

Here's how it works: the Shovel will look at the event spaces defined for the room. If there's are $earth/* spaces defined (spaces whose names begin with “evt_$earth/”), it will permit digging in those areas. The player can then attempt to dig a hole. There are settings for the digging Action, whether the digging Action requires specific facings, and what sort of particle is dropped to represent a hole, as well as that particle's lifetime (so holes can auto-refill over time). Digging where there is already a hole will refill and remove it.

To bury an item, a room variable is set named “evt_$earth/item” with the InventoryItem slot# of the buried item. Note that the inventory item will be owned by User ID #1 when buried. If a player digs at the given spot, they will pick up the item and receive the usual “earning” message identifying it. The room variable will also be removed, so only one user can retrieve the item.

An option to actually bury an item as an user has not been designed yet.

Author:
brpocock@star-hope.org

Field Summary
private  String digAction
          WRITEME: Document this brpocock@star-hope.org
private  Set<String> digFacings
          WRITEME: Document this brpocock@star-hope.org
private  String fillAction
          WRITEME: Document this brpocock@star-hope.org
private  String getItemAction
          WRITEME: Document this brpocock@star-hope.org
 
Fields inherited from class org.starhope.appius.game.inventory.ItemEffects
item
 
Constructor Summary
Shovel(InventoryItem theItem)
           
 
Method Summary
 void addDigFacing(String facing)
           
 String getDigAction()
           
 Set<String> getDigFacings()
           
 String getFillAction()
           
 String getGetItemAction()
           
 void removeDigFacing(String facing)
           
 void setDigAction(String newDigAction)
           
 void setFillAction(String newFillAction)
           
 void setGetItemAction(String newGetItemAction)
           
 void use(String targetName, Coord3D targetCoords)
          The item is being used.
 
Methods inherited from class org.starhope.appius.game.inventory.ItemEffects
alter, canSwim, conflicts, considerAsVehicle, forItem, getDefenseGeometric, getDefenseLinear, getItem, isFloatingVehicle, isMountedAnimal, isWheeledVehicle, notifyEquipment, onDeEquip, onEquip, takeDamage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

digFacings

private final Set<String> digFacings
WRITEME: Document this brpocock@star-hope.org


digAction

private String digAction
WRITEME: Document this brpocock@star-hope.org


fillAction

private String fillAction
WRITEME: Document this brpocock@star-hope.org


getItemAction

private String getItemAction
WRITEME: Document this brpocock@star-hope.org

Constructor Detail

Shovel

public Shovel(InventoryItem theItem)
Parameters:
theItem - the item to be a shovel
Method Detail

addDigFacing

public void addDigFacing(String facing)
Parameters:
facing - the facing to be allowed when digging

getDigAction

public String getDigAction()
Returns:
the digAction

getDigFacings

public Set<String> getDigFacings()
Returns:
the digFacings

getFillAction

public String getFillAction()
Returns:
the fillAction

getGetItemAction

public String getGetItemAction()
Returns:
the getItemAction

removeDigFacing

public void removeDigFacing(String facing)
Parameters:
facing - the facing to be removed from digging

setDigAction

public void setDigAction(String newDigAction)
Parameters:
newDigAction - the digAction to set

setFillAction

public void setFillAction(String newFillAction)
Parameters:
newFillAction - the fillAction to set

setGetItemAction

public void setGetItemAction(String newGetItemAction)
Parameters:
newGetItemAction - the getItemAction to set

use

public void use(String targetName,
                Coord3D targetCoords)
Description copied from class: ItemEffects
The item is being used. The optional target name and/or target coördinates may be provided.

Overrides:
use in class ItemEffects
Parameters:
targetName - a named object in the room against which the item is to be used
targetCoords - the coördinates in the room against which the item is to be used.
See Also:
ItemEffects.use(java.lang.String, org.starhope.appius.geometry.Coord3D)