jurpe.combat
Class WeaponDamage

java.lang.Object
  extended by jurpe.combat.WeaponDamage

public class WeaponDamage
extends java.lang.Object

This class describe the damage done by a weapon. The damage is decribed by a damage type (SWING, THRUST...) and a modifier


Constructor Summary
WeaponDamage(DamageType damageType, int mod)
          Constructor
WeaponDamage(int tdSW, int tdTH)
          Constructor.
 
Method Summary
 int getModifier()
          Get modifier for this DamageType, ie: in SWING+3 modifier is 3.
 DamageType getType()
          Get the damage type
 boolean isValid()
          If this DamageType is valid for the weapon
 void setModifier(int modifier)
          Set modifier for this DamageType, ie: in SWING+3 modifier is 3.
 java.lang.String toString()
          Return description of weapon.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeaponDamage

public WeaponDamage(DamageType damageType,
                    int mod)
Constructor

Parameters:
damageType - Either DamageType.SWING or DamageType.THRUST
mod - modifier value for this attack type

WeaponDamage

public WeaponDamage(int tdSW,
                    int tdTH)
Constructor. This constructor is used when reading values from XML files containing weapons description. A typical weapon can be: KNIFE(2,3) This means: Knife makes 2 damages when in swing mode, and 3 damages when in thrust mode.

Parameters:
tdSW - Damage for SWING mode (DamageType.INVALID if this is not a Swing attack)
tdTH - Damage for THRUST mode (DamageType.INVALID if this is not a Thrust attack)
Method Detail

getType

public DamageType getType()
Get the damage type

Returns:
Damage type

getModifier

public int getModifier()
Get modifier for this DamageType, ie: in SWING+3 modifier is 3.

Returns:
modifier Modifier for this DamageType

setModifier

public void setModifier(int modifier)
Set modifier for this DamageType, ie: in SWING+3 modifier is 3.

Parameters:
modifier - Modifier for this DamageType

isValid

public boolean isValid()
If this DamageType is valid for the weapon


toString

public java.lang.String toString()
Return description of weapon.

Overrides:
toString in class java.lang.Object
Returns:
weapon description

Jurpe - Java Universal Role Playing Engine - http://jurpe.sourceforge.net