wyvern.lib.commands
Class CastEvent

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.commands.EventImpl
          extended bywyvern.lib.commands.CastEvent
All Implemented Interfaces:
Broadcaster, CommandEvent, PropertyList

public class CastEvent
extends EventImpl

An event that encapsulates a player trying to cast a spell, either using the "cast" command, or using a magic item.

Version:
1.0, Nov 05, 2003
Author:
Steve Yegge

Field Summary
 
Fields inherited from class wyvern.kernel.commands.EventImpl
agent_, appendToFile_, argString_, argStringParsed_, argv_, argvParsed_, delay_, failureMessage_, filterObjects_, filters_, handler_, map_, modified_, originalText_, playerOriginated_, redirectFile_, redirecting_, sendToAgent_, successMessage_, verb_, vetoed_, wizParsed_
 
Fields inherited from class wyvern.kernel.properties.PList
readOnly_
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Constructor Summary
CastEvent()
           
CastEvent(CommandEvent e)
           
 
Method Summary
 int getCastingDelay()
          Returns the casting delay for the spell.
 int getDir()
          Returns the int dir for the spell, from parsing the direction.
 java.lang.String getDirection()
          Returns which direction the spell was cast in, if directional
 int getLoreCost()
          Returns the lore cost for the spell.
 Point getPosition()
          Returns the location the spell was cast towards, if positional
 java.lang.String getSpellArguments()
          Returns "with-args" arguments for the spell
 java.lang.String getSpellName()
          Returns user-visible name of the spell being cast, e.g.
 Spell getSpellObject()
          Returns the spell being cast
 java.lang.String getTargetName()
          Returns name of the direct target of the spell, if specified
 boolean hasSpellArguments()
          Returns whether the spell has "with-args" arguments
 boolean isBungled()
          Returns true if the spell is being bungled.
 boolean isCastList()
          Returns true if the event was "cast list".
 boolean isDirectional()
          Returns whether the user cast the spell in a given direction
 boolean isNoSpellsArea()
          Returns true if the spell is being blocked by a no-spells obj
 boolean isPositional()
          Returns whether spell was cast towards a given (x, y) target location
 boolean isTargeted()
          Returns whether the spell has a direct target
 boolean isWizTest()
          Returns true if this is a wizard casting a spell that's not in the registry.
 void setBungled(boolean bungled)
          Sets whether the spell is being bungled.
 void setDirection(java.lang.String direction)
          Sets which direction the spell was cast in, if directional
 void setDirectional(boolean directional)
          Sets whether the user cast the spell in a given direction
 void setHasSpellArguments(boolean hasArguments)
          Sets whether the spell has "with-args" arguments
 void setNoSpellsArea(boolean nospells)
          Sets true if the spell is being blocked by a no-spells area.
 void setPosition(Point position)
          Sets the location the spell was cast towards, if positional
 void setPositional(boolean positional)
          Sets whether spell was cast towards a given (x, y) target location
 void setSpellArguments(java.lang.String arguments)
          Sets "with-args" arguments for the spell
 void setSpellName(java.lang.String spellname)
          Sets user-visible name of the spell being cast, e.g.
 void setSpellObject(Spell spellObject)
          Sets the spell being cast
 void setTargeted(boolean targeted)
          Sets whether the spell has a direct target
 void setTargetName(java.lang.String targetName)
          Sets name of the direct target of the spell, if specified
 void setWizTest(boolean test)
          Flags this as a "wiz test" - they're casting a spell that's not in the registry.
 java.lang.String toString()
          Returns a string representation of this PropertyList.
 
Methods inherited from class wyvern.kernel.commands.EventImpl
broadcast, broadcast, broadcast, broadcast, broadcast, checkVeto, fail, filterMessage, findAllMatches, findByHashcode, findInMap, findNeighbor, findObject, findTarget, getAgent, getArgs, getArgString, getDelay, getFailureMessage, getFilterObjects, getFilters, getHandler, getMap, getOriginalText, getRedirectFile, getSuccessMessage, getVerb, hasArgs, isAppending, isModified, isMonster, isPlayer, isPlayerOriginated, isRedirecting, isSendingToAgent, isVetoed, isWizard, main, message, message, noArgs, parseArgString, parseARGV, parseVerb, profileParsing, redirectMessage, runPostHooks, runPreHooks, searchInv, searchInvAndMapNearby, searchInvAndMapUnder, searchInvByHashcode, searchMapNearby, searchMapUnder, searchMapUnderByHashcode, setAgent, setArgs, setDelay, setFailureMessage, setHandler, setMap, setModified, setOriginalText, setPlayerOriginated, setSuccessMessage, setVerb, setVeto, veto
 
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
 

Constructor Detail

