wyvern.lib.properties
Class MonsterReactions

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.lib.properties.ProximityProperty
          extended bywyvern.lib.properties.MonsterReactions
All Implemented Interfaces:
AddRemoveNotify, java.util.EventListener, MapChangeListener, MutableProperty, PropertyList, ProximityCallback

public class MonsterReactions
extends ProximityProperty
implements ProximityCallback

Allows a monster to react under certain circumstances. For instance, if the monster is an elf, and sees you kill another elf, it can hate you (i.e. attack you.)

Version:
1.0, Aug 12, 2002
Author:
ron

Field Summary
 
Fields inherited from class wyvern.kernel.properties.PList
readOnly_
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Constructor Summary
MonsterReactions()
           
 
Method Summary
 boolean checkForAnyProp(PList agent, java.util.List props)
          Check the PList to see if it has any of the props set.
 StringList getDefenderProps()
          We're interested in defenders with these props.
 java.lang.String[] getHookNames()
           
 StringList getOKAggressorProps()
          Returns properties that it's OK for the aggressor to have (i.e. the aggressor with these won't trigger the reaction).
 Rectangle getProximityRect()
          Read the number of squares of interest out of the prop and change it too a rectangle
 void hookEvent(java.lang.String hookName, GameObject target, CommandEvent data)
          Callback for prehooks.
static void main(java.lang.String[] args)
           
 boolean noticed()
          returns true if we notice the event, based on a random number at the time of the call and the notice-chance property
 void processDamageHook(GameObject defender, Commandable aggressor, Monster observer)
          Something is being damaged.
 void react(GameObject defender, Commandable aggressor, Monster observer)
          We have determined we want to react.
 java.lang.String toString()
          Prints debugging info.
 
Methods inherited from class wyvern.lib.properties.ProximityProperty
createClone, getTarget, notifyAdd, notifyRemove, targetEnteredMap, targetLeftMap
 
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
 

Constructor Detail

MonsterReactions

public MonsterReactions()
Method Detail

getProximityRect

public Rectangle getProximityRect()
Read the number of squares of interest out of the prop and change it too a rectangle

Specified by:
getProximityRect in class ProximityProperty

getHookNames

public java.lang.String[] getHookNames()
Specified by:
getHookNames in class ProximityProperty

hookEvent

public void hookEvent(java.lang.String hookName,
                      GameObject target,
                      CommandEvent data)
Callback for prehooks.

Specified by:
hookEvent in interface ProximityCallback
Specified by:
hookEvent in class ProximityProperty

noticed

public boolean noticed()
returns true if we notice the event, based on a random number at the time of the call and the notice-chance property


processDamageHook

public void processDamageHook(GameObject defender,
                              Commandable aggressor,
                              Monster observer)
Something is being damaged. Check if it's something we care about.


react

public void react(GameObject defender,
                  Commandable aggressor,
                  Monster observer)
We have determined we want to react. Do the reaction here.


checkForAnyProp

public boolean checkForAnyProp(PList agent,
                               java.util.List props)
Check the PList to see if it has any of the props set.


getDefenderProps

public StringList getDefenderProps()
We're interested in defenders with these props.


getOKAggressorProps

public StringList getOKAggressorProps()
Returns properties that it's OK for the aggressor to have (i.e. the aggressor with these won't trigger the reaction).


toString

public java.lang.String toString()
Prints debugging info.

Overrides:
toString in class PList
Returns:
a debugging string

main

public static void main(java.lang.String[] args)