OGS Java API Spec

ogs.core
Class Ability

java.lang.Object
  |
  +--ogs.support.Object
        |
        +--ogs.core.Ability
All Implemented Interfaces:
EventListener
Direct Known Subclasses:
Charisma, Intelligence, Strength, Wisdom

public class Ability
extends Object

A basic characteristic of an entity. Abilities are most often associated with creatures although certain entities, such as powerful magic items, can also have abilities.. The value of an ability is called an ability score. Ability scores are non-negative integer values that can range from 0 up to 20, 30, or even 50 but rarely if ever rise above 100.

An ability score can be modified by adding other modifiers to the unmodified, original score of the ability. The modified, current score is used to determine the ability modifier. Thus, an ability has two kinds of modifiers: zero or more score modifiers that are added to the original score and one ability modifier resulting from the current score.


Nested Class Summary
 class Ability.AverageMethod
          A method that generates average ability scores.
 class Ability.HighPoweredMethod
          A method that generates "high-powered" ability scores.
 class Ability.Method
          A function object that generates an ability score.
 class Ability.Modifier
          The modifier resulting from the current score of an ability.
 class Ability.StandardMethod
          A method that generates above-average ability scores.
 
Field Summary
static byte CHA
          A ability that determines leadership and charm.
static byte CON
          An ability that determines fitness and vigor.
static byte DEX
          An ability that determines agility and quickness.
static byte INT
          An ability that determines reasoning and deduction.
static byte NUM
          Number of ability types.
static byte STR
          An ability that determines physical power and force.
static byte WIS
          An ability that determines intuition and judgement.
 
Fields inherited from class ogs.support.Object
listeners
 
Constructor Summary
Ability(int abilityType)
          Create a new ability score.
Ability(int abilityType, Ability.Method method)
          Create a new ability score using a method.
 
Method Summary
 byte getCurrentScore()
          Determine the current ability score.
static int getIncreases(int xpLevel)
          Determine number of ability increases available at a given experience level.
static int getIncreasesLevel(int increases)
          Determine experience level required for a given number of ability increases.
 Ability.Modifier getModifier()
          Determine the ability modifier for this ability.
static byte getModifier(byte score)
          Calculate the ability score modifier for an ability score.
 Modifiers getModifiers()
          Determine the score modifiers for this ability.
 byte getOriginalScore()
          Determine the original ability score.
protected  void handleEvent(EventObject event)
          Updates the current score by adding all modifiers to the original score.
 
Methods inherited from class ogs.support.Object
addListener, notifyListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STR

public static final byte STR
An ability that determines physical power and force.

See Also:
Strength, Constant Field Values

DEX

public static final byte DEX
An ability that determines agility and quickness. A Dexterity modifier is added to ranged attacks with thrown weapons and projectile weapons, defense ratings, and Reflex saving throws.

See Also:
Defense, Saves, Constant Field Values

CON

public static final byte CON
An ability that determines fitness and vigor. A Constiution modifier is added to hit die rolls and Fortitude saving throws.

See Also:
Saves, Constant Field Values

INT

public static final byte INT
An ability that determines reasoning and deduction.

See Also:
Constant Field Values

WIS

public static final byte WIS
An ability that determines intuition and judgement. The Wisdom modifier is added to all Will saving throws.

See Also:
Saves, Constant Field Values

CHA

public static final byte CHA
A ability that determines leadership and charm.

See Also:
Constant Field Values

NUM

public static final byte NUM
Number of ability types.

See Also:
Constant Field Values
Constructor Detail

Ability

public Ability(int abilityType)
Create a new ability score. The ability score is generated using the standard method.

Parameters:
abilityType - A type of ability.
Throws:
IllegalArgumentException - If abilityType is not valid.

Ability

public Ability(int abilityType,
               Ability.Method method)
Create a new ability score using a method.

Parameters:
abilityType - A type of ability.
method - A method for generating an ability score.
Throws:
IllegalArgumentException - If abilityType is not valid.
Method Detail

getModifier

public static byte getModifier(byte score)
Calculate the ability score modifier for an ability score. The modifier of an ability score (M) is calculated from an ability score (S) as follows: M = (S / 2) - 5.

Parameters:
score - An ability score.
Returns:
An ability score modifier.

getIncreases

public static int getIncreases(int xpLevel)
Determine number of ability increases available at a given experience level.

Parameters:
xpLevel - Experience level of character.
Returns:
Number of ability increases available.

getIncreasesLevel

public static int getIncreasesLevel(int increases)
Determine experience level required for a given number of ability increases. This method is the inverse of the getIncreases(int).method.

Parameters:
increases - Number of ability increases available.
Returns:
Required experience level of character.

getOriginalScore

public byte getOriginalScore()
Determine the original ability score.

Returns:
The original score of this ability.

getCurrentScore

public byte getCurrentScore()
Determine the current ability score.

Returns:
The current score of this ability.

getModifiers

public Modifiers getModifiers()
Determine the score modifiers for this ability.

Returns:
A list of score modifiers for this ability.

getModifier

public Ability.Modifier getModifier()
Determine the ability modifier for this ability.

Returns:
The ability modifier for this ability.

handleEvent

protected void handleEvent(EventObject event)
Updates the current score by adding all modifiers to the original score.

Overrides:
handleEvent in class Object
Parameters:
event - An event object (not currently used).

OGS Java API Spec