Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Types | Public Member Functions | Protected Types | Protected Attributes | Friends | List of all members
LxS::Game::Character Class Reference

Class converging all aspects of playable character. More...

#include <character.hpp>

Inheritance diagram for LxS::Game::Character:
Inheritance graph
Collaboration diagram for LxS::Game::Character:
Collaboration graph

Public Types

typedef std::vector< std::string > DialogueLines
 What can NPC tell to this PC?
 
enum  Rendermode { ForReal, ForCoords3D, ForCoordsGame }
 purpose of rendering. ForReal is "to display", ForCoords3D is "to determine where user has clicked" More...
 

Public Member Functions

bool IsSurprised ()
 Does character suffer surprise penalty in this turn?
 
void Surprise ()
 Set Surprised tag to true.
 
void AddItem (const std::string &itemname, int amount=1)
 Equip character with some stuff.
 
void ArmSword (const std::string &itemname)
 Equip character with a sword. This sword must be one of items posessed by character. If character has no swords,.
 
ItemGetItem (const std::string &itemname)
 Return pointer to an item posessed by character' SHOULDN'T IT BE CONST?
 
void PickItem (Item *it)
 pick item posessed by character and add it to inventory
 
bool ConsumeItem (Item *it)
 
 Character (Map *p, SWRS::Character *charactersheet)
 only usable constructor
 
virtual void SelectAnimation (std::string seq_name)
 select animation sequences to be played
 
bool CanDrinkMore (const std::string &potionname)
 return true if more potion stored than potion drinking actions enqueued
 
float GetRotationY ()
 rotate a model (degrees)
 
virtual void SetRotationY (float alpha)
 rotate around axis, that is perpendicular to the ground
 
virtual void SetPosition (float x, float y, float z)
 set current position
 
virtual void SetDirection (float x, float y, float z)
 set vector of movement. character will calculate his path and start moving
 
virtual void Animate (float dt)
 move contents dt=delta time in seconds since last call to animate;
 
