jurpe.characters
Class PCharacter

java.lang.Object
  extended by jurpe.characters.BasicPC
      extended by jurpe.characters.PC
          extended by jurpe.characters.PCharacter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class PCharacter
extends PC
implements java.io.Serializable

Playing Character Type

Author:
Alessio Saltarin
See Also:
PC, Serialized Form

Constructor Summary
PCharacter(CharacterAttributes ca, int points, Skills lvl)
          Constructor.
 
Method Summary
 void addToAvailablePoints(float points)
          Add points to available experience level.
 void addToScore(int points)
          Add points to current score for this character.
 AllOutAttackType getAllOutAttackType()
          Every character must choose a type of AllOutAttack.
 java.lang.Object[][] getAllSkills()
          Get all skills learned by this character and their name and level.
 float getAvailablePoints()
          Get Total Available Points for this PCharacter
 int getBareHandsSkill()
          Get current skill in unarmed combat.
 int getBlockPoints()
          Get character block points
 PCharacterSkill getCharacterSkill(Skill skill)
          Get a Skill learned by this character (PCharacterSkill)
 PCharacterSkill getCharacterSkill(java.lang.String name)
          Get a Skill learned by this character (PCharacterSkill)
 java.lang.String getCrushDamage()
          Get current Thrust Damage (description)
 Armor getCurrentArmor()
          Get current armor.
 Item getCurrentItem()
          Get current item
 int getCurrentMerchantLevel()
          Get current merchant skill level
 Shield getCurrentShield()
          Get current shield (character wears shield)
 int getCurrentShieldLevel()
          Get current shield skill level
 Weapon getCurrentWeapon()
          Get current weapon
 int getCurrentWeaponLevel()
          Get current weapon skill level
 int getCustomizedCost(BasicItem item)
          When character IS BUYING an item, he will be asked for this cost because of his Merchant skill
 int getCustomizedPrice(BasicItem item)
          When character IS SELLING an item, he will be offered this price because of his Merchant skill
 int getDamageRoll()
          Get Damage, after having made a success attack.
 int getDodgePoints()
          Get character dodge points
 int getEncumbrance()
          Get character encumbrance
 int getEncumbranceLevel()
          Encumbrance level is a measure of weight relative to strength.
 java.lang.String getHTHP()
          If a character is human, he will have his HT value (ie: 12) If a character is a beast, he will have HT in the form HT/current HP (ie: 12/16)
 Inventory getInventory()
          Get reference to character inventory
 int getMaxDamage()
          Get maximum damage.
 int getMaximumHP()
          Playing characters have HP=HT
 int getMvmt()
          Get MVMT (Movement).
 int getNrSkills()
          Get how many skills this character learned.
 int getParryPoints()
          Get character parry points
 int getPersonalScore()
          Player personal score
 int getScore()
          Get current score for this character.
 SexType getSexType()
          Every character must choose a sex
 int getSkillLevel(java.lang.String nomeAbilita)
          Get PCharacter Skill Level
 Skills getSkillLevels()
          Get player's skills
 float getSpentPoints()
          Get Spent Points for this character.
 java.lang.String getSwingDamage()
          Get current Swing Damage (description)
 float getTotalActiveDefenses()
          Get total active defense for this character.
 float getTotalPassiveDefenses()
          Get total passive defense.
 float getUnspentPoints()
          Get Unspent PCharacter Points.
 boolean hasSkill(PCharacterSkill skill)
           
 boolean improveSkill(PCharacterSkill skill, float cost)
          Improve Skill Level
 boolean improveSkill(java.lang.String name, float cost)
          Improve Skill Level
 boolean isAlive()
          A character is alive if:
