wyvern.lib.classes.games
Class CheckersChair

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.lib.classes.games.ChessChair
              extended bywyvern.lib.classes.games.CheckersChair
All Implemented Interfaces:
Applyable, Broadcaster, Command, GameObject, HookCallback, MethodHookable, PropertyList

public class CheckersChair
extends wyvern.lib.classes.games.ChessChair

This class implements a chair you can sit in to play a Checkers game. It grabs control of your camera (so you can see the whole board) and forwards various commands along to the Checkers game.

Version:
1.0, Oct 29, 2000
Author:
Steve Yegge

Field Summary
protected  int color_
           
protected  java.lang.String colstring_
           
protected  Chess game_
           
 
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
 
Constructor Summary
CheckersChair(Checkers game, int color)
          Constructs a new CheckersChair
 
Method Summary
 void apply(Commandable agent)
          Someone applied the chair.
 CommandEvent createEvent(CommandEvent initial)
          Creates the command event.
 boolean execute(CommandEvent event)
          Executes the event.
protected  java.lang.String getGameName()
          Returns the name of the game.
 void grabCamera(Player p)
          Centers the player's camera on the chessboard, more or less.
 void hookEvent(java.lang.String hookName, CommandEvent event)
          Don't let the player move without quitting.
 void initialize()
          Initializes the object's default properties.
 boolean knowsCommand(java.lang.String command)
          Returns true if we understand the command.
 void relinquishCamera(Player p)
          Puts the camera back under the control of the player.
 void remove()
          Removes commands from the map.
 void setMap(GameMap map, int x, int y)
          Sets up the commands we want to handle.
 
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, isAttackable, 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, teleport, 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.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
 

Field Detail

game_

protected Chess game_

color_

protected int color_

colstring_

protected java.lang.String colstring_
Constructor Detail

CheckersChair

public CheckersChair(Checkers game,
                     int color)
Constructs a new CheckersChair

Parameters:
game - the Checkers game we're interacting with
Method Detail

grabCamera

public void grabCamera(Player p)
Centers the player's camera on the chessboard, more or less.

Parameters:
p - the player whose camera to move

getGameName

protected java.lang.String getGameName()
Returns the name of the game.


execute

public boolean execute(CommandEvent event)
Executes the event.

Parameters:
event - the command event
Returns:
true if the event executed successfully

initialize

public void initialize()
Description copied from interface: GameObject
Initializes the object's default properties. Any GameObject implementation that wishes to initialize itself should do so here, rather than in the constructor. This is because nearly all game objects inherit from an archetype, and the archetype parent pointer isn't set until the object's constructor finishes. This is a good place to add any class-default properties for an object - properties that the object gets regardless of which archetype it inherits from. WARNING: don't forget to call the superclass' initialize() method, or the object may not function properly. For instance, it won't become animated even if it specifies animation parameters in the archetype.

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

setMap

public void setMap(GameMap map,
                   int x,
                   int y)
Sets up the commands we want to handle.

Specified by:
setMap in interface GameObject
Overrides:
setMap in class MapObject
Parameters:
map - the map we're in
x - map x location
y - map y location

remove

public void remove()
Removes commands from the map.

Specified by:
remove in interface GameObject
Overrides:
remove in class MapObject

knowsCommand

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

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

createEvent

public CommandEvent createEvent(CommandEvent initial)
Creates the command event.

Specified by:
createEvent in interface Command
Parameters:
initial - a "blank" CommandEvent containing only the command text and the agent who's performing the command. This initial event is created by the originator of the event (e.g. the AI or player's command preprocessor).
Returns:
a CommandEvent subclass encapsulating this command's execution parameters and state. It should copy in the fields from the passed-in event.

relinquishCamera

public void relinquishCamera(Player p)
Puts the camera back under the control of the player.

Parameters:
p - the player whose camera to move

hookEvent

public void hookEvent(java.lang.String hookName,
                      CommandEvent event)
Don't let the player move without quitting.

Specified by:
hookEvent in interface HookCallback
Parameters:
hookName - the name of the hook, such as "movePreHook".
event - the CommandEvent encapsulating the event parameters

apply

public void apply(Commandable agent)
Someone applied the chair.

Specified by:
apply in interface Applyable
Parameters:
agent - the person applying the object