org.haphazard.character.body
Class BodyPart

java.lang.Object
  extended byorg.haphazard.character.body.BodyPart
Direct Known Subclasses:
Arm, Breast, Head, Leg

public class BodyPart
extends java.lang.Object

Abstract class that denotes a location on a characters body.


Field Summary
protected  java.util.Vector mClothes
          Clothes on this bodypart
protected  int mSlots
          How large the part is (ie. how easy it is to hit)
 
Constructor Summary
BodyPart()
          Creates a new instance of BodyPart
BodyPart(java.lang.String name)
          Creates a bodypart with a specific name
 
Method Summary
 void addWound(int severity)
          Adds a wound to the location
 boolean canWear(Clothes clothes)
          Checks if the character can wear the specified clothes
 java.util.Vector getAllClothes()
          Gets all the clothes the character is wearing
 int getArmorValue()
          Gets the total armor value of this part
 int getCritical()
          Gets how critical this part is The higher the more critical the part is
 int getLocation()
          Gets the location of this part
 java.lang.String getName()
          Returns the name of this bodypart
 int getPenalty()
          Gets the wound penalty of this body part
 javax.swing.tree.DefaultMutableTreeNode getTreeNode()
          Gets a node view over every thing in this bodypart
 int getWound()
          Gets the maximum type of wound this bodypart has
 void heal()
          Heals the part one step towards healthy
 boolean isHit(int location)
          Checks if a location is hit
 boolean isPrimary()
          Checks if this is a primary bodypart Useful for example hands
 boolean isWearing(Clothes clothes)
          Checks if the character is wearing the specific clothes
 void setName(java.lang.String name)
          Sets the name of the part
 void setNaturalArmor(int points)
          Sets the amount of natural armor this bodypart gives
 int setToHit(int start)
          Sets the to hit start value of the part
 void status()
          Prints the status of this part
 java.lang.String toString()
          Returns a string representation of this object
 java.lang.String toXML(int indent)
          Transforms this object into an XML-notation
 boolean undress(Clothes clothes)
          Undresses the specific clothes from this bodypart
 void wear(Clothes clothes)
          Wears clothes on this bodypart
 int wound(int damage)
          Gives the part a new wound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mSlots

protected int mSlots
How large the part is (ie. how easy it is to hit)


mClothes

protected java.util.Vector mClothes
Clothes on this bodypart

Constructor Detail

BodyPart

public BodyPart()
Creates a new instance of BodyPart


BodyPart

public BodyPart(java.lang.String name)
Creates a bodypart with a specific name

Parameters:
name - The name the part should be known under
Method Detail

getName

public java.lang.String getName()
Returns the name of this bodypart

Returns:
The name of the part

setName

public void setName(java.lang.String name)
Sets the name of the part

Parameters:
name - The name of the bodypart

isPrimary

public boolean isPrimary()
Checks if this is a primary bodypart Useful for example hands

Returns:
false

wear

public void wear(Clothes clothes)
Wears clothes on this bodypart

Parameters:
clothes - The clothes to wear

undress

public boolean undress(Clothes clothes)
Undresses the specific clothes from this bodypart

Parameters:
clothes - The clothes to remove
Returns:
True if successful

isWearing

public boolean isWearing(Clothes clothes)
Checks if the character is wearing the specific clothes

Parameters:
clothes - The clothes to check against
Returns:
True if the character is wearing the clothes

canWear

public boolean canWear(Clothes clothes)
Checks if the character can wear the specified clothes

Parameters:
clothes - The clothes to check against
Returns:
True if the character can wear the clothes

getAllClothes

public java.util.Vector getAllClothes()
Gets all the clothes the character is wearing

Returns:
A vector of clothes or null if none

setNaturalArmor

public void setNaturalArmor(int points)
Sets the amount of natural armor this bodypart gives

Parameters:
points - The number of armor points this part has

getArmorValue

public int getArmorValue()
Gets the total armor value of this part

Returns:
The total number of armor points (natural + clothing)

status

public void status()
Prints the status of this part


getCritical

public int getCritical()
Gets how critical this part is The higher the more critical the part is

Returns:
A number, the higher, the more critical

addWound

public void addWound(int severity)
Adds a wound to the location

Parameters:
severity - 0 for stun, 1 for ligth wound, 2 for wound, 3 for severe wound

getWound

public int getWound()
Gets the maximum type of wound this bodypart has

Returns:
0 for none, 1 for light wound, 2 for wound, 3 for severe wound

getPenalty

public int getPenalty()
Gets the wound penalty of this body part

Returns:
The number of blips of penalty

wound

public int wound(int damage)
Gives the part a new wound

Parameters:
damage - The damage inflicted
Returns:
The wounds severity

heal

public void heal()
Heals the part one step towards healthy


isHit

public boolean isHit(int location)
Checks if a location is hit

Parameters:
location - The to hit number
Returns:
true if hit

setToHit

public int setToHit(int start)
Sets the to hit start value of the part

Parameters:
start - Which number the to hit value starts at
Returns:
The number the to hit value stops at

getLocation

public int getLocation()
Gets the location of this part

Returns:
The lower to hit value of the part

getTreeNode

public javax.swing.tree.DefaultMutableTreeNode getTreeNode()
Gets a node view over every thing in this bodypart

Returns:
A tree node to be displayed

toXML

public java.lang.String toXML(int indent)
Transforms this object into an XML-notation

Parameters:
indent - The indentation level to use
Returns:
The object in an XML notation

toString

public java.lang.String toString()
Returns a string representation of this object

Returns:
A string representation of this object