Has HT>0 Failed a roll on MaximumHT if CurrentHO <=0 Lost a total of 1 times MaximumHT
 boolean isReady()
          You are ready if: - you are unarmed - you are using a weapon which is ready
 boolean isSaved()
          If the character has been saved lately.
 boolean isShielded()
          Returns true if character wears a shield.
 boolean learnSkill(PCharacterSkill a, float cost)
          Add skill to character.
 void setAllOutAttackType(AllOutAttackType all)
          Use this function to change current type of AllOutAttack
 void setAvailablePoints(float f)
           
 void setCrushDamage(java.lang.String string)
           
 boolean setCurrentArmor(Armor armatura)
          Set current armor.
 boolean setCurrentItem(Item item)
          Set current item.
 boolean setCurrentShield(Shield scudo)
          Set current shield (character wears shield).
 boolean setCurrentWeapon(Weapon arma)
          Set current weapon
 void setInventory(Inventory inventory)
          Set player inventory
 void setPersonalScore(int i)
          Set player personal score
 void setSaved()
          The character has been saved (persisted) to a file
 void setSaved(boolean s)
          The character has/has not been saved to a file
 void setSkillLevels(Skills skills)
          Set player skill levels
 void setSkills(Skills livelli)
          Set available skills for this game.
 void setSwingDamage(java.lang.String string)
           
 
Methods inherited from class jurpe.characters.PC
addToCurrentHP, clone, getActiveDefense, getActiveDefenses, getActiveDefensesAvailable, getFormattedVel, getInfo, getName, isArmed, isUnconscious, receiveDamage, restoreHP, rollForLife, setActiveDefense, setActiveDefenseAvailability, setActiveDefenses, setAlive, setUnconscious, toString
 
Methods inherited from class jurpe.characters.BasicPC
compareTo, getCharacterAttributes, getCurrentHP, getDamageResistance, getHT, getPassiveDefense, getPrimaryStats, getShortDescription, isAI, setAI, setCharacterAttributes, setDamageResistance, setPassiveDefense
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

PCharacter

public PCharacter(CharacterAttributes ca,
                  int points,
                  Skills lvl)
Constructor.

Parameters:
ca - Character Attributes (Name, DX, ST, etc)
points - PCharacter Overall Available Points / total available points for this character
lvl - Available Skills
See Also:
CharacterAttributes
Method Detail

isSaved

public boolean isSaved()
If the character has been saved lately. Usually every "set" method on character puts saved in false state.

Returns:
True if the character has been saved

setSaved

public void setSaved()
The character has been saved (persisted) to a file


setSaved

public void setSaved(boolean s)
The character has/has not been saved to a file


getAvailablePoints

public float getAvailablePoints()
Get Total Available Points for this PCharacter

Returns:
PCharacter Points (used or not)

getUnspentPoints

public float getUnspentPoints()
Get Unspent PCharacter Points. Difference between Total Points and Spent Points.

Returns:
Unspent character points.

getSpentPoints

public float getSpentPoints()
Get Spent Points for this character. It computes current points "value" of this character.

Returns:
Spent PCharacter Points

addToAvailablePoints

public void addToAvailablePoints(float points)
Add points to available experience level.

Parameters:
points - to add to experience level.

addToScore

public void addToScore(int points)
Add points to current score for this character.

Parameters:
points - Points to add

getScore

public int getScore()
Get current score for this character.

Returns:
score points.

getAllOutAttackType

public AllOutAttackType getAllOutAttackType()
Every character must choose a type of AllOutAttack.

Specified by:
getAllOutAttackType in class PC
Returns:
type of all out attack for this character
See Also:
AllOutAttackType

setAllOutAttackType

public void setAllOutAttackType(AllOutAttackType all)
Use this function to change current type of AllOutAttack

Parameters:
all - All Out attack for this character
See Also:
AllOutAttackType

getSexType

public SexType getSexType()
Every character must choose a sex

Returns:
sex for this character
See Also:
SexType

setSkills

public void setSkills(Skills livelli)
Set available skills for this game. Use it when restoring character after serialization.

Parameters:
livelli - Current livelli active reference.

getSkillLevel

public int getSkillLevel(java.lang.String nomeAbilita)
Get PCharacter Skill Level

