jurpe.system
Class JurpeUtils

java.lang.Object
  extended by jurpe.system.JurpeUtils

public final class JurpeUtils
extends java.lang.Object

Collection of GURPS related rules. Maintains a static variable (roll) to the latest dice roll.

Author:
Alessio Saltarin

Constructor Summary
JurpeUtils()
           
 
Method Summary
static boolean checkCriticalFailure(int roll, int skillLevel)
          Returns true if dice roll is a critical failure
static boolean checkCriticalSuccess(int roll, int skillLevel)
          Returns true if dice roll is a critical success
static int computeCharacterPoints(int pCos, int pDes, int pFor, int pInt)
          Computes character points.
static int computeCharacterPoints(PC pc)
          Computes character points.
static int computeDamage(int damageRoll, int damageResistance)
          Computer damage points when an unarmed attack succeeds.
static int computeWeaponDamage(int damageRoll, DamageMode weaponMode, int damageResistance)
          Computer damage points when an attack succeeds.
static void fullRecovery(PCharacter pc)
          Full recovery
static PCharacter generatePC(CharacterAttributes ca, Skills abilitaDisponibili)
          Creates a Playing Character, with default maximum points.
static PCharacter generatePC(CharacterAttributes ca, Skills abilitaDisponibili, int maximumCharacterPoints)
          Creates a Playing Character
static PrimaryStats generateStats(int characterPoints)
          Generates ST,DX,IQ,HT that matches given character points
static int getFirstAid(int firstAidSkillPoints, int techLevel)
          Computes first aid gained HT points.
static int getFirstAidTime(int techLevel)
          Time needed (in minutes) to get First Aid.
static java.lang.String getFormattedDannoThrust(int frz)
          Utility to display a String with Damage caused by Thrust attack, ie: 1d-1.
static java.lang.String getFormattedSwingDamage(int frz)
          Utility to display a String with Damage caused by Swing attack, ie: 1d-1.
static int getLatestRoll()
          Get the latest roll of dice.
static int getMaxSwingDamage(int frz)
          Utility to compute damage for Swing Attack when die roll is supposed to be 6.
static int getMaxThrustDamage(int frz)
          Utility to compute Damage caused by Thrust attack, when die roll is supposed to be 6.
static int getSwingDamage(int frz)
          Utility to compute damage for Swing Attack It is based on character ST
static int getThrustDamage(int frz)
          Utility to compute Damage caused by Thrust attack, It is based on character ST
static long lootMoney(PC monster, float percentile)
          Returns a sum function of monster character points.
static boolean naturalRecovery(PCharacter pc)
          To use natural recovery you must have a day of rest and decent food (a night at Inn, in this implementation).
static boolean recoverFromUnconsciousness(PCharacter pc)
          To recover from uncosciousness you must rest for your current negative HT points minutes.
static int scoreValue(int punteggio)
          Computes character points for some attributes, such as ST and DX.
static boolean successRoll(int valore)
          Verifies a success roll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JurpeUtils

public JurpeUtils()
Method Detail

generatePC

public static PCharacter generatePC(CharacterAttributes ca,
                                    Skills abilitaDisponibili,
                                    int maximumCharacterPoints)
Creates a Playing Character

Parameters:
ca - Character Attributes
abilitaDisponibili - Skills available (read from Livelli)
maximumCharacterPoints - Points available to create this character
Returns:
PCharacter object
See Also:
Skills, PCharacter, Skill, jurpe.system.CharacterAttributes

generateStats

public static PrimaryStats generateStats(int characterPoints)
Generates ST,DX,IQ,HT that matches given character points

Parameters:
characterPoints - Character Points
Returns:
ST,DX,IQ,HT that matches given character points

generatePC

public static PCharacter generatePC(CharacterAttributes ca,
                                    Skills abilitaDisponibili)
Creates a Playing Character, with default maximum points. (Maximum points are read from Config).

Parameters:
ca - Character Attributes
abilitaDisponibili - Skills available (read from Livelli)
Returns:
PCharacter object
See Also:
Skills, PCharacter, Skill

computeCharacterPoints

public static int computeCharacterPoints(PC pc)
Computes character points.

Parameters:
pc - character to calculate points
Returns:
character points

computeCharacterPoints

public static int computeCharacterPoints(int pCos,
                                         int pDes,
                                         int pFor,
                                         int pInt)
Computes character points.

Parameters:
pCos - character health (HT)
pDes - character dexterity (DX)
pFor - character strength (ST)
pInt - character intelligence (IQ)
Returns:
character points

getFirstAid

public static int getFirstAid(int firstAidSkillPoints,
                              int techLevel)
Computes first aid gained HT points. A minimum of 1 HT point is always restored.

