Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

ogs::core::Creature Class Reference

A creature is a sentient and/or animate entity. More...

#include <Creature.h>

Inheritance diagram for ogs::core::Creature:

Inheritance graph
[legend]
Collaboration diagram for ogs::core::Creature:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::list< BodyPartBody
 A list of body parts.


Public Member Functions

const DiegetHitDice () const
 Determine the hit dice for this creature.

DiegetHitDice ()
 Determine the hit dice for this creature.

const ModifiersgetInitiative () const
 Determine the initiative modifiers for this creature.

ModifiersgetInitiative ()
 Determine the initiative modifiers for this creature.

Die::Value rollInitiative () const
 Roll initiative.

const SavesgetSaves () const
 Determine the saving throws for this creature.

SavesgetSaves ()
 Determine the saving throws for this creature.

const AbilitiesgetAbilities () const
 Determine the abilities for this character.

AbilitiesgetAbilities ()
 Determine the abilities for this character.

Skills getSkills () const
 Determine the skills for this creature.

bool addSkill (Skill &skill)
 Add a skill to this creature.

bool removeSkill (Skill &skill)
 Remove a skill from this creature.

Feats getFeats () const
 Determine the feats for this creature.

bool addFeat (Feat &feat)
 Add a feat to this creature.

bool removeFeat (Feat &feat)
 Remove a feat from this creature.

Body getBody () const
 Determine the body parts of this creature.

bool equipItem (Item &item)
 Equip an item on this body.

bool equipItem (Item &item, BodyPart &part)
 Equip an item on a part of this body.

bool unequipItem (Item &item)
 Remove an equipped item from this body.

CharactergetCharacter () const
 Determine if this creature is a character.


Protected Types

typedef std::vector< BodyPart::TypeParts
 An array of body part types.


Protected Member Functions

 Creature (Die hitDice, Abilities abilities, Size::Type size=Size::MEDIUM, Parts parts=Parts())
 Create a new creature.


Detailed Description

Creatures could be described as living entities but "living" some creatures such as constructs and undead barely fit the definition of "living" entities. But even these types of entities are considered creatures since they have the same attributes that are common to all creatures; namely, hit dice, ability scores, saving throws, inititiative, skills, feats, and (usually) a body which can carry and equip items.


Member Typedef Documentation

typedef std::vector<BodyPart::Type> ogs::core::Creature::Parts [protected]
 

This class does not know what sort of bodies that derived classes may have and derived classes do not have access to "this" creature in initializer lists. So derived classes provide the Creature constructor with an array of body part types which it can then turn into a body using "this" creature.


Constructor & Destructor Documentation

Creature::Creature Die  hitDice,
Abilities  abilities,
Size::Type  size = Size::MEDIUM,
Parts  parts = Parts ()
[protected]
 

This constructor is protected so only derived classes can call it. The new creature has no skills, no feats, and no hit dice. Ability scores rolled using the standard method and no character is associated with the creature.

Parameters:
hitDice Hit dice of creature.
abilities Ability scores of creature.
size Size of creature.
parts An array of body part types.
Todo:
Observe Con modifier and update hit dice modifier and hit points.


Member Function Documentation

bool Creature::addFeat Feat feat  ) 
 

Parameters:
feat A feat to be added to this creature.
Returns:
True if the feat was added to this creature.

bool Creature::addSkill Skill skill  ) 
 

This function adds the skill only if another skill of the same type is not already present.

Parameters:
skill A skill to be added to this creature.
Returns:
True if the skill was added to this creature.

bool Creature::equipItem Item item,
BodyPart part
 

If the item can not be equipped on the specified part of the body, this function will return false.

Parameters:
item Item to be equipped on this body.
part BodyPart of the body to equip item.
Returns:
True if item is equipped.
Todo:
Implement this function.

bool Creature::equipItem Item item  ) 
 

This function will cycle through all body parts until it finds one where the item can be equipped. If it cannot find a part, this function will return false.

Parameters:
item Item to be equipped on this body.
Returns:
True if item is equipped.
Todo:
Implement this function.

Abilities & ogs::core::Creature::getAbilities  )  [inline]
 

This function allows the caller to add and remove modifiers to the ability scores of this creature.

Returns:
Ability scores.

const Abilities & ogs::core::Creature::getAbilities  )  const [inline]
 

Returns:
Ability scores.

Creature::Body ogs::core::Creature::getBody  )  const [inline]
 

Returns:
A list of body parts of this creature.

Character * ogs::core::Creature::getCharacter  )  const [inline]
 

If this creature is a character, a pointer to the Character object is returned. Otherwise, a null pointer is returned.

Returns:
Null pointer or a pointer to a Character object.

Feats ogs::core::Creature::getFeats  )  const [inline]
 

Returns:
A list of feats for this creature.

Die & ogs::core::Creature::getHitDice  )  [inline]
 

This function allows the caller to change the hit dice of this creature.

Returns:
Hit dice for this creature.

const Die & ogs::core::Creature::getHitDice  )  const [inline]
 

Returns:
Hit dice for this creature.

Modifiers & ogs::core::Creature::getInitiative  )  [inline]
 

This function allows the caller to add and remove modifiers to intiative rolls for this creature.

Returns:
Initiative modifiers.

const Modifiers & ogs::core::Creature::getInitiative  )  const [inline]
 

Returns:
Initiative modifiers.

Saves & ogs::core::Creature::getSaves  )  [inline]
 

This function allows the caller to add and remove modifiers to saving throws for this creature.

Returns:
Saving throws for this creature.

const Saves & ogs::core::Creature::getSaves  )  const [inline]
 

Returns:
Saving throws for this creature.

Skills ogs::core::Creature::getSkills  )  const [inline]
 

Returns:
A list of skills for this creature.

bool Creature::removeFeat Feat feat  ) 
 

Parameters:
feat A feat to be removed from this creature.
Returns:
True if the feat was removed from this creature.

bool Creature::removeSkill Skill skill  ) 
 

Parameters:
skill A skill to be removed from this creature.
Returns:
True if skill is removed from this creature.

Die::Value ogs::core::Creature::rollInitiative  )  const [inline]
 

This function rolls 1d20 and adds the initiative modifiers of this creature to the result to produce an initiative roll.

Returns:
Result of initiative roll.

bool Creature::unequipItem Item item  ) 
 

If the item is not currently equipped or cannot be removed (such as cursed items), this function will return false.

Parameters:
item Item to be removed from this body.
Returns:
True if item is no longer equipped.
Todo:
Implement this function.


The documentation for this class was generated from the following files:
Generated on Sun Apr 20 03:38:03 2003 for Open Gaming System (OGS) by doxygen1.3