wyvern.lib.monsters
Class StealAttack

java.lang.Object
  extended bywyvern.lib.monsters.DefaultCustomAttack
      extended bywyvern.lib.monsters.StealAttack
All Implemented Interfaces:
Attack, CustomAttack
Direct Known Subclasses:
NymphStealAttack, StealGoldAttack

public abstract class StealAttack
extends DefaultCustomAttack

Superclass for the various steal attacks. Has utility methods for transferring items between inventories and teleporting the agent away.

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

Field Summary
static int FAILED_DROPPED
           
static int FAILED_RESTORED
           
static int SUCCESS
           
static int TOO_HEAVY
           
 
Fields inherited from class wyvern.lib.monsters.DefaultCustomAttack
DEFAULT_HIT_CHANCE
 
Constructor Summary
StealAttack()
           
 
Method Summary
 void stealObject(GameObject obj, Inventory src, Inventory dest)
          Tries to steal an object from the defender.
protected  void teleport(Commandable attacker)
          Teleports away.
protected  int transferObject(GameObject obj, Inventory src, Inventory dest)
          Attempts to transfer an object from one inventory to another.
 
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
 
Methods inherited from interface wyvern.kernel.combat.CustomAttack
performDamage
 

Field Detail

SUCCESS

public static final int SUCCESS
See Also:
Constant Field Values

TOO_HEAVY

public static final int TOO_HEAVY
See Also:
Constant Field Values

FAILED_RESTORED

public static final int FAILED_RESTORED
See Also:
Constant Field Values

FAILED_DROPPED

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

StealAttack

public StealAttack()
Method Detail

stealObject

public void stealObject(GameObject obj,
                        Inventory src,
                        Inventory dest)
Tries to steal an object from the defender. Uses some reasonable default messaging if the attempt fails. If the steal was successful, teleports the attacker away.

Parameters:
obj - the object to steal
src - the defender inventory
dest - the attacker inventory

transferObject

protected int transferObject(GameObject obj,
                             Inventory src,
                             Inventory dest)
Attempts to transfer an object from one inventory to another.

Parameters:
obj - the object to transfer
src - the defender's inventory
dest - the attacker's inventory
Returns:
a result code that tells what happened (e.g. got it but dropped it because it was too heavy)

teleport

protected void teleport(Commandable attacker)
Teleports away.