Mana
|
#include <being.h>
Classes | |
struct | SpriteState |
Public Types | |
enum | Action { STAND , MOVE , ATTACK , SIT , DEAD , HURT } |
Action the being is currently performing WARNING: Has to be in sync with the same enum in the Being class of the server! More... | |
enum | Speech { NO_SPEECH = 0 , TEXT_OVERHEAD , NO_NAME_IN_BUBBLE , NAME_IN_BUBBLE } |
enum | AttackType { HIT = 0x00 , CRITICAL = 0x0a , MULTI = 0x08 , REFLECT = 0x04 , FLEE = 0x0b } |
enum | BeingDirection { DOWN = 1 , LEFT = 2 , UP = 4 , RIGHT = 8 } |
Directions, to be used as bitmask values. More... | |
![]() | |
enum | Type { UNKNOWN , PLAYER , NPC , MONSTER , FLOOR_ITEM , PORTAL } |
enum | TargetCursorSize { TC_SMALL = 0 , TC_MEDIUM , TC_LARGE , NUM_TC } |
enum | TargetCursorType { TCT_NONE = -1 , TCT_NORMAL = 0 , TCT_IN_RANGE , NUM_TCT } |
Public Member Functions | |
Being (int id, Type type, int subtype, Map *map) | |
Constructor. | |
~Being () override | |
Type | getType () const final |
Returns the type of the ActorSprite. | |
void | setType (Type type, int subtype) |
Can be used to change the type of the being. | |
void | clearPath () |
Removes all path nodes from this being. | |
void | setDestination (int ex, int ey) |
Creates a path for the being from current position to ex and ey. | |
const Vector & | getDestination () const |
Returns the destination for this being. | |
int | getTileX () const override |
Returns the tile x coord. | |
int | getTileY () const override |
Returns the tile y coord. | |
void | setSpeech (const std::string &text, int time=5000) |
Puts a "speech balloon" above this being for the specified amount of time. | |
void | takeDamage (Being *attacker, int damage, AttackType type, int attackId=1) |
Puts a damage bubble above this being. | |
void | handleAttack (Being *victim, int damage, int attackId=1) |
Handles an attack of another being by this being. | |
const ItemInfo * | getEquippedWeapon () const |
const std::string & | getName () const |
Returns the name of the being. | |
void | setName (const std::string &name) |
Sets the name for the being. | |
bool | getShowName () const |
void | setShowName (bool doShowName) |
void | setPartyName (const std::string &name) |
Sets the name of the party the being is in. | |
const std::string & | getPartyName () const |
void | setGuildName (const std::string &name) |
Sets the name of the primary guild the being is in. | |
void | setGuildPos (const std::string &pos) |
void | addGuild (Guild *guild) |
Adds a guild to the being. | |
void | removeGuild (int id) |
Removers a guild from the being. | |
Guild * | getGuild (const std::string &guildName) const |
Returns a pointer to the specified guild that the being is in. | |
Guild * | getGuild (int id) const |
Returns a pointer to the specified guild that the being is in. | |
const std::map< int, Guild * > & | getGuilds () const |
Returns all guilds the being is in. | |
void | clearGuilds () |
Removes all guilds the being is in. | |
short | getNumberOfGuilds () const |
Get number of guilds the being belongs to. | |
bool | isInParty () const |
void | setParty (Party *party) |
Party * | getParty () const |
void | setSprite (unsigned slot, int id, const std::string &color=std::string(), bool isWeapon=false) |
Sets visible equipments for this being. | |
void | setSpriteID (unsigned slot, int id) |
void | setSpriteColor (unsigned slot, const std::string &color=std::string()) |
unsigned | getSpriteCount () const |
bool | drawnWhenBehind () const override |
Determines wether the actor should be drawn translucent when behind another object. | |
void | logic () override |
Performs being logic. | |
void | drawSpeech (int offsetX, int offsetY) |
Draws the speech text above the being. | |
uint16_t | getSubType () const |
const BeingInfo & | getInfo () const |
bool | isTargetSelection () const |
TargetCursorSize | getTargetCursorSize () const override |
Returns the required size of a target cursor for this being. | |
Cursor | getHoverCursor () const |
unsigned char | getWalkMask () const |
Gets the way the object is blocked by other objects. | |
Map::BlockType | getBlockType () const override |
Gets the way the monster blocks pathfinding for other objects. | |
void | setMoveSpeed (const Vector &speed) |
Sets the move speed. | |
void | setAttackSpeed (int speed) |
Sets the attack speed. | |
int | getAttackSpeed () const |
Gets the attack speed. | |
virtual void | setAction (Action action, int attackId=1) |
Sets the current action. | |
void | setAction (const std::string &action) |
Sets the current action by name. | |
Action | getCurrentAction () const |
Get the being's action currently performed. | |
bool | isAlive () const |
Returns whether this being is still alive. | |
uint8_t | getDirection () const |
Returns the current direction. | |
void | setDirection (uint8_t direction) |
Sets the current direction. | |
SpriteDirection | getSpriteDirection () const |
Returns the direction the being is facing. | |
void | setPosition (const Vector &pos) final |
Sets the pixel position of this actor. | |
void | setPosition (float x, float y, float z=0.0f) |
Overloaded method provided for convenience. | |
int | getCollisionRadius () const |
Returns the being's pixel radius used to detect collisions. | |
void | fireMissile (Being *target, const std::string &particle) |
Shoots a missile particle from this being, to target being. | |
void | setStatusEffect (int id, bool active) |
const Path & | getPath () const |
Returns the path this being is following. | |
void | flashName (int time) |
int | getDamageTaken () const |
void | updateName () |
void | setGender (Gender gender) |
Sets the gender of this being. | |
Gender | getGender () const |
bool | isGM () const |
Whether or not this player is a GM. | |
void | setGM (bool gm) |
Triggers whether or not to show the name as a GM name. | |
void | setIp (int ip) |
Sets the IP or an IP hash. | |
int | getIp () const |
Returns the player's IP or an IP hash. | |
bool | canTalk () |
void | talkTo () |
void | event (Event::Channel channel, const Event &event) override |
void | death (const gcn::Event &event) override |
void | setMap (Map *map) final |
void | lookAt (const Vector &destVec) |
Make the being look at a given pixel position. | |
void | lookAt (const Position &destPos) |
![]() | |
ActorSprite (int id) | |
~ActorSprite () override | |
int | getId () const |
void | setId (int id) |
int | getDrawOrder () const override |
Returns the pixel Y coordinate that the actor should be drawn at. | |
bool | draw (Graphics *graphics, int offsetX, int offsetY) const override |
Draws the Actor to the given graphics context. | |
bool | drawSpriteAt (Graphics *graphics, int x, int y) const |
void | controlParticle (Particle *particle) |
Take control of a particle. | |
void | setTargetType (TargetCursorType type) |
Sets the target animation for this actor. | |
void | untarget () |
Untargets the actor. | |
void | setAlpha (float alpha) override |
Sets the alpha value used to draw the actor. | |
float | getAlpha () const override |
Returns the current alpha value used to draw the actor. | |
int | getWidth () const |
int | getHeight () const |
![]() | |
Actor () | |
virtual | ~Actor () |
const Vector & | getPosition () const |
Returns the pixel position of this actor. | |
int | getPixelX () const |
Returns the pixels X coordinate of the actor. | |
int | getPixelY () const |
Returns the pixel Y coordinate of the actor. | |
Map * | getMap () const |
![]() | |
virtual | ~EventListener () |
void | listen (Event::Channel channel) |
void | ignore (Event::Channel channel) |
Protected Member Functions | |
void | setPath (const Path &path) |
Sets the new path for this being. | |
void | updateNamePosition () |
Updates name's location. | |
void | addSpriteParticles (SpriteState &spriteState, const SpriteDisplay &display) |
void | restoreAllSpriteParticles () |
void | updateColors () |
void | updatePlayerSprites () |
Updates the visible sprite IDs of the player, taking into account the item replacements. | |
int | getSpeechTextYPosition () const |
Gets the advised Y chat text position. | |
virtual void | pathFinished () |
Called when the being has reached the end of its path. | |
virtual void | updateStatusEffect (int index, bool newStatus) |
Notify self that a status effect has flipped. | |
![]() | |
void | setupSpriteDisplay (const SpriteDisplay &display, bool forceDisplay=true) |
Protected Attributes | |
const BeingInfo * | mInfo |
Timer | mActionTimer |
Time spent in current action. | |
Timer | mSpeechTimer |
Time until the last speech sentence disappears. | |
int | mAttackSpeed = 350 |
Attack speed. | |
Action | mAction = STAND |
Action the being is performing. | |
int | mSubType = 0xFFFF |
Subtype (graphical view, basically) | |
uint8_t | mDirection = DOWN |
Facing direction. | |
uint8_t | mSpriteDirection = DIRECTION_DOWN |
Facing direction. | |
std::string | mName |
Name of character. | |
std::string | mPartyName |
FlashText * | mDispName = nullptr |
Holds a text object when the being displays its name, 0 otherwise. | |
const gcn::Color * | mNameColor |
bool | mShowName = false |
const ItemInfo * | mEquippedWeapon = nullptr |
Engine-related infos about weapon. | |
Path | mPath |
std::string | mSpeech |
Text * | mText = nullptr |
Vector | mDest |
destination coordinates. | |
std::vector< SpriteState > | mSpriteStates |
bool | mRestoreParticlesOnLogic = false |
Gender | mGender = Gender::Neutral |
std::map< int, Guild * > | mGuilds |
Party * | mParty = nullptr |
bool | mIsGM = false |
![]() | |
int | mId |
std::vector< ParticleHandle > | mChildParticleEffects |
CompoundSprite | mSprites |
![]() | |
Map * | mMap = nullptr |
Vector | mPos |
Position in pixels relative to map. | |
Private Member Functions | |
void | updateMovement () |
Private Attributes | |
Type | mType = UNKNOWN |
std::set< int > | mStatusEffects |
set of active status effects | |
std::map< int, ParticleHandle > | mStatusParticleEffects |
SpeechBubble * | mSpeechBubble |
Speech Bubble components. | |
Vector | mMoveSpeed |
Walk speed for x and y movement values. | |
Vector | mSpeedPixelsPerSecond |
Being speed in pixel per second. | |
int | mDamageTaken = 0 |
int | mIp = 0 |
Additional Inherited Members | |
![]() | |
static void | load () |
static void | unload () |
enum Being::Action |
enum Being::AttackType |
enum Being::Speech |
void Being::addGuild | ( | Guild * | guild | ) |
|
protected |
void Being::clearGuilds | ( | ) |
void Being::clearPath | ( | ) |
|
overridevirtual |
void Being::drawSpeech | ( | int | offsetX, |
int | offsetY | ||
) |
|
overridevirtual |
void Being::fireMissile | ( | Being * | target, |
const std::string & | particle | ||
) |
|
inline |
|
overridevirtual |
Gets the way the monster blocks pathfinding for other objects.
Reimplemented from ActorSprite.
int Being::getCollisionRadius | ( | ) | const |
|
inline |
|
inline |
|
inline |
Guild * Being::getGuild | ( | const std::string & | guildName | ) | const |
Guild * Being::getGuild | ( | int | id | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
inline |
|
overridevirtual |
Returns the required size of a target cursor for this being.
Reimplemented from ActorSprite.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlinefinalvirtual |
Returns the type of the ActorSprite.
Reimplemented from ActorSprite.
unsigned char Being::getWalkMask | ( | ) | const |
void Being::handleAttack | ( | Being * | victim, |
int | damage, | ||
int | attackId = 1 |
||
) |
|
inline |
|
inline |
|
overridevirtual |
void Being::lookAt | ( | const Vector & | destVec | ) |
|
inlineprotectedvirtual |
Called when the being has reached the end of its path.
Reimplemented in LocalPlayer.
void Being::removeGuild | ( | int | id | ) |
|
virtual |
void Being::setAction | ( | const std::string & | action | ) |
|
inline |
void Being::setDestination | ( | int | ex, |
int | ey | ||
) |
void Being::setDirection | ( | uint8_t | direction | ) |
void Being::setGender | ( | Gender | gender | ) |
void Being::setGM | ( | bool | gm | ) |
void Being::setGuildName | ( | const std::string & | name | ) |
Sets the name of the primary guild the being is in.
Shown in BeingPopup (eventually).
void Being::setIp | ( | int | ip | ) |
|
finalvirtual |
Reimplemented from ActorSprite.
void Being::setMoveSpeed | ( | const Vector & | speed | ) |
void Being::setName | ( | const std::string & | name | ) |
|
inline |
Sets the name of the party the being is in.
Shown in BeingPopup.
|
protected |
|
finalvirtual |
|
inline |
Overloaded method provided for convenience.
void Being::setSpeech | ( | const std::string & | text, |
int | time = 5000 |
||
) |
void Being::setSprite | ( | unsigned | slot, |
int | id, | ||
const std::string & | color = std::string() , |
||
bool | isWeapon = false |
||
) |
void Being::setSpriteColor | ( | unsigned | slot, |
const std::string & | color = std::string() |
||
) |
void Being::setType | ( | Type | type, |
int | subtype | ||
) |
void Being::takeDamage | ( | Being * | attacker, |
int | damage, | ||
AttackType | type, | ||
int | attackId = 1 |
||
) |
|
protected |
|
protected |
|
protectedvirtual |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
private |
|
protected |
|
private |
|
protected |
|
protected |
|
private |
|
private |
|
protected |