wyvern.lib.classes.construct
Class Door
java.lang.Object
wyvern.kernel.properties.PList
wyvern.kernel.maps.MapObject
wyvern.lib.classes.construct.ConnectedObject
wyvern.lib.classes.construct.Wall
wyvern.lib.classes.construct.Door
- All Implemented Interfaces:
- Attackable, Broadcaster, Damageable, GameObject, MethodHookable, Openable, Predicate, PropertyList
- Direct Known Subclasses:
- VoiceDoor
- public class Door
- extends Wall
- implements Openable, Attackable
A door that can be opened or closed. Doors have a "hp" (and "max-hp")
property, so they can be attacked and destroyed.
Doors can have a "non-opaque" property specifying
that you can see through the door even if it's closed.
- Version:
- 1.0, Nov 09, 1997
- Author:
- Steve Yegge
Constructor Summary |
Door()
|
Method Summary |
void |
adjustHP(int adjust)
Adjusts the monster's hit points upwards or downwards. |
protected void |
applyBitmap(java.lang.String dirs)
Chooses a bitmap based on a string indicating the neighbors. |
boolean |
close(Commandable agent)
Closes the door. |
int |
getHP()
Returns the door's current hit points. |
int |
getMaxHP()
Returns the object's maximum hit points. |
java.lang.String |
getWallBaseName()
Returns the base name "wall". |
int |
getXPAward()
Returns the experience award for killing this monster. |
void |
initialize()
Adds the default properties for this class.
|
boolean |
isAttackable()
Returns true if this is an Attackable. |
boolean |
isClosed()
Convenience synonym for "! |
boolean |
isLocked()
Returns true if this door is currently locked. |
boolean |
isOpen()
Returns true if we're open. |
void |
kill(GameObject attacker)
Destroys the door. |
void |
lock(Commandable agent)
Locks the lock. |
void |
notifyAttacked(Commandable attacker)
Notifies the object it's being attacked. |
boolean |
open(Commandable agent)
Opens the door. |
protected java.lang.String |
stripDirs(java.lang.String type,
java.lang.String name)
Strips off the direction suffix, if any. |
void |
teleport(int x,
int y)
Overrides Wall.teleport. |
void |
unlock(Commandable agent)
Unlocks the lock. |
Methods inherited from class wyvern.kernel.maps.MapObject |
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, addMethodHook, addMotionTracker, addObjectTracker, addPrefix, addSuffix, addToMap, bless, broadcast, broadcast, broadcast, broadcast, broadcast, canEnter, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, destroy, ensureListenerList, ensureWeight, externalize, fireContainerEntered, fireContainerExited, fireEnteredMap, fireExitedMap, fireMovedInMap, getAlpha, getAppearance, getArchetype, getBaseName, 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, groupString, inContainer, initLocs, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isBlessed, isCommandable, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, removeContainerChangeListener, removeFromMap, removeMapChangeListener, removeMapMotionListener, removeMethodHook, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, runMethodHook, 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, 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.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, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, 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 |
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 |
locked_
protected boolean locked_
DOOR_DEFAULT_HP
public static final int DOOR_DEFAULT_HP
- See Also:
- Constant Field Values
Door
public Door()
initialize
public void initialize()
- Adds the default properties for this class.
If the door has a property called "non-opaque", then
the door will not block visibility when it's closed.
- Specified by:
initialize
in interface GameObject
- Overrides:
initialize
in class Wall
teleport
public void teleport(int x,
int y)
- Overrides Wall.teleport. Removes any previous wall that
was at this location. This method exists primarily so the
Map Editor doesn't have to do it manually; it should also
come in handy if someone comes up with a createDoor() spell.
- Specified by:
teleport
in interface GameObject
- Overrides:
teleport
in class ConnectedObject
- Parameters:
x
- map x locationy
- map y location
applyBitmap
protected void applyBitmap(java.lang.String dirs)
- Chooses a bitmap based on a string indicating the neighbors.
- Overrides:
applyBitmap
in class ConnectedObject
- Parameters:
dirs
- a string such as "NSE". The Door will try to choose
a reasonable bitmap based on its neighbors.
open
public boolean open(Commandable agent)
- Opens the door.
- Specified by:
open
in interface Openable
- Parameters:
agent
- the agent opening it (can be null)
- Returns:
- true if it opened successfully
close
public boolean close(Commandable agent)
- Closes the door.
- Specified by:
close
in interface Openable
- Parameters:
agent
- the agent closed it (can be null)
- Returns:
- true if it closed successfully
isLocked
public boolean isLocked()
- Returns true if this door is currently locked.
- Specified by:
isLocked
in interface Openable
- Returns:
- true if locked
unlock
public void unlock(Commandable agent)
- Unlocks the lock.
- Specified by:
unlock
in interface Openable
lock
public void lock(Commandable agent)
- Locks the lock.
- Specified by:
lock
in interface Openable
isOpen
public boolean isOpen()
- Returns true if we're open.
- Specified by:
isOpen
in interface Openable
- Returns:
- true if open
isClosed
public boolean isClosed()
- Convenience synonym for "!door.isOpen()"
- Returns:
- true if the door is currently closed
getWallBaseName
public java.lang.String getWallBaseName()
- Returns the base name "wall".
- Overrides:
getWallBaseName
in class ConnectedObject
- Returns:
- "door"
stripDirs
protected java.lang.String stripDirs(java.lang.String type,
java.lang.String name)
- Strips off the direction suffix, if any.
- Overrides:
stripDirs
in class ConnectedObject
- Parameters:
type
- "wall" or "road" (not used by this version)name
- the filename, with no extension
- Returns:
- the base name
getHP
public int getHP()
- Returns the door's current hit points.
- Specified by:
getHP
in interface Damageable
getMaxHP
public int getMaxHP()
- Returns the object's maximum hit points.
- Specified by:
getMaxHP
in interface Damageable
adjustHP
public void adjustHP(int adjust)
- Adjusts the monster's hit points upwards or downwards.
- Specified by:
adjustHP
in interface Damageable
- Parameters:
adjust
- a number (usually negative) to add to the monster's hp
kill
public void kill(GameObject attacker)
- Destroys the door.
- Specified by:
kill
in interface Damageable
- Parameters:
attacker
- the player/monster/iron-gate/whatever that
did the final blow. Can be null.
notifyAttacked
public void notifyAttacked(Commandable attacker)
- Notifies the object it's being attacked. Happens during
the successful execution of the AttackEvent, before the damage
is computed.
- Specified by:
notifyAttacked
in interface Attackable
getXPAward
public int getXPAward()
- Returns the experience award for killing this monster.
- Specified by:
getXPAward
in interface Attackable
- Returns:
- the number of experience points to distribute among
the agents that killed the monster.
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