wyvern.lib.classes.construct
Class Water

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.lib.classes.Terrain
              extended bywyvern.lib.classes.construct.Water
All Implemented Interfaces:
Broadcaster, GameObject, MethodHookable, PropertyList, Timed, WalkNotify

public class Water
extends Terrain
implements WalkNotify, Timed

Water. Does damage to you when you're in it.

Version:
1.0, Feb 15, 2001
Author:
Steve Yegge

Nested Class Summary
 
Nested classes inherited from class wyvern.lib.classes.Terrain
Terrain.NoFlyweight
 
Field Summary
static int DEFAULT_DAMAGE
          The default wc-drown if the archetype doesn't specify one.
static int DEFAULT_DELAY
          The default timer delay if the archetype doesn't specify one.
static int DEFAULT_TERRAIN_PRIORITY
          The default terrain priority, if unspecified.
protected  java.util.HashSet players_
          Keeps track of all the players standing in water in this map.
protected  Timer timer_
          The damage timer, which goes until the monster leaves the square.
 
Fields inherited from class wyvern.lib.classes.Terrain
appearance_, hasBorders_, letsBordersIn_, letsBordersOut_, opaque_, priority_, terrainCache_
 
Fields inherited from class wyvern.kernel.maps.MapObject
IN_MAP_EDITOR, listenerList_
 
Fields inherited from class wyvern.kernel.properties.PList
readOnly_
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Constructor Summary
Water()
           
 
Method Summary
static boolean canEnter(Monster m, GameMap map, Point p)
          Checks whether a monster can enter this square normally, without drowning.
 void damageMonster(Monster m)
          Does terrain-specific damage to the monster.
 void destroy()
          Destroys the object.
 int getDelay()
          Returns the delay between damage timers.
 void initialize()
          Adds class-default properties.
 void steppedOn(Monster m)
          Notification that a monster has stepped in the square containing this object.
 void timerExpired()
          Damage timer went off.
 
Methods inherited from class wyvern.lib.classes.Terrain
getCachedTerrain, getPriority, getTile, hasBorders, isCached, isOpaque, isTerrain, letsBordersIn, letsBordersOut, setAppearance, setHasBorders, setLetsBordersIn, setLetsBordersOut, setPriority
 
Methods inherited from class wyvern.kernel.maps.MapObject
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, addMethodHook, addMotionTracker, addObjectTracker, addPrefix, addSuffix, addToMap, bless, broadcast, broadcast, broadcast, broadcast, broadcast, canEnter, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, ensureListenerList, ensureWeight, externalize, fireContainerEntered, fireContainerExited, fireEnteredMap, fireExitedMap, fireMovedInMap, getAlpha, getAppearance, getArchetype, getBaseName, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, getDamagedDescription, getDescription, getDirection, getGenderPossessive, getGenderPronoun, getImage, getImageDescriptor, getImageDescriptors, getLayer, getLocations, getMap, getMapLink, getMaterial, getMaterialDescription, getMover, getOwningPlayer, getParentMap, getPrefixes, getQuantity, getReferenceLoc, getRelativeLocs, getShortDesc, getSuffixes, getTile, getValue, getWeight, groupString, inContainer, initLocs, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, isBlessed, isCommandable, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, remove, removeContainerChangeListener, removeFromMap, removeMapChangeListener, removeMapMotionListener, removeMethodHook, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, runMethodHook, setAlpha, setAnimated, setBitmap, setCategory, setContainer, setDefaultBitmap, setDefaultCategory, setDefaultDesc, setDefaultImage, setDefaultIntProperty, setDefaultLayer, setDefaultMaterial, setDefaultProperty, setDefaultShortDesc, setDirection, setImage, setImage, setLayer, setLocations, setMap, setMapLink, setQuantity, setShape, setSize, setTransientSize, setWeight, setWeight, teleport, toString, updateMapLocation
 
Methods inherited from class wyvern.kernel.properties.PList
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, debugProperties, dismantlePropertyList, getDoubleProperty, getInheritedProperty, getInteger, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProfilingInfo, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, transientlyRemoveProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wyvern.lib.PropertyList
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, getDoubleProperty, getInheritedProperty, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, transientlyRemoveProperty
 

Field Detail

players_

protected java.util.HashSet players_
Keeps track of all the players standing in water in this map.


timer_

protected transient Timer timer_
The damage timer, which goes until the monster leaves the square.


DEFAULT_DELAY

public static final int DEFAULT_DELAY
The default timer delay if the archetype doesn't specify one.

See Also:
Constant Field Values

DEFAULT_DAMAGE

public static final int DEFAULT_DAMAGE
The default wc-drown if the archetype doesn't specify one.

See Also:
Constant Field Values

DEFAULT_TERRAIN_PRIORITY

public static final int DEFAULT_TERRAIN_PRIORITY
The default terrain priority, if unspecified.

See Also:
Constant Field Values
Constructor Detail

Water

public Water()
Method Detail

initialize

public void initialize()
Adds class-default properties.

Specified by:
initialize in interface GameObject
Overrides:
initialize in class Terrain

steppedOn

public void steppedOn(Monster m)
Notification that a monster has stepped in the square containing this object.

Specified by:
steppedOn in interface WalkNotify
Parameters:
m - the Monster who stepped into this square

timerExpired

public void timerExpired()
Damage timer went off. If the player is still there, do the damage and set another timer.

Specified by:
timerExpired in interface Timed

canEnter

public static boolean canEnter(Monster m,
                               GameMap map,
                               Point p)
Checks whether a monster can enter this square normally, without drowning.

Returns:
true if they would be OK in this square, false if they'd drown.

damageMonster

public void damageMonster(Monster m)
Does terrain-specific damage to the monster. Subclasses might implement some other kind of damage. Water uses the "wc-drown" setting from its archetype.

Parameters:
m - the Monster to damage. Uses Combat.damageMonster to do the damage.

getDelay

public int getDelay()
Returns the delay between damage timers.

Returns:
the delay, in milliseconds

destroy

public void destroy()
Destroys the object.

Specified by:
destroy in interface GameObject
Overrides:
destroy in class MapObject