|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwyvern.kernel.properties.PList
wyvern.kernel.maps.MapObject
wyvern.kernel.commands.AbstractCommandable
wyvern.kernel.monsters.MonsterImpl
The class for nearly all monsters in the game.
| 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 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.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 |
protected transient int beats_
protected transient Visitor walkVisitor_
protected static transient org.python.util.PythonInterpreter python_
| Constructor Detail |
public MonsterImpl()
| Method Detail |
public void initialize()
initialize in interface GameObjectinitialize in class MapObjectpublic void setLevelProperties()
public void start()
start in interface Commandablestart in class AbstractCommandable
public void initInventory()
throws java.lang.Exception
java.lang.Exceptionprotected void generateInventory(java.lang.String path)
path - full path to inventory file to generate frompublic void kill(GameObject attacker)
kill in interface Damageableattacker - the player/monster/iron-gate/whatever that
did the final blow. Can be null.public boolean isAlive()
Monster
isAlive in interface Monsterpublic void stop()
Commandable
stop in interface Commandablestop in class AbstractCommandablepublic void burial(GameObject attacker)
burial in interface Monsterattacker - the agent who killed us (can be null)public void snuffActiveSpells()
public void dropAll()
Monster
dropAll in interface Monsterpublic void dropAllForce()
dropAllForce in interface Monster
public void addToMap(GameMap map,
java.util.List newpos)
addToMap in class MapObjectnewpos - the positions to add atmap - the map to add to
public void setMap(GameMap map,
int x,
int y)
GameObjectFor 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:
setMap in interface GameObjectsetMap in class MapObjectpublic void remove()
GameObject
remove in interface GameObjectremove in class MapObject
public void methodCalled(java.lang.String hookName,
MethodHookable target,
java.lang.Object data)
methodCalled in interface MethodHookCallbackhookName - the name of the hook being runtarget - 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.public Inventory getInventory()
getInventory in interface CommandablegetInventory in class AbstractCommandablepublic void notifyAttacked(Commandable attacker)
notifyAttacked in interface Attackableattacker - the thing attacking uspublic void createInventory()
createInventory in interface Monsterprotected void ensurePartsList()
protected void setDefaultAttackSpeed()
protected void createGenericAttacks()
protected void addCustomAttacks()
protected void checkDirection(java.lang.String bitmap)
bitmap - the name of the monster's bitmapprotected void ensureAI()
ensureAI in class AbstractCommandablepublic long getWallet()
Monster
getWallet in interface Monsterpublic void adjustWallet(long amount)
Monster
adjustWallet in interface Monsteramount - 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.
public void heartbeat()
heartbeat in interface HeartbeatCallbackpublic PartsList getPartsList()
Monster
getPartsList in interface Monsterpublic int getXPAward()
getXPAward in interface Attackablepublic int getLevel()
Monster
getLevel in interface Monsterpublic int getHP()
Damageable
getHP in interface Damageablepublic void setHP(int hp)
Monster
setHP in interface Monsterhp - the new hppublic void setSP(int sp)
Monster
setSP in interface Monstersp - the new sppublic int getMaxHP()
Damageable
getMaxHP in interface Damageablepublic int getSP()
Monster
getSP in interface Monsterpublic int getMaxSP()
Monster
getMaxSP in interface Monsterpublic void adjustHP(int adjust)
Damageable
adjustHP in interface Damageableadjust - a number (usually negative) to add to the object's hppublic void adjustSP(int adjust)
Monster
adjustSP in interface Monsteradjust - a number (possibly negative) to add to the monster's hp
public int adjustStat(int adjust,
java.lang.String statname,
java.lang.String statmax)
Monster
adjustStat in interface Monsteradjust - the amount by which to adjust the stat, positive
or negative.statname - the name of the stat property to adjuststatmax - the name of the max-stat property, e.g., "max-hp"
public java.lang.String getDamagedDescription()
GameObject
getDamagedDescription in interface GameObjectgetDamagedDescription in class MapObjectpublic SpellList getSpellList()
Monster
getSpellList in interface Monsterpublic void mouseClicked(MouseCommandEvent event)
mouseClicked in interface MouseInterestevent - the command event. event.getAgent() will
return the Player who clicked the mouse.public boolean isHostile()
public boolean isPeaceful()
public boolean isNeutral()
public void message(java.lang.String msg,
byte style)
Commandable
message in interface Commandablemessage in class AbstractCommandable
public void message(java.lang.String[] strings,
byte[] styles)
Commandable
message in interface Commandablemessage in class AbstractCommandablepublic boolean isPlayer()
GameObject
isPlayer in interface GameObjectisPlayer in class MapObjectpublic boolean isMonster()
GameObject
isMonster in interface GameObjectisMonster in class MapObjectpublic boolean isMonsterOrPlayer()
GameObject
isMonsterOrPlayer in interface GameObjectisMonsterOrPlayer in class MapObjectpublic boolean isAttackable()
GameObject
isAttackable in interface GameObjectisAttackable in class MapObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||