wyvern.kernel.monsters
Class DeathEvent

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.commands.EventImpl
          extended bywyvern.kernel.commands.TargetedEvent
              extended bywyvern.kernel.monsters.DeathEvent
All Implemented Interfaces:
Broadcaster, Command, CommandEvent, PropertyList

public class DeathEvent
extends TargetedEvent
implements Command

Death is a special occurrence that needs to be hookable and vetoable, so we create an event for it. The event is its own handler, and is placed in the monster/player's queue. The agent is the thing being killed, and the event should always have an "attacker" property that's the thing killing the agent.

Version:
1.0, Jan 24, 2001
Author:
Steve Yegge

Field Summary
 
Fields inherited from class wyvern.kernel.commands.TargetedEvent
cloneError_, location_, quantity_, target_, targetName_
 
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
DeathEvent()
          Constructs a new DeathEvent; the agent must be set manually using setAgent().
DeathEvent(Commandable agent)
          Constructs a new DeathEvent
 
Method Summary
 CommandEvent createEvent(CommandEvent initial)
          Creates a new event.
 boolean execute(CommandEvent event)
          Executes the event, killing the agent by calling their kill() function.
 Command getHandler()
          Handle our own execution.
 void initialize()
          Sets up the parameters.
 boolean knowsCommand(java.lang.String command)
          We handle the command.
 
Methods inherited from class wyvern.kernel.commands.TargetedEvent
getCloneErrorMsg, getLocation, getQuantity, getTarget, getTargetName, hasTarget, isQuantified, isTargetSpecifiedByHashcode, setLocation, setQuantified, setQuantity, setTarget, setTargetName
 
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, 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, toString, 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

DeathEvent

public DeathEvent()
Constructs a new DeathEvent; the agent must be set manually using setAgent().


DeathEvent

public DeathEvent(Commandable agent)
Constructs a new DeathEvent

Method Detail

initialize

public void initialize()
Sets up the parameters.


getHandler

public Command getHandler()
Handle our own execution. (Hah, a pun).

Specified by:
getHandler in interface CommandEvent
Overrides:
getHandler in class EventImpl

knowsCommand

public boolean knowsCommand(java.lang.String command)
We handle the command.

Specified by:
knowsCommand in interface Command
Parameters:
command - the entire command string, including arguments
Returns:
true if we want to handle the command

createEvent

public CommandEvent createEvent(CommandEvent initial)
Creates a new event. Not normally used; usually you will create a new DeathEvent and stick it in the agent's queue.

Specified by:
createEvent in interface Command
Parameters:
initial - a "blank" CommandEvent containing only the command text and the agent who's performing the command. This initial event is created by the originator of the event (e.g. the AI or player's command preprocessor).
Returns:
a CommandEvent subclass encapsulating this command's execution parameters and state. It should copy in the fields from the passed-in event.

execute

public boolean execute(CommandEvent event)
Executes the event, killing the agent by calling their kill() function.

Specified by:
execute in interface Command
Parameters:
event - the event
Returns:
true if successful, false if the event was vetoed