wyvern.lib.classes
Class Ship

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.kernel.commands.AbstractCommandable
              extended bywyvern.lib.classes.Vehicle
                  extended bywyvern.lib.classes.Ship
All Implemented Interfaces:
Applyable, Broadcaster, Command, Commandable, GameObject, Hookable, HookCallback, MethodHookable, MethodHookCallback, PropertyList, RemoteAudio

public class Ship
extends Vehicle

A player-pilotable Ship.

Version:
1.0, Dec 09, 1998
Author:
Steve Yegge

Nested Class Summary
 class Ship.ShipMover
          This class determines where the ship is allowed to move.
 
Field Summary
static int DEFAULT_SHIP_SPEED
           
 
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.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
Ship()
           
 
Method Summary
protected  boolean adjacentToShip(Point dest, java.util.List locs)
          Checks whether the proposed point is adjacent to the ship
 boolean boardPassenger(Commandable agent)
          Puts a passenger in the vehicle, if there's room.
 boolean disembark(Commandable agent)
          Disembarks the player.
 boolean execute(CommandEvent event)
          Executes a user command.
 void handleMouse(CommandEvent ev)
          Handles mouse clicks while player is in the vehicle.
 void initialize()
          Adds class-default properties.
 boolean isDocked()
          Returns true if the ship is docked.
 boolean knowsCommand(java.lang.String command)
          Returns true if we know the command.
protected  void printHelp(Commandable agent)
          Shows the user the basic commands.
 void printWelcome(Commandable agent)
          Prints an introductory message.
protected  void setDockBitmap()
          Sets the bitmap, depending on whether we're docked or not.
 void setDocked(boolean docked)
          Sets whether the ship is docked or not.
 void unhookPlayer(Commandable agent)
          Removes hooks from the player.
 
Methods inherited from class wyvern.lib.classes.Vehicle
addCamera, addHooks, addPilot, adjacentTo, apply, createCommandList, createEvent, createInteriorMap, ensureAI, findDisembarkLocation, getCameraPos, getCommand, getInteriorMap, grabCamera, handleExit, handleFailedPostMove, handleLookXY, handlePilot, handlePreMove, handleTeleport, handleView, hookEvent, isPilot, isValidDir, methodCalled, relinquishCamera, remove, removeCamera, removeHooks, removePilot, setMap, teleport, toggleView, translateToThisMap, updateMapLocation, viewingInside
 
Methods inherited from class wyvern.kernel.commands.AbstractCommandable
addAttack, addHook, addMessageListener, addMethodHook, checkAnimated, command, command, commandNow, destroy, ensureEventQueue, fireMessageReceived, getAI, getCapName, getCombatQueue, getEncumbrance, getFiringPoint, getHookList, getHooks, getInventory, getName, getQueue, isCommandable, isStarted, isTelnet, message, message, 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, start, stop, stopAllSounds, stopMusic, stopSound, unregisterCommand
 
Methods inherited from class wyvern.kernel.maps.MapObject
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, addMotionTracker, addObjectTracker, addPrefix, addSuffix, addToMap, 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, 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, isAttackable, isBlessed, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, 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, toString
 
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, 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, isAttackable, isBlessed, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, 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
 
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
 

Field Detail

DEFAULT_SHIP_SPEED

public static final int DEFAULT_SHIP_SPEED
See Also:
Constant Field Values
Constructor Detail

Ship

public Ship()
Method Detail

initialize

public void initialize()
Adds class-default properties.

Notes:

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

setDockBitmap

protected void setDockBitmap()
Sets the bitmap, depending on whether we're docked or not.


printWelcome

public void printWelcome(Commandable agent)
Prints an introductory message.

Overrides:
printWelcome in class Vehicle

printHelp

protected void printHelp(Commandable agent)
Shows the user the basic commands.


isDocked

public boolean isDocked()
Returns true if the ship is docked.


setDocked

public void setDocked(boolean docked)
Sets whether the ship is docked or not. This affects various aspects of the ship's behavior.


boardPassenger

public boolean boardPassenger(Commandable agent)
Puts a passenger in the vehicle, if there's room.

Overrides:
boardPassenger in class Vehicle
Parameters:
agent - the passenger to board
Returns:
true if they were boarded successfully

disembark

public boolean disembark(Commandable agent)
Disembarks the player.

Overrides:
disembark in class Vehicle
Parameters:
agent - the agent to remove
Returns:
true if the agent disembarked successfully

unhookPlayer

public void unhookPlayer(Commandable agent)
Removes hooks from the player.

Overrides:
unhookPlayer in class Vehicle
Parameters:
agent - the person leaving the vehicle

knowsCommand

public boolean knowsCommand(java.lang.String command)
Returns true if we know the command.

Specified by:
knowsCommand in interface Command
Overrides:
knowsCommand in class Vehicle
Parameters:
command - the entire command string, including arguments
Returns:
true if we want to handle the command

execute

public boolean execute(CommandEvent event)
Executes a user command.

Specified by:
execute in interface Command
Overrides:
execute in class Vehicle
Parameters:
event - the command event with the command and agent
Returns:
true if the command executed successfully

handleMouse

public void handleMouse(CommandEvent ev)
Handles mouse clicks while player is in the vehicle.

Overrides:
handleMouse in class Vehicle

adjacentToShip

protected boolean adjacentToShip(Point dest,
                                 java.util.List locs)
Checks whether the proposed point is adjacent to the ship