An object that describes an individual character. More...
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). |
An object that describes an individual character.
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 | ||||
) |
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.
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.
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::get_ac | ( | self | ) |
Get the Armor Class of a character.
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::get_hp | ( | self | ) |
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::get_mod | ( | self, | ||
ability | ||||
) |
Gets a skill modifier for a particular skill.
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.
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 |
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).
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::level_at_xp | ( | self | ) |
Computes the level of a character at their current XP level.
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::make_attack | ( | self | ) |
Makes an attack roll - hit and damage.
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::roll_initiative | ( | self | ) |
Rolls and returns initiative for the character.
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
amount | The amount of damage inflicted on the character A positive integer |
If | amount of damage is less than 1 |
def 0.1.5::wyckedsceptre::wyckedsceptre::Character::update_state | ( | self | ) |
Updates the .state attribute based on hit_points, and checks for leveling up.
if | Character's current hit_points is greater than its max hit_points |
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).