wyvern.lib.spells.effects
Class Paralyzer

java.lang.Object
  extended bywyvern.lib.spells.effects.Paralyzer
All Implemented Interfaces:
Dispellable, HookCallback, Timed

public class Paralyzer
extends java.lang.Object
implements HookCallback, Timed, Dispellable

When placed on a monster, prevents the monster from moving for a while.

The Paralyzer attaches itself in the target's property list under the property name "@paralyzer".

Version:
1.0, Nov 26, 1999
Author:
Steve Yegge

Field Summary
static int DEFAULT_DURATION
           
 
Constructor Summary
Paralyzer()
          Constructs a new Paralyzer, ready to place on the specified monster.
Paralyzer(Monster target)
          Constructs a new Paralyzer on the specified monster.
Paralyzer(Monster target, int duration)
          Constructs a new Paralyzer with the specified target and duration.
 
Method Summary
 void dispel()
          Stops paralyzing the target.
 int getDuration()
          Retrieves the total duration for this paralysis.
 void hookEvent(java.lang.String hookName, CommandEvent event)
          Stops them from moving.
 void paralyze(Monster target)
          Attaches to, and paralyzes, the specified target.
 void setDuration(int duration)
          Sets the duration for the paralysis.
 void timerExpired()
          Time to stop.
 java.lang.String toString()
          Debugging string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DURATION

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

Paralyzer

public Paralyzer()
Constructs a new Paralyzer, ready to place on the specified monster.


Paralyzer

public Paralyzer(Monster target)
Constructs a new Paralyzer on the specified monster.

Parameters:
target - the monster to paralyze

Paralyzer

public Paralyzer(Monster target,
                 int duration)
Constructs a new Paralyzer with the specified target and duration.

Parameters:
target - the monster to paralyze
duration - the time (in millis) to paralyze the target
Method Detail

setDuration

public void setDuration(int duration)
Sets the duration for the paralysis. Make sure to call this *before* calling paralyze(), or it'll be ignored.

Parameters:
duration - length of time to paralyze the target (in millis)

getDuration

public int getDuration()
Retrieves the total duration for this paralysis.

Returns:
the total time it'll be active

paralyze

public void paralyze(Monster target)
Attaches to, and paralyzes, the specified target. Can only paralyze one target at a time, so if it's already paralyzing another target, it removes itself from the existing target first.

If it finds a previous @paralyzer on the target, it dispels the old one before adding the new one.

Parameters:
target - the monster to paralyze

hookEvent

public void hookEvent(java.lang.String hookName,
                      CommandEvent event)
Stops them from moving.

Specified by:
hookEvent in interface HookCallback
Parameters:
event - the move/push event
hookName - the name of the hook, such as "movePreHook".

timerExpired

public void timerExpired()
Time to stop.

Specified by:
timerExpired in interface Timed

dispel

public void dispel()
Stops paralyzing the target.

Specified by:
dispel in interface Dispellable

toString

public java.lang.String toString()
Debugging string.