wyvern.kernel.combat
Class DamageEvent

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

public class DamageEvent
extends TargetedEvent

The standard CommandEvent generated when someone (or something) takes damage. Note that it's usually enqueued in the attacker's queue, not the defender's queue, although that isn't always the case.

Version:
1.0, Jan 13, 2004
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
DamageEvent()
           
 
Method Summary
 java.lang.String getAttackerMessage()
          Returns message to print to attacker
 int[] getDamageAmounts()
          Returns array of damage amounts done
 DamageType[] getDamageTypes()
          Returns damage types involved in the event
 java.lang.String getDefenderMessage()
          Returns message to print to defender
 BodyPart getHitLocation()
          Returns the body part where the damage is occurring.
 int getTotalDamage()
          Returns total damage done in the event
 java.lang.Object getWeapon()
          Returns the weapon or attack used to produce the damage
 boolean hasHitLocation()
          Returns true if the event has a hit location.
 boolean hasWeapon()
          Returns true if there was a weapon for this event.
 void setAttackerMessage(java.lang.String msg)
          Sets message to print to attacker
 void setDamageAmounts(int[] damageAmounts)
          Sets array of damage amounts done
 void setDamageTypes(DamageType[] damageTypes)
          Sets damage types involved
 void setDefenderMessage(java.lang.String msg)
          Sets message to print to defender
 void setHitLocation(BodyPart hitloc)
          Sets the body part where the damage is taking place.
 void setTotalDamage(int totalDamage)
          Sets total damage done in the event
 void setWeapon(java.lang.Object weapon)
          Sets the weapon or attack used to produce the damage
 java.lang.String toString()
          Returns a string representation of this PropertyList.
 
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, 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

DamageEvent

public DamageEvent()
Method Detail

hasHitLocation

public boolean hasHitLocation()
Returns true if the event has a hit location.

Returns:
getHitLocation() != null

setHitLocation

public void setHitLocation(BodyPart hitloc)
Sets the body part where the damage is taking place.


getHitLocation

public BodyPart getHitLocation()
Returns the body part where the damage is occurring.

Returns:
the body-part on the defender where the damage took place, or null if it's just "general damage"

hasWeapon

public boolean hasWeapon()
Returns true if there was a weapon for this event.

Returns:
getWeapon() != null

getWeapon

public java.lang.Object getWeapon()
Returns the weapon or attack used to produce the damage

Returns:
the weapon (can be null) - either a wyvern.lib.Attack, or a wyvern.lib.GameObject.

setWeapon

public void setWeapon(java.lang.Object weapon)
Sets the weapon or attack used to produce the damage

Parameters:
weapon - the weapon or attack used to produce the damage (a wyvern.lib.Attack or wyvern.lib.GameObject)

getDamageAmounts

public int[] getDamageAmounts()
Returns array of damage amounts done

Returns:
array of damage amounts done

setDamageAmounts

public void setDamageAmounts(int[] damageAmounts)
Sets array of damage amounts done

Parameters:
damageAmounts - array of damage amounts done

getDamageTypes

public DamageType[] getDamageTypes()
Returns damage types involved in the event

Returns:
damage types involved

setDamageTypes

public void setDamageTypes(DamageType[] damageTypes)
Sets damage types involved

Parameters:
damageTypes - damage types involved

getTotalDamage

public int getTotalDamage()
Returns total damage done in the event

Returns:
total damage done in the event

setTotalDamage

public void setTotalDamage(int totalDamage)
Sets total damage done in the event

Parameters:
totalDamage - total damage done in the event

getAttackerMessage

public java.lang.String getAttackerMessage()
Returns message to print to attacker

Returns:
message to print to attacker, or null if attacker doesn't hear about it

setAttackerMessage

public void setAttackerMessage(java.lang.String msg)
Sets message to print to attacker

Parameters:
msg - message to print to attacker, or null if attacker shouldn't hear anything

getDefenderMessage

public java.lang.String getDefenderMessage()
Returns message to print to defender

Returns:
message to print to defender

setDefenderMessage

public void setDefenderMessage(java.lang.String msg)
Sets message to print to defender

Parameters:
msg - message to print to defender, or null if defender shouldn't hear anything

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