0.1.5::wyckedsceptre::wyckedsceptre::Character Class Reference

An object that describes an individual character. More...

Inheritance diagram for 0.1.5::wyckedsceptre::wyckedsceptre::Character:
Inheritance graph
[legend]
Collaboration diagram for 0.1.5::wyckedsceptre::wyckedsceptre::Character:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
 Constructor for the Character object.
def __eq__
 overloaded equality tester for Character object
def __invariant__
 Tests to insure the Character object's state is valid.
def __str__
 String conversion routine.
def get_hp
 The current hit points of a Character.
def take_damage
 Reduces the hit_points of a character by "amount".
def level_at_xp
 Computes the level of a character at their current XP level.
def heal
 Increases a character's hit points.
def is_concious
 Computes if the character is currently concious (hit_points > 0).
def update_state
 Updates the .state attribute based on hit_points, and checks for leveling up.
def get_ac
 Get the Armor Class of a character.
def roll_initiative
 Rolls and returns initiative for the character.
def get_mod
 Gets a skill modifier for a particular skill.
def make_attack
 Makes an attack roll - hit and damage.

Public Attributes

 name
 The name of the character (string).
 dnd_class
 The class of the character (string).
 level
 The character's level (integer).
 hit_points
 Character's current Hit Points (integer).
 hit_points_max
 Character's maximum possible Hit Points (integer).
 armor_class
 Character's Armor Class (integer).
 initiative_bonus
 Character's Initiative Bonus (integer).
 initiative_total
 Character's current initiative roll, including bonus (integer).
 money
 Character's money in Gold Pieces (integer).
 xp
 Character's Experience (integer).
 is_npc
 Bool - is this character a Non-Player Character (NPC).
 attack
 This character's attack (Attack object).
 abilities
 Character's core ability scores (dict).
 saving_throws
 Character's saving throws for each type (dict).
 state
 Character's state (integer between -1 and 1).

Detailed Description

An object that describes an individual character.


Member Function Documentation

def 0.1.5::wyckedsceptre::wyckedsceptre::Character::__eq__ (   self,
  other 
)

overloaded equality tester for Character object

def 0.1.5::wyckedsceptre::wyckedsceptre::Character::__init__ (   self,
  new_name,
  new_class 
)

Constructor for the Character object.

Parameters:
new_name a String for the name of the character
new_class a string for the class of the character
Todo:

add full set of agruments

fill in Doxygen descriptions for each member

Returns:
An initialized Character object
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::__invariant__ (   self  ) 

Tests to insure the Character object's state is valid.

Throws a ValueError exception if any problems are detected.

Exceptions:
ValueError a property is not within a valid range
TypeError a property is not the right data type
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::__str__ (   self  ) 

String conversion routine.

Returns:
the character's name and a few stats on them
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::get_ac (   self  ) 

Get the Armor Class of a character.

Returns:
the armor class for a character as an integer
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::get_hp (   self  ) 

The current hit points of a Character.

Returns:
Current HP of a Character (integer)
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::get_mod (   self,
  ability 
)

Gets a skill modifier for a particular skill.

Returns:
the ability modifier for a given ability.
Parameters:
ability A 3 character string, in all caps, that describes which ability
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::heal (   self,
  hit_points_to_heal 
)

Increases a character's hit points.

Parameters:
hit_points_to_heal Number of hit points to restore to a Character heal. Will not heal a Character who is completely dead. Will only heal a Character up to it's maximum hit_points
Returns:
the Character's new hit_points
Exceptions:
if hit_points_to_heal is 0 or less
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::is_concious (   self  ) 

Computes if the character is currently concious (hit_points > 0).

Returns:
True if the character's hit_points is greater than zero.
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::level_at_xp (   self  ) 

Computes the level of a character at their current XP level.

Returns:
the level that corresponds to a given XP level
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::make_attack (   self  ) 

Makes an attack roll - hit and damage.

Returns:
a list of integers [Hit, Damage] where Hit is a 1d20 attack roll and Damage is the damage roll done if the target is hit
Todo:
add ability modifiers to attack and damage rolls
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::roll_initiative (   self  ) 

Rolls and returns initiative for the character.

Returns:
a 1d20 + initiative bonus roll for a character's initiative
Todo:
set the total_initiative member
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::take_damage (   self,
  amount 
)

Reduces the hit_points of a character by "amount".

Amount must be greater than zero

Parameters:
amount The amount of damage inflicted on the character A positive integer
Exceptions:
If amount of damage is less than 1
Returns:
the state after damage as a float [-1, 1]
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::update_state (   self  ) 

Updates the .state attribute based on hit_points, and checks for leveling up.

Returns:
the .state attribute [-1, 1]
Exceptions:
if Character's current hit_points is greater than its max hit_points

Member Data Documentation

Character's core ability scores (dict).

Character's Armor Class (integer).

This character's attack (Attack object).

The class of the character (string).

Character's current Hit Points (integer).

Character's maximum possible Hit Points (integer).

Character's Initiative Bonus (integer).

Character's current initiative roll, including bonus (integer).

Bool - is this character a Non-Player Character (NPC).

The character's level (integer).

Character's money in Gold Pieces (integer).

The name of the character (string).

Character's saving throws for each type (dict).

Character's state (integer between -1 and 1).

Character's Experience (integer).


The documentation for this class was generated from the following file:
Generated on Tue Nov 2 22:28:25 2010 for wyckedsceptre by  doxygen 1.6.3