wyvern.lib.monsters
Class DrainAttack

java.lang.Object
  extended bywyvern.lib.monsters.DefaultCustomAttack
      extended bywyvern.lib.monsters.DrainAttack
All Implemented Interfaces:
Attack, CustomAttack

public class DrainAttack
extends DefaultCustomAttack

Experience drain.

Version:
1.0, May 21, 2002
Author:
Steve Yegge

Field Summary
 
Fields inherited from class wyvern.lib.monsters.DefaultCustomAttack
DEFAULT_HIT_CHANCE
 
Constructor Summary
DrainAttack()
           
 
Method Summary
 int getLevel()
          Returns the drain Level, for use in performDamage.
 void performDamage(Commandable attacker, GameObject defender, CommandEvent event)
          Tells the attack to perform its special damage effect.
 void setLevel(int level)
          Sets the drain Level, for use in performDamage.
 
Methods inherited from class wyvern.lib.monsters.DefaultCustomAttack
didDamage, getToHit, getWC, getWeaponSkill, recomputeWCs, setShowAttackerMessage, setToHit, setWC, showAttackerMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrainAttack

public DrainAttack()
Method Detail

performDamage

public void performDamage(Commandable attacker,
                          GameObject defender,
                          CommandEvent event)
Tells the attack to perform its special damage effect. Called if the attack's to-hit was successful and the attack wasn't vetoed.

Runs a method-hook on the defender called "xp-drain". The data parameter is an Integer whose value is the amount that got drained. It's a positive number.

Parameters:
attacker - the monster doing the drain attack
defender - the player being attacked
event - the HitCommand event

getLevel

public int getLevel()
Returns the drain Level, for use in performDamage. XP drained per hit is in the range (5*level, 20*level), so a level 5 drain attack would drain 25-400 xp.


setLevel

public void setLevel(int level)
Sets the drain Level, for use in performDamage.