Parameters:
nomeAbilita - name of skill
Returns:
Skill Level

getCharacterSkill

public PCharacterSkill getCharacterSkill(Skill skill)
Get a Skill learned by this character (PCharacterSkill)

Parameters:
skill - generic skill
Returns:
PCharacterSkill object. If character did not learned this skill, it returns null.
See Also:
PCharacterSkill

getCharacterSkill

public PCharacterSkill getCharacterSkill(java.lang.String name)
Get a Skill learned by this character (PCharacterSkill)

Parameters:
name - name of skill
Returns:
PCharacterSkill object. If character did not learned this skill, it returns null.
See Also:
PCharacterSkill

improveSkill

public boolean improveSkill(java.lang.String name,
                            float cost)
Improve Skill Level

Parameters:
name - name of skill
cost - cost in character point to spend to get this skill improved
Returns:
true if skill was correctly improved

improveSkill

public boolean improveSkill(PCharacterSkill skill,
                            float cost)
Improve Skill Level

Parameters:
skill - Character's skill to improve
cost - cost in character point to spend to get this skill improved
Returns:
true if skill was correctly improved

setCurrentWeapon

public boolean setCurrentWeapon(Weapon arma)
Set current weapon

Parameters:
arma - Weapon (Weapon) object
Returns:
true, if weapon is now the current weapon
See Also:
Weapon

getCurrentWeapon

public Weapon getCurrentWeapon()
Get current weapon

Specified by:
getCurrentWeapon in class PC
Returns:
arma Weapon (Weapon) object
See Also:
Weapon

getCurrentWeaponLevel

public int getCurrentWeaponLevel()
Get current weapon skill level

Specified by:
getCurrentWeaponLevel in class PC
Returns:
skill level
See Also:
Weapon

getCurrentShieldLevel

public int getCurrentShieldLevel()
Get current shield skill level

Specified by:
getCurrentShieldLevel in class PC
Returns:
skill level with shield
See Also:
Shield

getCurrentMerchantLevel

public int getCurrentMerchantLevel()
Get current merchant skill level

Returns:
skill level in buying/selling items.

isReady

public boolean isReady()
You are ready if: - you are unarmed - you are using a weapon which is ready

Specified by:
isReady in class PC
Returns:
true, if character is ready to attack

setCurrentArmor

public boolean setCurrentArmor(Armor armatura)
Set current armor. (PCharacter wears armor).

Parameters:
armatura - Armor (Armor) object
Returns:
true, if character can wear armor
See Also:
Armor

getCurrentArmor

public Armor getCurrentArmor()
Get current armor. (PCharacter wears armor).

Returns:
Armor (Armor) object
See Also:
Armor

setCurrentShield

public boolean setCurrentShield(Shield scudo)
Set current shield (character wears shield). If null, character unwears shield.

Parameters:
scudo - Shield (Shield) object
Returns:
true, if character can wear shield
See Also:
Shield

getCurrentShield

public Shield getCurrentShield()
Get current shield (character wears shield)

Returns:
Shield (Shield) object
See Also:
Shield

getMaximumHP

public int getMaximumHP()
Playing characters have HP=HT

Returns:
initial Hit Points

isShielded

public boolean isShielded()
Returns true if character wears a shield.

Overrides:
isShielded in class PC
Returns:
true, if character wears a shield.

setCurrentItem

public boolean setCurrentItem(Item item)
Set current item. If item is null, character unwears it.

Parameters:
item - Item object
Returns:
true if item was correctly set
See Also:
Item

getCurrentItem

public Item getCurrentItem()
Get current item

Returns:
item Item object
See Also:
Item

getSwingDamage

public java.lang.String getSwingDamage()
Get current Swing Damage (description)

Returns:
printable Swing Damage

getCrushDamage

public java.lang.String getCrushDamage()
Get current Thrust Damage (description)

Returns:
printable Thrust Damage

getEncumbranceLevel

