Class Dog

java.lang.Object
  |
  +--GameObject
        |
        +--RealObject
              |
              +--Wanderer
                    |
                    +--Dog
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, Spyable

class Dog
extends Wanderer

A Dog can follow something that leaves the room and follow directions.


Inner classes inherited from class RealObject
RealObject.ContentsMessager, RealObject.DescriptionLineProcessor
 
Inner classes inherited from class GameObject
GameObject.LeaveInfo
 
Field Summary
(package private)  GameObject.LeaveInfo followInfo
          Keep track of what we're going to follow and where.
 
Fields inherited from class Wanderer
mobility
 
Fields inherited from class RealObject
contents, longDescription, parentObject, shortDescription, spreadto
 
Fields inherited from class GameObject
masterGame, name
 
Constructor Summary
(package private) Dog()
          Sets mobility to only .07 because the faithful Dog will usually stay put unless it has a good reason to go.
 
Method Summary
 void doAction()
          If we want to follow something, do so; otherwise do superclass action.
 void goodbye(GameObject.LeaveInfo leaveInfo)
          If something leaves the room, then with a 60% chance we will make a note to follow it at our next turn.
 void listen(java.lang.String message)
          If the command is "go somewhere," try to go in that direction.
 
Methods inherited from class Wanderer
initialize
 
Methods inherited from class RealObject
checkLeave, clone, getLongDescription, getParent, getShortDescription, getSpreadability, hello, isPredicate, preClone, register, roomOf, runSpy, setParent, spread, tellAll, unregister, wanderVia
 
Methods inherited from class GameObject
announce, compareTo, getMasterGame, kill, newInstance, setMasterGame, toString
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

followInfo

GameObject.LeaveInfo followInfo
Keep track of what we're going to follow and where.
Constructor Detail

Dog

Dog()
Sets mobility to only .07 because the faithful Dog will usually stay put unless it has a good reason to go.
Method Detail

doAction

public void doAction()
If we want to follow something, do so; otherwise do superclass action. Also bark occasionally.
Overrides:
doAction in class Wanderer

goodbye

public void goodbye(GameObject.LeaveInfo leaveInfo)
If something leaves the room, then with a 60% chance we will make a note to follow it at our next turn.
Overrides:
goodbye in class RealObject
Following copied from class: RealObject
Parameters:
leaveinfo - Information about who's trying to leave and where they want to go

listen

public void listen(java.lang.String message)
If the command is "go somewhere," try to go in that direction. Bark if the direction is bogus. For other commands, do superclass action (i.e., don't understand).
Overrides:
listen in class GameObject
Following copied from class: GameObject
Parameters:
message - English message telling the object what to do. The messages was probably typed in by a user, but could also have been a request by some other object during its doAction time.