wyvern.lib.properties
Interface Damageable

All Superinterfaces:
Broadcaster, GameObject, MethodHookable, PropertyList
All Known Subinterfaces:
Armor, Attackable, Monster, Player, Weapon
All Known Implementing Classes:
ArmorImpl, DiggableWall, Door, DynamicObject, Generator, MonsterImpl, PlayerImpl, WeaponImpl

public interface Damageable
extends GameObject

Interface for objects that can sustain damage. If you can't attack them per se, but they can take damage through some means (e.g. weapons or armor taking damage during combat), you can have them implement this interface. It's a particularly useful interface for special armor or weapons that want to know when their hp are being adjusted, or when the object is being destroyed.

Version:
1.0, Nov 6, 2000
Author:
Steve Yegge

Field Summary
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Method Summary
 void adjustHP(int adjust)
          Adjusts the object's hit points upwards or downwards.
 int getHP()
          Returns the object's current hit points.
 int getMaxHP()
          Returns the object's maximum hit points.
 void kill(GameObject attacker)
          Destroys the object.
 
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, getDamagedDescription, 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, initialize, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, isBlessed, isCommandable, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, remove, removeContainerChangeListener, removeMapChangeListener, removeMapMotionListener, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, setAlpha, setAnimated, setBitmap, setCategory, setContainer, setDirection, setImage, setImage, setLayer, setLocations, setMap, 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.MethodHookable
addMethodHook, removeMethodHook, runMethodHook
 
Methods inherited from interface wyvern.lib.Broadcaster
broadcast, broadcast, broadcast, broadcast, broadcast
 

Method Detail

getHP

public int getHP()
Returns the object's current hit points.


getMaxHP

public int getMaxHP()
Returns the object's maximum hit points.


adjustHP

public void adjustHP(int adjust)
Adjusts the object's hit points upwards or downwards.

Parameters:
adjust - a number (usually negative) to add to the object's hp

kill

public void kill(GameObject attacker)
Destroys the object. Implementation-dependent: monsters die and drop all their stuff, generators shut off and disappear, and so on.

Parameters:
attacker - the player/monster/iron-gate/whatever that did the final blow. Can be null.