public int getEncumbranceLevel()
Encumbrance level is a measure of weight relative to strength. Since original Jurpe rules define encumbrance level in terms of lb, a conversion is defined.

Returns:
encumbrance level

getMvmt

public int getMvmt()
Get MVMT (Movement).

Specified by:
getMvmt in class PC
Returns:
character movement

getParryPoints

public int getParryPoints()
Get character parry points

Returns:
character parry points

getDodgePoints

public int getDodgePoints()
Get character dodge points

Returns:
character parry points

getBlockPoints

public int getBlockPoints()
Get character block points

Returns:
character parry points

getEncumbrance

public int getEncumbrance()
Get character encumbrance

Returns:
encumbrance

getInventory

public Inventory getInventory()
Get reference to character inventory

Returns:
Inventory (Inventory) object
See Also:
Inventory

hasSkill

public boolean hasSkill(PCharacterSkill skill)

learnSkill

public boolean learnSkill(PCharacterSkill a,
                          float cost)
Add skill to character. Checks if a is not yet learned

Parameters:
a - PCharacter Skill (PCharacterSkill)
cost - Cost of skill to learn
Returns:
true, if character succesfully learned this skill
See Also:
PCharacterSkill

getAllSkills

public java.lang.Object[][] getAllSkills()
Get all skills learned by this character and their name and level. Displayable by a grid.

Returns:
array [ability][properties]

getNrSkills

public int getNrSkills()
Get how many skills this character learned.

Returns:
number of skill learned

getTotalPassiveDefenses

public float getTotalPassiveDefenses()
Get total passive defense.

Specified by:
getTotalPassiveDefenses in class PC
Returns:
sum of RD and DP for this character

getTotalActiveDefenses

public float getTotalActiveDefenses()
Get total active defense for this character. Total active defenses can't be unavailable more than one time. This function restores availability of active defenses.

Specified by:
getTotalActiveDefenses in class PC
Returns:
defense based on dodge/parry/block.

getDamageRoll

public int getDamageRoll()
Get Damage, after having made a success attack. Damage is based on current weapon mode and current character strength

Specified by:
getDamageRoll in class PC
Returns:
Damage value

getMaxDamage

public int getMaxDamage()
Get maximum damage. All rolls at 6.

Specified by:
getMaxDamage in class PC
Returns:
Critical Damage Value

getBareHandsSkill

public int getBareHandsSkill()
Get current skill in unarmed combat.

Specified by:
getBareHandsSkill in class PC
Returns:
0

isAlive

public boolean isAlive()
A character is alive if:

Specified by:
isAlive in class PC
Returns:
false if character is dead

getCustomizedCost

public int getCustomizedCost(BasicItem item)
When character IS BUYING an item, he will be asked for this cost because of his Merchant skill

Parameters:
item - Item to buy
Returns:
cost of item

getCustomizedPrice

public int getCustomizedPrice(BasicItem item)
When character IS SELLING an item, he will be offered this price because of his Merchant skill

Parameters:
item - Item to sell
Returns:
price of item

getHTHP

public java.lang.String getHTHP()
If a character is human, he will have his HT value (ie: 12) If a character is a beast, he will have HT in the form HT/current HP (ie: 12/16)

Returns:
String describing HT/HP

setAvailablePoints

public void setAvailablePoints(float f)
Parameters:
f -

getPersonalScore

public int getPersonalScore()
Player personal score

Returns:
Player personal score

setPersonalScore

public void setPersonalScore(int i)
Set player personal score

Parameters:
i - Player score

setInventory

public void setInventory(Inventory inventory)
Set player inventory

Parameters:
inventory - Inventory

getSkillLevels

public Skills getSkillLevels()
Get player's skills

Returns:
Player's skills

setSkillLevels

public void setSkillLevels(Skills skills)
Set player skill levels

Parameters:
skills - Skill levels

setSwingDamage

public void setSwingDamage(java.lang.String string)
Parameters:
string -

setCrushDamage

public void setCrushDamage(java.lang.String string)
Parameters:
string -

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