#include <being.hpp>
Public Types | |
enum | Action { STAND, WALK, ATTACK, SIT, DEAD, HURT } |
Moves enum for beings and actors for others players vision. More... | |
Public Member Functions | |
Being (ThingType type) | |
Proxy constructor. | |
virtual void | update () |
Cleans obsolete attribute modifiers. | |
virtual int | damage (Actor *source, const Damage &damage) |
Takes a damage structure, computes the real damage based on the stats, deducts the result from the hitpoints and adds the result to the HitsTaken list. | |
virtual void | died () |
Changes status and calls all the "died" listeners. | |
virtual void | perform () |
Performs actions scheduled by the being. | |
const Point & | getDestination () const |
Gets the destination coordinates of the being. | |
void | setDestination (const Point &dst) |
Sets the destination coordinates of the being. | |
void | clearDestination () |
Sets the destination coordinates of the being to the current position. | |
const Point & | getOldPosition () const |
Gets the old coordinates of the being. | |
void | setDirection (int direction) |
Sets the facing direction of the being. | |
int | getDirection () const |
int | getSpeed () const |
Gets beings speed. | |
void | setSpeed (int s) |
const Hits & | getHitsTaken () const |
Gets the damage list. | |
void | clearHitsTaken () |
Clears the damage list. | |
void | performAttack (const Damage &, const AttackZone *attackZone) |
Performs an attack. | |
void | setAction (Action action) |
Sets the current action. | |
Action | getAction () const |
Sets the current action. | |
virtual int | getAttackType () const |
Gets the type of the attack the being is currently performing. | |
void | move () |
Moves the being toward its destination. | |
void | setAttribute (int n, int value) |
Sets an attribute. | |
int | getAttribute (int n) const |
Gets an attribute. | |
int | getModifiedAttribute (int) const |
Gets an attribute after applying modifiers. | |
void | applyModifier (int attr, int value, int duration=0, int lvl=0) |
Adds a modifier to one attribute. | |
void | dispellModifiers (int level) |
Removes all the modifiers with a level low enough. | |
virtual void | modifiedAttribute (int) |
Called when an attribute modifier is changed. | |
const std::string & | getName () const |
Gets the name of the being. | |
void | setName (const std::string &name) |
Sets the name of the being. | |
Static Public Member Functions | |
static int | directionToAngle (int direction) |
Converts a direction to an angle. | |
Protected Attributes | |
Action | mAction |
std::vector< Attribute > | mAttributes |
Static Protected Attributes | |
static const int | TICKS_PER_HP_REGENERATION = 100 |
Keeps direction, destination and a few other relevant properties. Used for characters & monsters (all animated objects).
Definition at line 108 of file being.hpp.
enum Being::Action |
int Being::getSpeed | ( | ) | const [inline] |
void Being::applyModifier | ( | int | attr, | |
int | value, | |||
int | duration = 0 , |
|||
int | lvl = 0 | |||
) |
Adds a modifier to one attribute.
duration | If non-zero, creates a temporary modifier that expires after duration ticks. | |
lvl | If non-zero, indicates that a temporary modifier can be dispelled prematuraly by a spell of given level. |
Definition at line 365 of file being.cpp.
References modifiedAttribute().
Referenced by ItemModifiers::applyAttributes(), ItemModifiers::cancelAttributes(), and update().
const std::string& Being::getName | ( | ) | const [inline] |
void Being::setName | ( | const std::string & | name | ) | [inline] |
int Being::directionToAngle | ( | int | direction | ) | [static] |
Converts a direction to an angle.
Used for combat hit checks.
Definition at line 209 of file being.cpp.
Referenced by performAttack(), and Monster::update().