virtual void Initialize ()
 set up resources. (this is to facilitate late (delayed) initialization.
 
virtual void Render (Rendermode mode)
 render character INCLUDING his weapon
 
ItemCatalogueGetInventory ()
 return list of all items posessed by character
 
const SwordGetSword ()
 return pointer to sword object that is currently equipped
 
virtual bool CollisionDetection (GameObject *cb, float x, float y, float z)
 does object cb in pos x,y,z cause collision with THIS?
 
float GetTimeToAction ()
 
void EnqueueAction (Action *to_perform)
 enqueue action using
 
void PerformAction (Action *to_perform)
 perform action immediately
 
void Attack (Action *to_perform)
 perform attack action immediately More...
 
void Escape (Action *to_perform)
 perform escape action immediately
 
void Potion (Action *to_perform)
 perform potion action immediately
 
void DropCurrentAction ()
 drop currewntly executed action from queue (it is finished or just canceled)
 
void ClearActionQueue ()
 remove all actions from action queue
 
void SetAIAgent (char *aia)
 attach AI entity
 
int MeleeToHitRoll (Character *enemy)
 0=miss; 1=hit; 2=murderoous+strike
 
int MeleeToWoundRoll (bool murderous, Character *enemy)
 damage output
 
bool IsWillingToTalk ()
 is this NPC willing to talk?
 
std::string GetAnswer ()
 what does the NPC say
 
DialogueLines GetPossibleQuestions ()
 What can PC say to this NPC right now?
 
void SetDialoguesFile (std::string &dial_file)
 file containing statements and dialogue reaction
 
void Say (std::string &s)
 say sentence s to this NPC character
 
std::string GetDialogueFile ()
 get dialogue file configured for this character (if any; if none, empty string is returned and no exception is thrown)
 
LxS::CoreGraphics::p_Model GetModel ()
 return model of an item (only if it has a graphical representation)
 
void SetFilename (std::string fn)
 set name of file describing this particular game object (its models, textures, animation sequences etc)
 
const std::string GetFilename ()
 return filename
 
const
LxS::CoreGraphics::TriangleSet
GetWalkableArea () const
 select area alongside which character is allowed to move
 
virtual float GetPositionX ()
 where it is (note, that this may be inaccurate if more than one gameobject is represented by the same model mesh; TODO: fix GetPositionX/Y/Z in GameObject)
 
virtual float GetPositionY ()
 where it is
 
virtual float GetPositionZ ()
 where it is
 
virtual void RefreshAssets ()
 To facilitate refreshing app after switching OpenGL Context (as in Android lifecycle)
 
virtual void UnloadResources ()
 free up consumed resources while (possibly temporarily) object is not critical
 
unsigned long GetTexelsCount ()
 sum of dimensionsxdepths of all textures
 
unsigned long GetFacesCount ()
 all 3D faces
 
float GetInitializedPercentage ()
 0= uninitialized; 100=ready; other? for progress bars
 
bool IsInValidState () const
 returns false if in unusable state
 
int GetMaxWounds () const
 
int GetXP () const
 Amount of experience points accumulated by a particular character.
 
int SetMaxWounds (int _w)
 set max amount of wounds for character
 
int SetXP (int XP)
 set XP value for a character (effects of lowering XP rating are undefined);
 
int GrantXP (int XP)
 grant XP to a particular character
 
int GrantTrait (const std::string &id)
 add a trait
 
int RevokeTrait (const std::string &id)
 take trait away
 
int GrantPower (const std::string &id)
 add magical power
 
int RevokePower (const std::string &id)
 remove magical power
 
int IncreaseTrait (const std::string &id)
 increase trait a one die level
 
int DecreaseTrait (const std::string &id)
 decrease trait a one die level
 
int GrantHindrance (const std::string &id)
 add hindrance
 
int RevokeHindrance (const std::string &id)
 remove hindrance
 
int GrantEdge (const std::string &id)
 grant edge
 
int RevokeEdge (const std::string &id)
 revoke edge
 
int SetHindranceSeverity (const std::string &name, int severity)
 some hindrances can be added as minor or major
 
int PrintCharacterSheet () const
 onto stdout
 
const std::string GetCharacterSheet () const
 get character summary as a string
 
const PowerVector & GetPowerVector () const
 all magical powers
 
const PowerVector & GetPossiblePowerVector () const
 what powers are possible
 
const TraitVector & GetTraitVector () const
 return vector of all traits of character
 
const TraitVector & GetPossibleTraitVector () const
 which traits can be added
 
const FeatureVector & GetPossibleEdgeVector () const
 which edges can be added
 
const FeatureVector & GetPossibleHindranceVector () const
 which hindrances can be added
 
const FeatureVector & GetPossibleRaceVector () const
 which races can be selected
 
const FeatureVector & GetHindranceVector () const
 return vector of all edges of a character
 
const FeatureVector & GetEdgeVector () const
 return vector of all edges
 
int GetSkillsPointValue () const
 get value in point build system of allocated skills
 
int GetAttributesPointValue () const
 get value in point build system of allocated attributes
 
int GetSkillsPointsLeft () const
 get amount of points left for attributes
 
int GetAttributesPointsLeft () const
 for point build system
 
bool GetPointLimitEnabled () const
 is point limit enabled ? (for editor)
 
void SetPointLimitEnabled (bool pl)
 enable point limit
 
const Trait * GetTrait (unsigned int id) const __attribute__((deprecated))
 
const Trait * GetTrait (const std::string &name) const
 
int GetCharisma () const
 
int GetPace () const
 how fast does the character move
 
int GetParry () const
 defensive characteristic dependent of "Fighting" trait
 
int GetToughness () const
 defensive characteristic dependent of "Vigor" trait
 
int GetPowerPoints () const
 for point build system
 
int GetPowerAllowance () const
 for point build system - how many powers can be chosen
 
int GetPowerAllowanceLeft () const
 how many powers are allowed
 
const Hindrance * GetHindrance (const std::string &name) const
 return pointer to hindrance object of a particular name
 
const Edge * GetEdge (const std::string &name) const
 return pointer to edge object of a particular name
 
const Power * GetPower (const std::string &name) const
 return pointer to magical power object of a particular name
 
const std::string & GetName () const
 return individual name of a character
 
void SetName (const std::string &n)
 set name
 
const std::string & GetRace () const
 return race of a particular character (default is human)
 
void SetRace (const std::string &n)
 
int GetNumMinorHindrances () const
 how many major minor hindrances does the character have
 
int GetNumMajorHindrances () const
 how many major major hindrances does the character have
 
int GetEdgePointsLeft () const
 how many points are there left for edges
 
int GetSkillsPoints () const
 how many points can be allocated to skills
 
int GetAttributesPoints () const
 how many points can be allocated to attributes
 
int GetEdgesPoints () const
 how many points can be allocated to edges
 
int GetRequiredSkillsPerAttribute (const std::string &attr_name) const
 
int GetTraitLevelModifier (const std::string &trait_name) const
 
virtual int GetWounds () const
 get amount of wounds already suffered by a character
 
virtual void SetWounds (int amount)
 set amount of wounds (may decrease them to 0) suffered by character
 
virtual int Wound (int amount)
 inflicit wound upon a character
 
void LockLevel ()
 prevent from decreasing characteristics below current level (after rising they may however be decreaset down to current level)
 
void UnlockLevel ()
 cancel effects of LockLevel
 

Protected Types

typedef std::map< std::string,
Sequence
AnimationMap
 sequence name, firstxo frame, last frame
 

Protected Attributes

boost::shared_ptr
< LxS::CoreGraphics::Model
p_Model
 pointer to a model
 
std::string object_fn
 filename
 
AnimationMap sequences
 all animation sequences supported
 
AnimationMap::iterator current_sequence
 current animation sequence that is played
 
float current_frame
 animation frame
 
Mapparent_map
 map containing this
 
float AnimationSpeedMultipiler
 set greater than 1 if want to accelerate animation;
 
float initialized_percentage
 0-100; 0- just constructed; 100 - redy to render; 0-100 - for progressbar
 

Friends

class AIAgent
 
class Map
 
class MapWindowOverlay
 

Detailed Description

Class converging all aspects of playable character.

3D object, interactive game object and SW character record sheet

Member Enumeration Documentation

purpose of rendering. ForReal is "to display", ForCoords3D is "to determine where user has clicked"

Enumerator
ForReal 

proper rendering for display

ForCoords3D 

rendering for coordinate detection

ForCoordsGame 

for detection of ingame coordinate system - unused

Member Function Documentation

void Character::Attack ( Action to_perform)

perform attack action immediately

6;

bool Character::ConsumeItem ( Item it)

eat one of items in your inventory

Returns
return false if no such item was in inventory; return true if one unit of item successfully consumed;
int SWRS::Character::GetCharisma ( ) const
inlinevirtualinherited

get charisma of a particular character. default is 0 but can be altered by edges

Implements SWRS::IConstCharacter.

int SWRS::Character::GetMaxWounds ( ) const
inlinevirtualinherited

maximum amount of wounds character can suffer before being assumed as dead (default for savage worlds rules system is 3 but can be defined as more)

Implements SWRS::IConstCharacter.

int SWRS::Character::GetRequiredSkillsPerAttribute ( const std::string &  attr_name) const
inlinevirtualinherited

some hindrances/edges require player to spend certain amount of skill points onto skills linked to particular attributes (i.e. Elderly grants 5 skill points that MUST be spent on skills linked to Smaers)

Implements SWRS::IConstCharacter.

float LxS::Game::Character::GetTimeToAction ( )
inline

get time left to execution of current action in queue (makes sense only in battle mode)

const Trait* SWRS::Character::GetTrait ( unsigned int  id) const
inlinevirtualinherited

return pointer to trait object of given trait ID (0 is returned if character has no such trait)

Implements SWRS::IConstCharacter.

const Trait* SWRS::Character::GetTrait ( const std::string &  name) const
inlinevirtualinherited

return pointer to trait object of given trait name (0 is returned if character has no such trait)

Implements SWRS::IConstCharacter.

int SWRS::Character::GetTraitLevelModifier ( const std::string &  attr_name) const
inlinevirtualinherited

some hindrances decrease particular attributes. I.e. elderly decreases Strength and Vigor by one;

  • this decrease can be also an effect of powers (i.e. debuff spells);

Implements SWRS::IConstCharacter.

void SWRS::Character::SetRace ( const std::string &  n)
inlinevirtualinherited

set race (out of available ones; effects of setting race which doesn't exist in system are undefined)

Implements SWRS::ICharacter.


The documentation for this class was generated from the following files: