wyvern.lib.skills
Class GiantShrink

java.lang.Object
  extended bywyvern.lib.skills.GiantShrink
All Implemented Interfaces:
AddRemoveNotify, Command, MethodHookCallback, MutableProperty

public class GiantShrink
extends java.lang.Object
implements Command, AddRemoveNotify, MethodHookCallback, MutableProperty

Class that handles special abilities for Giants. Adds the commands "shrink" and "grow".

Version:
1.0, Dec 30, 2000
Author:
Steve Yegge

Constructor Summary
GiantShrink()
           
 
Method Summary
 java.lang.Object createClone()
          Produces a clone of the property for the caller.
 CommandEvent createEvent(CommandEvent initial)
          Creates the command event.
 boolean equals(java.lang.Object o)
           
 boolean execute(CommandEvent event)
          Executes the event.
 boolean grow(Commandable agent)
          Grows the giant back to normal size.
 int hashCode()
           
 boolean knowsCommand(java.lang.String command)
          Returns true if we want to handle this command.
 void methodCalled(java.lang.String hookName, MethodHookable target, java.lang.Object data)
          Called when the player is done initializing.
 void notifyAdd(PropertyList obj)
          Notifies the property that it's being added.
 void notifyRemove(PropertyList obj)
          Notifies the property that it's being removed.
 void restoreStats(Commandable agent)
          Restores stats to normal.
 boolean shrink(Commandable agent, CommandEvent event)
          Shrinks the giant to 1x1.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GiantShrink

public GiantShrink()
Method Detail

knowsCommand

public boolean knowsCommand(java.lang.String command)
Returns true if we want to handle this command.

Specified by:
knowsCommand in interface Command
Parameters:
command - the command the player typed
Returns:
true if we're handling it

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.

execute

public boolean execute(CommandEvent event)
Executes the event.

Specified by:
execute in interface Command
Parameters:
event - the event
Returns:
true if the event executed successfully

shrink

public boolean shrink(Commandable agent,
                      CommandEvent event)
Shrinks the giant to 1x1.

Parameters:
event - the command event
Returns:
true if successful

grow

public boolean grow(Commandable agent)
Grows the giant back to normal size.

Returns:
true if successful

restoreStats

public void restoreStats(Commandable agent)
Restores stats to normal.


notifyAdd

public void notifyAdd(PropertyList obj)
Notifies the property that it's being added.

Specified by:
notifyAdd in interface AddRemoveNotify
Parameters:
obj - the GameObject whose property list we're being added to

notifyRemove

public void notifyRemove(PropertyList obj)
Notifies the property that it's being removed.

Specified by:
notifyRemove in interface AddRemoveNotify
Parameters:
obj - the GameObject whose property list we're being removed from

methodCalled

public void methodCalled(java.lang.String hookName,
                         MethodHookable target,
                         java.lang.Object data)
Called when the player is done initializing.

Specified by:
methodCalled in interface MethodHookCallback
Parameters:
hookName - the name of the hook being run
target - the object on which the method was invoked: a GameMap or GameObject.
data - a method-specific data object; can be null. Check the documentation for the method hook to see if any data is passed to the callbacks.

createClone

public java.lang.Object createClone()
Description copied from interface: MutableProperty
Produces a clone of the property for the caller. Note: it's called createClone, not makeClone, because GameObject already has a makeClone. Some GameObjects can be properties (e.g inventories) and we can't do overloaded methods based only on the return type.

Specified by:
createClone in interface MutableProperty

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()