wyvern.lib.spells.effects
Class Poison

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.kernel.commands.AbstractCommandable
              extended bywyvern.lib.spells.effects.Poison
All Implemented Interfaces:
Broadcaster, Commandable, Dispellable, GameObject, Hookable, HookCallback, MethodHookable, PropertyList, RemoteAudio, Timed

public class Poison
extends AbstractCommandable
implements Timed, HookCallback, Dispellable

Does gradual damage to the target until it's cured or times out.

The Poison attaches itself in the target's property list under the property name "@poison".

The class extends AbstractCommandable so it can act as the attacker, receiving messages and so on.

Version:
1.0, Nov 26, 1999
Author:
Steve Yegge

Field Summary
static int DEFAULT_DAMAGE
           
static int DEFAULT_DURATION
           
static int DEFAULT_RATE
           
 
Fields inherited from class wyvern.kernel.commands.AbstractCommandable
hookList_, queue_, started_
 
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
 
Fields inherited from interface wyvern.common.net.RemoteAudio
DEFAULT_ALERT_GAIN, DEFAULT_ALERT_REPEAT_DELAY, DEFAULT_ALERT_REPEATS, DEFAULT_GAIN, DEFAULT_REPEAT_DELAY, DEFAULT_REPEATS
 
Constructor Summary
Poison()
          Constructs a new Poison, ready to place on the specified monster.
Poison(Monster target)
          Constructs a new Poison on the specified monster.
Poison(Monster target, int duration, int damage, int rate)
          Constructs a new Poison.
 
Method Summary
 void dispel()
          Stops poisoning the target.
 int getDamage()
          Returns the amount of damage done per round.
 int getDuration()
          Retrieves the total duration for this poison.
 int getRate()
          Returns the rate (in millis) at which the poison damages the target.
 void hookEvent(java.lang.String hookName, CommandEvent event)
          If the agent dies, stop the poison.
 void poison(Monster target)
          Attaches to, and poisons, the specified target.
 void setDamage(int damage)
          Sets the amount of damage to do per round.
 void setDuration(int duration)
          Sets the duration for the poison.
 void setRate(int rate)
          Sets the rate at which the poison does damage to the target.
 void timerExpired()
          Timer went off.
 java.lang.String toString()
          Debugging string.
 
Methods inherited from class wyvern.kernel.commands.AbstractCommandable
addAttack, addHook, addMessageListener, addMethodHook, checkAnimated, command, command, commandNow, destroy, ensureAI, ensureEventQueue, fireMessageReceived, getAI, getCapName, getCombatQueue, getCommand, getEncumbrance, getFiringPoint, getHookList, getHooks, getInventory, getName, getQueue, isCommandable, isStarted, isTelnet, message, message, message, pauseSound, playAlert, playAlert, playDefaultMusic, playPriorityMusic, playPriorityMusic, playSound, playSound, registerCommand, removeAttack, removeHook, removeMessageListener, removeMethodHook, resumeSound, runFailedPostHook, runMethodHook, runPostHook, runPreHook, sendPicture, sendPicture, setAI, setEncumbrance, setMusicGain, setName, setSoundGain, start, stop, stopAllSounds, stopMusic, stopSound, unregisterCommand
 
Methods inherited from class wyvern.kernel.maps.MapObject
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, 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, getTile, getValue, getWeight, groupString, inContainer, initialize, initLocs, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, isBlessed, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, remove, removeContainerChangeListener, removeFromMap, removeMapChangeListener, removeMapMotionListener, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, 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, 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.GameObject
addContainerChangeListener, addMapChangeListener, addMapMotionListener, addMotionTracker, addObjectTracker, addPrefix, addSuffix, bless, canEnter, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, externalize, getAlpha, getAppearance, getArchetype, 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, getTile, getValue, getWeight, inContainer, initialize, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, isBlessed, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, remove, removeContainerChangeListener, removeMapChangeListener, removeMapMotionListener, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, setAlpha, setAnimated, setBitmap, setCategory, setContainer, setDirection, setImage, setImage, setLayer, setLocations, setMap, setMapLink, setQuantity, setShape, setSize, setTransientSize, setWeight, setWeight, teleport
 
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
 
Methods inherited from interface wyvern.lib.Broadcaster
broadcast, broadcast, broadcast, broadcast, broadcast
 

Field Detail

DEFAULT_DURATION

public static final int DEFAULT_DURATION
See Also:
Constant Field Values

DEFAULT_DAMAGE

public static final int DEFAULT_DAMAGE
See Also:
Constant Field Values

DEFAULT_RATE

public static final int DEFAULT_RATE
See Also:
Constant Field Values
Constructor Detail

Poison

public Poison()
Constructs a new Poison, ready to place on the specified monster.


Poison

public Poison(Monster target)
Constructs a new Poison on the specified monster.

Parameters:
target - the target to poison

Poison

public Poison(Monster target,
              int duration,
              int damage,
              int rate)
Constructs a new Poison.

Parameters:
target - the monster to poison
duration - the time (in millis) to poison the target
rate - the rate (millis) at which the timer should tick
damage - the damage to do per timer tick
Method Detail

setDuration

public void setDuration(int duration)
Sets the duration for the poison. Make sure to call this *before* calling poison(), or it'll be ignored.

Parameters:
duration - length of time to poison the target (in millis)

getDuration

public int getDuration()
Retrieves the total duration for this poison.

Returns:
the total time it'll be active

setDamage

public void setDamage(int damage)
Sets the amount of damage to do per round.

Parameters:
damage - the number of HP of damage to do each time the timer goes off

getDamage

public int getDamage()
Returns the amount of damage done per round.

Returns:
the damage amount each time the timer goes off

setRate

public void setRate(int rate)
Sets the rate at which the poison does damage to the target.

Parameters:
rate - the new poison timer rate (milliseconds)

getRate

public int getRate()
Returns the rate (in millis) at which the poison damages the target.

Returns:
the damage rate

poison

public void poison(Monster target)
Attaches to, and poisons, the specified target. Can only poison one target at a time, so if it's already paralyzing another target, it removes itself from the existing target first.

If it finds a previous @poison on the target, it dispels the old one before adding the new one.

Parameters:
target - the monster to poison

timerExpired

public void timerExpired()
Timer went off.

Specified by:
timerExpired in interface Timed

dispel

public void dispel()
Stops poisoning the target.

Specified by:
dispel in interface Dispellable

toString

public java.lang.String toString()
Debugging string.

Overrides:
toString in class MapObject
Returns:
a short String describing this object. If the object represents a group of items, such as coins, the returned description will be a modified version of the description that includes quantity information.

hookEvent

public void hookEvent(java.lang.String hookName,
                      CommandEvent event)
If the agent dies, stop the poison.

Specified by:
hookEvent in interface HookCallback
Parameters:
hookName - the name of the hook, such as "movePreHook".
event - the CommandEvent encapsulating the event parameters