wyvern.kernel.combat
Class BodyPart

java.lang.Object
  extended bywyvern.kernel.combat.BodyPart
Direct Known Subclasses:
Arm, AttackingBodyPart, Claw, CloakTorso, Foot, Head, Leg, LongTorso, Neck, Tail, Torso, Waist, Wing, Wrist

public abstract class BodyPart
extends java.lang.Object

This is the superclass for all specific body parts (hand, foot, etc). BodyParts aren't wieldable per se, but can sometimes be used as attacks. Those that can implement the Attack interface.

Version:
1.0, Jun 08, 1998
Author:
Steve Yegge

Field Summary
protected  int hitWeight_
           
protected  java.lang.String name_
           
protected  java.lang.String pluralName_
           
protected  ItemSlot[] slots_
           
protected  java.lang.String uniqueName_
          The unique part name in the list, for shapes that have multiples of the same type of part.
 
Constructor Summary
BodyPart()
           
 
Method Summary
 boolean equals(java.lang.Object ob)
          Returns true if this part is has the same properties as the passed part.
 java.lang.String getName()
          Returns the singular name of the part (e.g.
 java.lang.String getPluralName()
          Returns the plural name of the part (e.g.
 int getProbability()
          Returns the probability weight of this part, for purposes of computing hit-locations.
 ItemSlot[] getSlots()
          Returns a list of the slots this body part provides.
 int getTotalAC(DamageType dtype)
          Computes the total AC for the given body part, by summing the ACs of any armor covering the part.
 java.lang.String getUniqueName()
          Returns the unique name for the part, such as "left foot".
 BodyPart makeClone()
          Clones this body part.
protected  void makeSingleSlot(ItemSlot slot)
          Takes the passed slot and stores it in an array of length 1.
 void setName(java.lang.String name)
          Sets the singular name of the part (e.g.
 void setPluralName(java.lang.String plural)
          Sets the plural name of the part (e.g.
 void setProbability(int weight)
          Sets the new hit-location "weight" for this body part.
 void setUniqueName(java.lang.String name)
          Sets a unique name for the object.
 java.lang.String toString()
          Prints String rep.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

slots_

protected ItemSlot[] slots_

hitWeight_

protected int hitWeight_

name_

protected java.lang.String name_

pluralName_

protected java.lang.String pluralName_

uniqueName_

protected java.lang.String uniqueName_
The unique part name in the list, for shapes that have multiples of the same type of part. Required so we can externalize them with different sub-properties than the parent versions.

Constructor Detail

BodyPart

public BodyPart()
Method Detail

getName

public java.lang.String getName()
Returns the singular name of the part (e.g. "foot")


setName

public void setName(java.lang.String name)
Sets the singular name of the part (e.g. "foot")


getPluralName

public java.lang.String getPluralName()
Returns the plural name of the part (e.g. "feet")


setPluralName

public void setPluralName(java.lang.String plural)
Sets the plural name of the part (e.g. "feet")


setUniqueName

public void setUniqueName(java.lang.String name)
Sets a unique name for the object.


getUniqueName

public java.lang.String getUniqueName()
Returns the unique name for the part, such as "left foot". Each body type will define unique names for the parts.

Returns:
a unique name for the part, or just the name if the unique name isn't set. E.g. if you only have one head in the body, it'll return "head", but if you have two, you need to specify "left head" and "right head" (or "head1" and "head2", or whatever)

getSlots

public ItemSlot[] getSlots()
Returns a list of the slots this body part provides.


getProbability

public int getProbability()
Returns the probability weight of this part, for purposes of computing hit-locations.

Returns:
the body part's relative weight

setProbability

public void setProbability(int weight)
Sets the new hit-location "weight" for this body part.

Parameters:
weight - the new weight.

makeSingleSlot

protected void makeSingleSlot(ItemSlot slot)
Takes the passed slot and stores it in an array of length 1.


toString

public java.lang.String toString()
Prints String rep.


equals

public boolean equals(java.lang.Object ob)
Returns true if this part is has the same properties as the passed part.


getTotalAC

public int getTotalAC(DamageType dtype)
Computes the total AC for the given body part, by summing the ACs of any armor covering the part.

Parameters:
dtype - the DamageType to protect against
Returns:
the total AC for the part

makeClone

public BodyPart makeClone()
                   throws java.lang.Exception
Clones this body part.

Throws:
java.lang.Exception