jurpe.characters
Class PCharacterSkill

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

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

It's a type that defines a skill associated to a PCharacter. PCharacterSkill differs from Skill in being associated with a level, and maintained as an attribute of a Charater. For instance, while Skill may be 'Sword', PCharacterSkill is the 'Sword' skill learned by current character at level 14.

Author:
Alessio Saltarin
See Also:
Skill, Serialized Form

Constructor Summary
PCharacterSkill(Skill aA, int aLivello)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object e)
          An PCharacterSkill is equal to another if they have THE SAME NAME.
 int getLevel()
          Returns the current level of the ability
 java.lang.String getName()
          Returns the name of the ability
 Skill getSkill()
          Returns the Skill associated with this current ability.
 int hashCode()
          Return hash key for object.
 void improveSkillLevel(int delta)
          Add "delta" to the current ability level
 java.lang.String toString()
          Returns the name and level of ability
 java.lang.String[] toStrings()
          Returns an array of Strings that describes the PCharacterSkill.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PCharacterSkill

public PCharacterSkill(Skill aA,
                       int aLivello)
Constructor

Parameters:
aA - Ability
aLivello - current level
Method Detail

toString

public java.lang.String toString()
Returns the name and level of ability

Overrides:
toString in class java.lang.Object
Returns:
The name and level of ability

equals

public boolean equals(java.lang.Object e)
An PCharacterSkill is equal to another if they have THE SAME NAME. (IE: A character cannot have two abilities with the same name)

Overrides:
equals in class java.lang.Object
Parameters:
e - PCharacterSkill to confront with.
Returns:
true if argument is equal to this

hashCode

public int hashCode()
Return hash key for object. For our purposes, the hash is made upon the letter of the name of the skill

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

getName

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

Returns:
The name and level of ability

getLevel

public int getLevel()
Returns the current level of the ability

Returns:
The name and level of ability

improveSkillLevel

public void improveSkillLevel(int delta)
Add "delta" to the current ability level

Parameters:
delta - Number of levels to add to current ability level

toStrings

public java.lang.String[] toStrings()
Returns an array of Strings that describes the PCharacterSkill. Dialog Box needs it to display info.

Returns:
Array of 4 strings to describe current ability.

getSkill

public Skill getSkill()
Returns the Skill associated with this current ability.

Returns:
Skill associated with this current ability.

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