jurpe.characters
Class PrimaryStats

java.lang.Object
  extended by jurpe.characters.PrimaryStats
All Implemented Interfaces:
java.io.Serializable

public class PrimaryStats
extends java.lang.Object
implements java.io.Serializable

Utility class to hold character's primary statistics for PC and NPC (ST,DX,HT,IQ)

See Also:
Serialized Form

Constructor Summary
PrimaryStats()
          Default Primary Statistics
PrimaryStats(int s, int d, int h, int i)
          Primary Statistics
PrimaryStats(int s, int d, int h, int i, int hp)
          Primary Statistics
 
Method Summary
 void addFatigue(int f)
          Add f points of fatigue to character.
 void addToHP(int points)
          Add points to current hit points.
 boolean equals(java.lang.Object e)
          Equals condition for PrimaryStats
 int getCurrentHitPoints()
          Current Hit Points
 int getDX()
          Get character's DX
 int getFatigue()
          Get Fatigue
 java.lang.String getHPvsHPMAX()
          Get a string [current HP]/[HP max]
 int getHT()
          Get character's HT
 int getInitialHitPoints()
          Initial Hit Points = Hit Points may differ from HT if character is non-human
 int getIQ()
          Get character's IQ
 int getMove()
          Movement.
 float getSpeed()
          Get character's speed (HP+DX)/4
 int getST()
          Get character's ST
 int getSTminusFatigue()
          Get character's ST computing fatigue
 int hashCode()
          Hash code.
 void restoreHitPoints()
          Set current hit points to initial hit points (full health)
 void setCurrentHitPoints(int hp)
          Set Hit Points
 void setDX(int d)
          Set character's DX
 void setFatigue(int f)
          Set Fatigue.
 void setHitPoints(int hp)
          Set Hit Points (remaining points before death)
 void setHT(int h)
          Set character's HT
 void setIQ(int i)
          Set character's IQ
 void setST(int s)
          Set character's ST (do not compute fatigue here.
 java.lang.String toString()
          To string
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrimaryStats

public PrimaryStats()
Default Primary Statistics


PrimaryStats

public PrimaryStats(int s,
                    int d,
                    int h,
                    int i)
Primary Statistics

Parameters:
s - Strength
d - Dexterity
h - Health
i - Intelligence

PrimaryStats

public PrimaryStats(int s,
                    int d,
                    int h,
                    int i,
                    int hp)
Primary Statistics

Parameters:
s - Strength
d - Dexterity
h - Health
i - Intelligence
hp - Hit Points
Method Detail

addFatigue

public void addFatigue(int f)
Add f points of fatigue to character. Fatigue is added to current fatigue points. If f adds more fatigue than initial strength, f is set to this.ST

Parameters:
f - Fatigue points to add to current fatigue

setFatigue

public void setFatigue(int f)
Set Fatigue. Can be any number between 0 and this.ST

Parameters:
f - Character fatigue.

getFatigue

public int getFatigue()
Get Fatigue

Returns:
Fatigue. This number is the number to subtract to this.ST in order to get the actual ST of a character

setHitPoints

public void setHitPoints(int hp)
Set Hit Points (remaining points before death)

Parameters:
hp - Hit Points

getInitialHitPoints

public int getInitialHitPoints()
Initial Hit Points = Hit Points may differ from HT if character is non-human

Returns:
hit points original value

getCurrentHitPoints

public int getCurrentHitPoints()
Current Hit Points

Returns:
current hit points

getHPvsHPMAX

public java.lang.String getHPvsHPMAX()
Get a string [current HP]/[HP max]

Returns:
[current HP]/[HP max]

setCurrentHitPoints

public void setCurrentHitPoints(int hp)
Set Hit Points

Parameters:
hp - Character's hit points

restoreHitPoints

public void restoreHitPoints()
Set current hit points to initial hit points (full health)


addToHP

public void addToHP(int points)
Add points to current hit points.

Parameters:
points - Points to add to current hit points. If points to be added will result in current HP > than initial HP, HP will be restored to initial HP.

setST

public void setST(int s)
Set character's ST (do not compute fatigue here. Set fatigue first).

Parameters:
s - Character overall strength

setDX

public void setDX(int d)
Set character's DX

Parameters:
d - Dexterity

setHT

public void setHT(int h)
Set character's HT

Parameters:
h - Health

setIQ

public void setIQ(int i)
Set character's IQ

Parameters:
i - Intelligence

getST

public int getST()
Get character's ST

Returns:
Character's strength (without computing fatigue)

getSTminusFatigue

public int getSTminusFatigue()
Get character's ST computing fatigue

Returns:
Character's strength (computing fatigue)

getDX

public int getDX()
Get character's DX

Returns:
Character's dexterity

getHT

public int getHT()
Get character's HT

Returns:
Character's health

getIQ

public int getIQ()
Get character's IQ

Returns:
Character's intelligence

getSpeed

public float getSpeed()
Get character's speed (HP+DX)/4

Returns:
Character's speed

getMove

public int getMove()
Movement. Equals to speed, rounded to closest integer.

Returns:
Movement value

hashCode

public int hashCode()
Hash code. Very basic.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code

equals

public boolean equals(java.lang.Object e)
Equals condition for PrimaryStats

Overrides:
equals in class java.lang.Object
Parameters:
e - Object to confront with
Returns:
true if e has same values as this

toString

public java.lang.String toString()
To string

Overrides:
toString in class java.lang.Object

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