wyvern.kernel.monsters
Class MonsterImpl

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.kernel.commands.AbstractCommandable
              extended bywyvern.kernel.monsters.MonsterImpl
All Implemented Interfaces:
Attackable, Broadcaster, Commandable, Damageable, GameObject, HeartbeatCallback, Hookable, MethodHookable, MethodHookCallback, Monster, MouseInterest, PropertyList, RemoteAudio
Direct Known Subclasses:
FreezingSphere, PirateShip, PlayerImpl, QuestPerson, QuestSolver, VoicePerson

public class MonsterImpl
extends AbstractCommandable
implements Monster, HeartbeatCallback, MethodHookCallback, MouseInterest

The class for nearly all monsters in the game.

Version:
1.0, Sep 26, 1997
Author:
Steve Yegge

Nested Class Summary
protected  class MonsterImpl.WalkVisitor
          Visitor that notifies objects we've stepped on them (or stopped stepping on them).
 
Field Summary
protected  int beats_
           
protected static org.python.util.PythonInterpreter python_
           
protected  Visitor walkVisitor_
           
 
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.Monster
DEFAULT_MONSTER_ATTACK_SPEED, DEFAULT_MONSTER_SPEED, DEFAULT_MONSTER_STRENGTH, MONSTER_XP_CAP
 
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
MonsterImpl()
           
 
Method Summary
protected  void addCustomAttacks()
          Looks for a custom-attack property and adds it to the @attacks list, as if it were a wielded weapon.
 void addToMap(GameMap map, java.util.List newpos)
          Notifies any WalkNotify objects in the map that we've entered the space.
 void adjustHP(int adjust)
          Adjusts the object's hit points upwards or downwards.
 void adjustSP(int adjust)
          Adjusts the monster's spell points upwards or downwards.
 int adjustStat(int adjust, java.lang.String statname, java.lang.String statmax)
          Adjusts the specified stat, staying within the valid range for the stat.
 void adjustWallet(long amount)
          Adjusts the amount of money the player is carrying by a positive or negative amount.
 void burial(GameObject attacker)
          Handles the map changes necessary to turn a live monster into a dead corpse.
protected  void checkDirection(java.lang.String bitmap)
          See what direction to set as our default direction property.