CastEvent

public CastEvent()

CastEvent

public CastEvent(CommandEvent e)
Method Detail

getSpellName

public java.lang.String getSpellName()
Returns user-visible name of the spell being cast, e.g. "word of recall"

Returns:
user-visible name of the spell being cast

setSpellName

public void setSpellName(java.lang.String spellname)
Sets user-visible name of the spell being cast, e.g. "word of recall"

Parameters:
spellname - user-visible name of the spell being cast

isDirectional

public boolean isDirectional()
Returns whether the user cast the spell in a given direction

Returns:
whether the user cast the spell in a given direction

setDirectional

public void setDirectional(boolean directional)
Sets whether the user cast the spell in a given direction

Parameters:
directional - whether the user cast the spell in a given direction

getDirection

public java.lang.String getDirection()
Returns which direction the spell was cast in, if directional

Returns:
which direction the spell was cast in, if directional

setDirection

public void setDirection(java.lang.String direction)
Sets which direction the spell was cast in, if directional

Parameters:
direction - which direction the spell was cast in, if directional

getDir

public int getDir()
Returns the int dir for the spell, from parsing the direction.


isPositional

public boolean isPositional()
Returns whether spell was cast towards a given (x, y) target location

Returns:
whether the spell is positional

setPositional

public void setPositional(boolean positional)
Sets whether spell was cast towards a given (x, y) target location

Parameters:
positional - whether the spell is positional

getPosition

public Point getPosition()
Returns the location the spell was cast towards, if positional

Returns:
the target map location

setPosition

public void setPosition(Point position)
Sets the location the spell was cast towards, if positional

Parameters:
position - the target map location

isTargeted

public boolean isTargeted()
Returns whether the spell has a direct target

Returns:
whether the spell has a direct target

setTargeted

public void setTargeted(boolean targeted)
Sets whether the spell has a direct target

Parameters:
targeted - whether the spell has a direct target

getTargetName

public java.lang.String getTargetName()
Returns name of the direct target of the spell, if specified

Returns:
name of the direct target of the spell, e.g. "orc"

setTargetName

public void setTargetName(java.lang.String targetName)
Sets name of the direct target of the spell, if specified

Parameters:
targetName - name of the direct target of the spell, e.g. "bobby"

hasSpellArguments

public boolean hasSpellArguments()
Returns whether the spell has "with-args" arguments

Returns:
whether the spell has "with-args" arguments

setHasSpellArguments

public void setHasSpellArguments(boolean hasArguments)
Sets whether the spell has "with-args" arguments

Parameters:
hasArguments - whether the spell has "with-args" arguments

getSpellArguments

public java.lang.String getSpellArguments()
Returns "with-args" arguments for the spell

Returns:
"with-args" arguments for the spell

setSpellArguments

public void setSpellArguments(java.lang.String arguments)
Sets "with-args" arguments for the spell

Parameters:
arguments - "with-args" arguments for the spell

getSpellObject

public Spell getSpellObject()
Returns the spell being cast

Returns:
the spell being cast

setSpellObject

public void setSpellObject(Spell spellObject)
Sets the spell being cast

Parameters:
spellObject - the spell being cast

isNoSpellsArea

public boolean isNoSpellsArea()
Returns true if the spell is being blocked by a no-spells obj

Returns:
true if the spell is being blocked by a no-spells obj

setNoSpellsArea

public void setNoSpellsArea(boolean nospells)
Sets true if the spell is being blocked by a no-spells area. If you're changing this from castPreHook, make sure to set the veto appropriately as well.

Parameters:
nospells - true if the spell is being blocked by a no-spells obj

isBungled

public boolean isBungled()
Returns true if the spell is being bungled.

Returns:
true if it'll be bungled.

setBungled

public void setBungled(boolean bungled)
Sets whether the spell is being bungled. If you're calling this from castPreHook, you also have to clear the veto.


isCastList

public boolean isCastList()
Returns true if the event was "cast list".

Returns:
true if the event has args, and the args were "list"

getCastingDelay

public int getCastingDelay()
Returns the casting delay for the spell.

Returns:
the delay, in milliseconds, to wait after casting it

getLoreCost

public int getLoreCost()
Returns the lore cost for the spell.

Returns:
the the lore level

setWizTest

public void setWizTest(boolean test)
Flags this as a "wiz test" - they're casting a spell that's not in the registry.


isWizTest

public boolean isWizTest()
Returns true if this is a wizard casting a spell that's not in the registry.


toString

public java.lang.String toString()
Description copied from class: PList
Returns a string representation of this PropertyList. Doesn't include any inherited properties. Uses transient values of properties - for int properties, adds transient value (if any) to persistent value before printing it.

Overrides:
toString in class EventImpl