Parameters:
firstAidSkillPoints - Points in First Aid skill
techLevel - Technology Level of the World
Returns:
HT points gained with First Aid Skill, based on tech level

getFirstAidTime

public static int getFirstAidTime(int techLevel)
Time needed (in minutes) to get First Aid.

Parameters:
techLevel - Technology level of this world
Returns:
Minutes needed to get First Aid on a character

successRoll

public static boolean successRoll(int valore)
Verifies a success roll

Parameters:
valore - Value to confront with
Returns:
True, if success

recoverFromUnconsciousness

public static boolean recoverFromUnconsciousness(PCharacter pc)
To recover from uncosciousness you must rest for your current negative HT points minutes. (You set that at the Inn). Furthermore you roll against HT. If you fail you remain in coma.

Parameters:
pc - Unconscious character that needs to recover
Returns:
true if character successfully recovered.
See Also:
Inn

naturalRecovery

public static boolean naturalRecovery(PCharacter pc)
To use natural recovery you must have a day of rest and decent food (a night at Inn, in this implementation). With this you roll against HT. If success, you gain 1 HT point.

Parameters:
pc - PCharacter that needs recovery
Returns:
true if character recovers naturally

fullRecovery

public static void fullRecovery(PCharacter pc)
Full recovery

Parameters:
pc - PCharacter that needs recovery

getLatestRoll

public static int getLatestRoll()
Get the latest roll of dice.

Returns:
the latest dice roll

lootMoney

public static long lootMoney(PC monster,
                             float percentile)
Returns a sum function of monster character points. You will have xx probabilities to find money. If you found money, the amount is computed as a random range between 0 and character points.

Parameters:
monster - reference to a PC
percentile - number between 0 and 1. Probability to find some money.
Returns:
money looted to monster

checkCriticalSuccess

public static boolean checkCriticalSuccess(int roll,
                                           int skillLevel)
Returns true if dice roll is a critical success

Parameters:
roll - dice roll
skillLevel - character skill level
Returns:
true, if hit is critical

checkCriticalFailure

public static boolean checkCriticalFailure(int roll,
                                           int skillLevel)
Returns true if dice roll is a critical failure

Parameters:
roll - dice roll
skillLevel - character skill level
Returns:
true, if dice roll is a critical failure

getFormattedSwingDamage

public static java.lang.String getFormattedSwingDamage(int frz)
Utility to display a String with Damage caused by Swing attack, ie: 1d-1. It is based on character ST

Parameters:
frz - PCharacter ST
Returns:
String such as 1d+2

getSwingDamage

public static int getSwingDamage(int frz)
Utility to compute damage for Swing Attack It is based on character ST

Parameters:
frz - PCharacter ST
Returns:
damage, based on dice rolls

getMaxSwingDamage

public static int getMaxSwingDamage(int frz)
Utility to compute damage for Swing Attack when die roll is supposed to be 6. It is based on character ST

Parameters:
frz - PCharacter ST
Returns:
damage, based on dice rolls

getFormattedDannoThrust

public static java.lang.String getFormattedDannoThrust(int frz)
Utility to display a String with Damage caused by Thrust attack, ie: 1d-1. It is based on character ST

Parameters:
frz - PCharacter ST
Returns:
String like "1d-1"

getThrustDamage

public static int getThrustDamage(int frz)
Utility to compute Damage caused by Thrust attack, It is based on character ST

Parameters:
frz - PCharacter ST
Returns:
damage, based on dice rolls

getMaxThrustDamage

public static int getMaxThrustDamage(int frz)
Utility to compute Damage caused by Thrust attack, when die roll is supposed to be 6. It is based on character ST

Parameters:
frz - PCharacter ST
Returns:
damage, based on dice rolls

computeDamage

public static int computeDamage(int damageRoll,
                                int damageResistance)
Computer damage points when an unarmed attack succeeds. Effective damage depends on

Parameters:
damageRoll - dice roll for damage
damageResistance - armor points of defender
Returns:
effective damage done

computeWeaponDamage

public static int computeWeaponDamage(int damageRoll,
                                      DamageMode weaponMode,
                                      int damageResistance)
Computer damage points when an attack succeeds. Effective damage depends on

Parameters:
damageResistance - armor points of defender
damageRoll - dice roll for damage
weaponMode - mode of attack (ie: Weapon.MODE_CRU)
Returns:
effective damage done
See Also:
Weapon

scoreValue

public static int scoreValue(int punteggio)
Computes character points for some attributes, such as ST and DX. For instance, a ST 6 is valued -30 character points. It is useful in character creation and points computation.

Parameters:
punteggio - Attribute value to compute correspondent character points
Returns:
Number to add to current character points

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