protected  void createGenericAttacks()
          Transfer any "wc-*" int properties we find on the monster to a BasicAttack body part in our parts list.
 void createInventory()
          Creates a suitable Inventory implementation.
 void dropAll()
          Causes the monster to drop all its items, except for items that are prevented from being dropped normally (e.g. they're cursed).
 void dropAllForce()
          Drops all this monster's items, no matter what.
protected  void ensureAI()
          Assign us to StandardAI if no "ai" is set in the archetype
protected  void ensurePartsList()
          Makes a default (humanoid) body-parts list for the monster.
protected  void generateInventory(java.lang.String path)
          Invokes the python interpreter to generate the inventory from the specified file.
 java.lang.String getDamagedDescription()
          Returns a message like "It is badly damaged".
 int getHP()
          Returns the object's current hit points.
 Inventory getInventory()
          Returns the monster's Inventory.
 int getLevel()
          Returns the monster's level.
 int getMaxHP()
          Returns the object's maximum hit points.
 int getMaxSP()
          Returns the monster's maximum mana.
 PartsList getPartsList()
          Returns the monster's body-parts list.
 int getSP()
          Returns the monster's mana.
 SpellList getSpellList()
          Returns the player's or monster's SpellList.
 long getWallet()
          Returns the amount of cash the monster is carrying in their top-level inventory.
 int getXPAward()
          Returns the XP award for this monster.
 void heartbeat()
          Heartbeat notification.
 void initialize()
          Sets class-default properties, after loading from the archetype.
 void initInventory()
           
 boolean isAlive()
          Returns true if the monster is alive.
 boolean isAttackable()
          Returns true if this is an Attackable.
 boolean isHostile()
           
 boolean isMonster()
          Returns true if (and only if) this is a Monster (and not a Player).
 boolean isMonsterOrPlayer()
          Returns true if this is a Monster or Player
 boolean isNeutral()
           
 boolean isPeaceful()
           
 boolean isPlayer()
          Returns true if (and only if) this is a Player.
 void kill(GameObject attacker)
          Handles killing a monster.
 void message(java.lang.String[] strings, byte[] styles)
          Sends a message to the client as an array of strings and styles to use for each piece.
 void message(java.lang.String msg, byte style)
          Sends a message to the client using the specified style.
 void methodCalled(java.lang.String hookName, MethodHookable target, java.lang.Object data)
          Shuts down the monster if the map is unloading.
 void mouseClicked(MouseCommandEvent event)
          A player clicked on the monster.
 void notifyAttacked(Commandable attacker)
          Notifies us that we've been attacked.
 void remove()
          Removes this object from its map.
protected  void setDefaultAttackSpeed()
           
 void setHP(int hp)
          Sets the current HP for the player, but keeps it within the valid range of (0, "max-hp")
 void setLevelProperties()
          Initializes default properties based on the monster's level.
 void setMap(GameMap map, int x, int y)
          Sets the parent map for this object, passing requested location at which to put the object.
 void setSP(int sp)
          Sets the current SP for the player, but keeps it within the valid range of (0, "max-sp")
 void snuffActiveSpells()
           
 void start()
          Gets on the heartbeat list, and initializes inventory if we have an auto-inv.
 void stop()
          "Stops" the monster by destroying its event queue.
 
Methods inherited from class wyvern.kernel.commands.AbstractCommandable
addAttack, addHook, addMessageListener, addMethodHook, checkAnimated, command, command, commandNow, destroy, ensureEventQueue, fireMessageReceived, getAI, getCapName, getCombatQueue, getCommand, getEncumbrance, getFiringPoint, getHookList, getHooks, getName, getQueue, isCommandable, isStarted, isTelnet, 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, stopAllSounds, stopMusic, stopSound, unregisterCommand
 
Methods inherited from class wyvern.kernel.maps.MapObject
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, addMotionTracker, addObjectTracker, addPrefix, addSuffix, 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, 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, initLocs, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isBlessed, isCursed, isDamned, isGroupable, isIdentified, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, 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, setMapLink, setQuantity, setShape, setSize, setTransientSize, setWeight, setWeight, teleport, toString, 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.Commandable
addAttack, addMessageListener, command, command, commandNow, getAI, getCapName, getCombatQueue, getCommand, getEncumbrance, getFiringPoint, getName, getQueue, isStarted, isTelnet, message, registerCommand, removeAttack, removeMessageListener, sendPicture, sendPicture, setAI, setEncumbrance, setName, unregisterCommand
 
Methods inherited from interface wyvern.lib.Hookable
addHook, getHookList, getHooks, removeHook, runFailedPostHook, runPostHook, runPreHook
 
Methods inherited from interface wyvern.lib.MethodHookable
addMethodHook, removeMethodHook, runMethodHook
 
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, destroy, externalize, getAlpha, getAppearance, getArchetype, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, 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, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isBlessed, isCommandable, isCursed, isDamned, isGroupable, isIdentified, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, removeContainerChangeListener, removeMapChangeListener, removeMapMotionListener, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, setAlpha, setAnimated, setBitmap, setCategory, setContainer, setDirection, setImage, setImage, setLayer, setLocations, 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
 
Methods inherited from interface wyvern.common.net.RemoteAudio
pauseSound, playAlert, playAlert, playDefaultMusic, playPriorityMusic, playPriorityMusic, playSound, playSound, resumeSound, setMusicGain, setSoundGain, stopAllSounds, stopMusic, stopSound
 

Field Detail

beats_

protected transient int beats_

walkVisitor_

protected transient Visitor walkVisitor_

python_

protected static transient org.python.util.PythonInterpreter python_
Constructor Detail

MonsterImpl

public MonsterImpl()
Method Detail

initialize

public void initialize()
Sets class-default properties, after loading from the archetype.

Specified by:
initialize in interface GameObject
Overrides:
initialize in class MapObject

setLevelProperties

public void setLevelProperties()
Initializes default properties based on the monster's level.


start

public void start()
Gets on the heartbeat list, and initializes inventory if we have an auto-inv.

Specified by:
start in interface Commandable
Overrides:
start in class AbstractCommandable

initInventory

public void initInventory()
                   throws java.lang.Exception
Throws:
java.lang.Exception

generateInventory

protected void generateInventory(java.lang.String path)
Invokes the python interpreter to generate the inventory from the specified file.

Parameters:
path - full path to inventory file to generate from

kill

public void kill(GameObject attacker)
Handles killing a monster. It puts a DeathEvent at the front of the monster's queue, and you can hook the event with "deathPreHook", "deathPostHook" and "deathFailedPostHook". If you want to kill a monster directly without going through the hooks, call burial(). Using the kill() method is better; monsters can be saved by amulets of lifesaving and so on.

Specified by:
kill in interface Damageable
Parameters:
attacker - the player/monster/iron-gate/whatever that did the final blow. Can be null.

isAlive

public boolean isAlive()
Description copied from interface: Monster
Returns true if the monster is alive. When a monster is killed, references to it may still exist, and occasionally the owners of those references need to check if the monster is still alive. The method just checks for the presence of a boolean property named "dead", and if it's not there, it returns true.

Specified by:
isAlive in interface Monster
Returns:
true if the monster has no "dead" property

stop

public void stop()
Description copied from interface: Commandable
"Stops" the monster by destroying its event queue. The monster can be restarted via another call to start().

Specified by:
stop in interface Commandable
Overrides:
stop in class AbstractCommandable

burial

public void burial(GameObject attacker)
Handles the map changes necessary to turn a live monster into a dead corpse. If the monster has the property "no-corpse", won't leave a corpse.

Specified by:
burial in interface Monster
Parameters:
attacker - the agent who killed us (can be null)

snuffActiveSpells

public void snuffActiveSpells()

dropAll

public void dropAll()
Description copied from interface: Monster
Causes the monster to drop all its items, except for items that are prevented from being dropped normally (e.g. they're cursed).

Specified by:
dropAll in interface Monster

dropAllForce

public void dropAllForce()
Drops all this monster's items, no matter what.

Specified by:
dropAllForce in interface Monster

addToMap

public void addToMap(GameMap map,
                     java.util.List newpos)
Notifies any WalkNotify objects in the map that we've entered the space.

Overrides:
addToMap in class MapObject
Parameters:
newpos - the positions to add at
map - the map to add to

setMap

public void setMap(GameMap map,
                   int x,
                   int y)
Description copied from interface: GameObject
Sets the parent map for this object, passing requested location at which to put the object. If the object is large (i.e. bigger than 1x1), then its "reference location", defined as the first location in its location-list, is placed at the requested location, and the remaining locations are placed relative to the reference location.

For example, if a 2x2 object is placed at (10,10), then the object's upper-left corner is its reference loc, so a reference to the object is placed at (10,10). The remaining three locations are placed at (11,10), (10,11) and (11,11).

For objects that wish to subclass this method, it does the following:

A method-hook is available for this method; it's called "add", and it's called whenever an object is added to a map. This happens whenever an object moves within a map (because of the current way in which physical object movement is implemented), so currently it's sufficient to have "add" and "remove" method hooks, but no "move" method hook.

Specified by:
setMap in interface GameObject
Overrides:
setMap in class MapObject

remove

public void remove()
Description copied from interface: GameObject
Removes this object from its map. This is the correct way take an object out of a map - you shouldn't invoke the map's remove() method on the object.

Specified by:
remove in interface GameObject
Overrides:
remove in class MapObject

methodCalled

public void methodCalled(java.lang.String hookName,
                         MethodHookable target,
                         java.lang.Object data)
Shuts down the monster if the map is unloading.

Specified by:
methodCalled in interface MethodHookCallback
Parameters:
hookName - the name of the hook being run
target - the object on which the method was invoked: a GameMap or GameObject.
data - a method-specific data object; can be null. Check the documentation for the method hook to see if any data is passed to the callbacks.

getInventory

public Inventory getInventory()
Returns the monster's Inventory.

Specified by:
getInventory in interface Commandable
Overrides:
getInventory in class AbstractCommandable
Returns:
the player's Inventory object, null if it has none.

notifyAttacked

public void notifyAttacked(Commandable attacker)
Notifies us that we've been attacked. Provides the method hook "attacked" with no data object.

Specified by:
notifyAttacked in interface Attackable
Parameters:
attacker - the thing attacking us

createInventory

public void createInventory()
Creates a suitable Inventory implementation. Subclasses (e.g. Player) should override this to do something more appropriate.

Specified by:
createInventory in interface Monster

ensurePartsList

protected void ensurePartsList()
Makes a default (humanoid) body-parts list for the monster.


setDefaultAttackSpeed

protected void setDefaultAttackSpeed()

createGenericAttacks

protected void createGenericAttacks()
Transfer any "wc-*" int properties we find on the monster to a BasicAttack body part in our parts list. This makes it easy to set a monster's attacks without having to muck around with body parts.


addCustomAttacks

protected void addCustomAttacks()
Looks for a custom-attack property and adds it to the @attacks list, as if it were a wielded weapon.


checkDirection

protected void checkDirection(java.lang.String bitmap)
See what direction to set as our default direction property. Looks at the last character of our bitmap name. If it doesn't end in one of NSEW (followed by an optional animation number), then the default direction is South.

Parameters:
bitmap - the name of the monster's bitmap

ensureAI

protected void ensureAI()
Assign us to StandardAI if no "ai" is set in the archetype

Overrides:
ensureAI in class AbstractCommandable

getWallet

public long getWallet()
Description copied from interface: Monster
Returns the amount of cash the monster is carrying in their top-level inventory. You can also do this by just searching their inventory for coins, but this is more convenient because it sums their cash in silver coins. It may also be enhanced to look in a purse or wallet, so you really ought to use it when checking to see how much coinage a player is carrying.

Specified by:
getWallet in interface Monster
Returns:
the total SILVER the player is carrying. It does the following calculation: silver + gold*10 + platinum*1000.

adjustWallet

public void adjustWallet(long amount)
Description copied from interface: Monster
Adjusts the amount of money the player is carrying by a positive or negative amount.

Specified by:
adjustWallet in interface Monster
Parameters:
amount - the amount of silver to add. If negative, deducts from the player's cash on hand. If the amount to deduct is more than the player has, it returns only the amount the player had on hand. It's up to the caller to call getWallet() and ensure there's enough there.

Note: this method does NOT check whether the player can carry the money, and it's possible to give the player more than they can technically carry. This is still under consideration - if it causes bugs, then we'll force the extra money to go on the ground.


heartbeat

public void heartbeat()
Heartbeat notification. This runs the "heartbeat" method-hook.

Specified by:
heartbeat in interface HeartbeatCallback

getPartsList

public PartsList getPartsList()
Description copied from interface: Monster
Returns the monster's body-parts list.

Specified by:
getPartsList in interface Monster

getXPAward

public int getXPAward()
Returns the XP award for this monster.

Specified by:
getXPAward in interface Attackable
Returns:
the number of experience points to distribute among the agents that killed the monster.

getLevel

public int getLevel()
Description copied from interface: Monster
Returns the monster's level.

Specified by:
getLevel in interface Monster

getHP

public int getHP()
Description copied from interface: Damageable
Returns the object's current hit points.

Specified by:
getHP in interface Damageable

setHP

public void setHP(int hp)
Description copied from interface: Monster
Sets the current HP for the player, but keeps it within the valid range of (0, "max-hp")

Specified by:
setHP in interface Monster
Parameters:
hp - the new hp

setSP

public void setSP(int sp)
Description copied from interface: Monster
Sets the current SP for the player, but keeps it within the valid range of (0, "max-sp")

Specified by:
setSP in interface Monster
Parameters:
sp - the new sp

getMaxHP

public int getMaxHP()
Description copied from interface: Damageable
Returns the object's maximum hit points.

Specified by:
getMaxHP in interface Damageable

getSP

public int getSP()
Description copied from interface: Monster
Returns the monster's mana.

Specified by:
getSP in interface Monster

getMaxSP

public int getMaxSP()
Description copied from interface: Monster
Returns the monster's maximum mana.

Specified by:
getMaxSP in interface Monster

adjustHP

public void adjustHP(int adjust)
Description copied from interface: Damageable
Adjusts the object's hit points upwards or downwards.

Specified by:
adjustHP in interface Damageable
Parameters:
adjust - a number (usually negative) to add to the object's hp

adjustSP

public void adjustSP(int adjust)
Description copied from interface: Monster
Adjusts the monster's spell points upwards or downwards.

Specified by:
adjustSP in interface Monster
Parameters:
adjust - a number (possibly negative) to add to the monster's hp

adjustStat

public int adjustStat(int adjust,
                      java.lang.String statname,
                      java.lang.String statmax)
Description copied from interface: Monster
Adjusts the specified stat, staying within the valid range for the stat. If there's a specific method for the stat, such as "adjustHP", then use the specific method.

Specified by:
adjustStat in interface Monster
Parameters:
adjust - the amount by which to adjust the stat, positive or negative.
statname - the name of the stat property to adjust
statmax - the name of the max-stat property, e.g., "max-hp"
Returns:
the new value, after adjustment

getDamagedDescription

public java.lang.String getDamagedDescription()
Description copied from interface: GameObject
Returns a message like "It is badly damaged".

Specified by:
getDamagedDescription in interface GameObject
Overrides:
getDamagedDescription in class MapObject

getSpellList

public SpellList getSpellList()
Description copied from interface: Monster
Returns the player's or monster's SpellList.

Specified by:
getSpellList in interface Monster
Returns:
a SpellList object, or null if the monster or player knows no spells.

mouseClicked

public void mouseClicked(MouseCommandEvent event)
A player clicked on the monster. Default behavior is to send the monster's default-response to the agent, if the monster isn't hostile.

Specified by:
mouseClicked in interface MouseInterest
Parameters:
event - the command event. event.getAgent() will return the Player who clicked the mouse.

isHostile

public boolean isHostile()

isPeaceful

public boolean isPeaceful()

isNeutral

public boolean isNeutral()

message

public void message(java.lang.String msg,
                    byte style)
Description copied from interface: Commandable
Sends a message to the client using the specified style.

Specified by:
message in interface Commandable
Overrides:
message in class AbstractCommandable

message

public void message(java.lang.String[] strings,
                    byte[] styles)
Description copied from interface: Commandable
Sends a message to the client as an array of strings and styles to use for each piece. This way you can send a message with mixed styles.

Specified by:
message in interface Commandable
Overrides:
message in class AbstractCommandable

isPlayer

public boolean isPlayer()
Description copied from interface: GameObject
Returns true if (and only if) this is a Player.

Specified by:
isPlayer in interface GameObject
Overrides:
isPlayer in class MapObject

isMonster

public boolean isMonster()
Description copied from interface: GameObject
Returns true if (and only if) this is a Monster (and not a Player).

Specified by:
isMonster in interface GameObject
Overrides:
isMonster in class MapObject

isMonsterOrPlayer

public boolean isMonsterOrPlayer()
Description copied from interface: GameObject
Returns true if this is a Monster or Player

Specified by:
isMonsterOrPlayer in interface GameObject
Overrides:
isMonsterOrPlayer in class MapObject

isAttackable

public boolean isAttackable()
Description copied from interface: GameObject
Returns true if this is an Attackable.

Specified by:
isAttackable in interface GameObject
Overrides:
isAttackable in class MapObject