|
Rehti MMORPG
1.0.0
Rehti MMORPG is a free and open source MMORPG game.
|
Base pure virtual Entity class. Different types of enities inherit this. More...
#include <Entity.hpp>


Public Member Functions | |
| Entity (GameWorld *pGameWorld, std::string name, int baseAccuracy, int baseDamage, SpawnCoordinateBounds spawnCoordinateBounds, unsigned int id=0, Coordinates location=Coordinates()) | |
| ~Entity ()=default | |
| unsigned int | getId () |
| Get the type id of this entity. More... | |
| unsigned int | getInstanceId () |
| Get the unique id of this entity. More... | |
| std::string | getName () |
| Get the name of this entity. More... | |
| Coordinates & | getLocation () |
| Get the current location of this entity. More... | |
| void | setLocation (Coordinates location) |
| Set the location of this entity. More... | |
| Coordinates | getRespawnLocation () |
| Returns a random location within the spawn bounds. More... | |
| std::shared_ptr< Action > & | getCurrentAction () |
| Get the current action of this entity. More... | |
| int | getHp () |
| Get the current hp of this entity. More... | |
| int | getMaxHp () |
| Get the maximum hp of this entity. More... | |
| Inventory & | getInventory () |
| Get the Inventory object of this entity. More... | |
| Equipment & | getEquipment () |
| Get the Equipment object of this entity. More... | |
| int | getRange () |
| Get tha attack range of this entity. More... | |
| int | getAttackSpeed () |
| Get the attack speed of this entity in milliseconds. More... | |
| std::chrono::milliseconds | getMoveSpeed () |
| Get the movement speed of this entity. More... | |
| GameWorld * | getGameWorld () |
| Get pointer to the GameWorld that this entity resides in. More... | |
| void | changeHp (int amount) |
| Change the hp of this entity by amount. More... | |
| void | setAction (std::shared_ptr< Action > action) |
| Set the current action to parameter action. More... | |
| bool | move (Coordinates location) |
| Move to a neighboring tile. More... | |
| virtual void | attack (Entity &target) |
| Perform an attack on target entity. More... | |
| void | pickUpItem (int itemId, Coordinates itemLocation) |
| Pick up an item. More... | |
| void | dropItem (int itemId) |
| Drop an item. More... | |
| SkillSet & | getSkillSet () |
| Get the SkillSet of this entity. More... | |
| virtual void | update ()=0 |
| Pure virtual function that child classes need to implement. Updates the entity on server tick. More... | |
| virtual void | respawn ()=0 |
| Pure virtual function that child classes need to implement. Performs entity's respawning. More... | |
| bool | isDisconnected () |
| Returns whether entity is disconnected, only relevant for players. More... | |
| void | setDisconnected () |
| Sets entity as disconnected, only relevant for players. More... | |
Protected Attributes | |
| unsigned int | idM |
| unsigned int | instanceIdM |
| std::string | nameM |
| Coordinates | locationM |
| SpawnCoordinateBounds | spawnCoordinateBoundsM |
| std::shared_ptr< Action > | currentActionM = nullptr |
| int | maxHpM = 1000 |
| int | hpM = maxHpM |
| GameWorld * | pGameWorldM |
| Inventory | inventoryM |
| Equipment | equipmentM |
| SkillSet | skillSetM |
| int | baseDamageM |
| int | baseAccuracyM |
| bool | isDisconnectedM = false |
| std::chrono::milliseconds | respawnTimeM {2000} |
| std::chrono::milliseconds | moveSpeedM {1000} |
Static Protected Attributes | |
| static int | nextInstanceIdM = 0 |
Base pure virtual Entity class. Different types of enities inherit this.
| Entity::Entity | ( | GameWorld * | pGameWorld, |
| std::string | name, | ||
| int | baseAccuracy, | ||
| int | baseDamage, | ||
| SpawnCoordinateBounds | spawnCoordinateBounds, | ||
| unsigned int | id = 0, |
||
| Coordinates | location = Coordinates() |
||
| ) |
|
default |
|
virtual |
Perform an attack on target entity.
| target |
Reimplemented in PlayerCharacter.

| void Entity::changeHp | ( | int | amount | ) |
Change the hp of this entity by amount.
| amount |


| void Entity::dropItem | ( | int | itemId | ) |
Drop an item.
| itemId | instance id of item to be dropped |


| int Entity::getAttackSpeed | ( | ) |
Get the attack speed of this entity in milliseconds.

| std::shared_ptr< Action > & Entity::getCurrentAction | ( | ) |
Get the current action of this entity.
| Equipment & Entity::getEquipment | ( | ) |
| GameWorld * Entity::getGameWorld | ( | ) |
Get pointer to the GameWorld that this entity resides in.
| int Entity::getHp | ( | ) |
Get the current hp of this entity.

| unsigned int Entity::getId | ( | ) |
Get the type id of this entity.
| unsigned int Entity::getInstanceId | ( | ) |
Get the unique id of this entity.
| Inventory & Entity::getInventory | ( | ) |
| Coordinates & Entity::getLocation | ( | ) |
Get the current location of this entity.

| int Entity::getMaxHp | ( | ) |
Get the maximum hp of this entity.
| std::chrono::milliseconds Entity::getMoveSpeed | ( | ) |
Get the movement speed of this entity.
| std::string Entity::getName | ( | ) |
Get the name of this entity.

| int Entity::getRange | ( | ) |
Get tha attack range of this entity.

| Coordinates Entity::getRespawnLocation | ( | ) |
Returns a random location within the spawn bounds.

| SkillSet & Entity::getSkillSet | ( | ) |
| bool Entity::isDisconnected | ( | ) |
Returns whether entity is disconnected, only relevant for players.
| bool Entity::move | ( | Coordinates | location | ) |
Move to a neighboring tile.
| location |

| void Entity::pickUpItem | ( | int | itemId, |
| Coordinates | itemLocation | ||
| ) |
Pick up an item.
| itemId | instance id of item to be picked up |

|
pure virtual |
Pure virtual function that child classes need to implement. Performs entity's respawning.
Implemented in PlayerCharacter, and Npc.

| void Entity::setAction | ( | std::shared_ptr< Action > | action | ) |
Set the current action to parameter action.
| action |

| void Entity::setDisconnected | ( | ) |
Sets entity as disconnected, only relevant for players.
| void Entity::setLocation | ( | Coordinates | location | ) |
Set the location of this entity.
| location |
|
pure virtual |
Pure virtual function that child classes need to implement. Updates the entity on server tick.
Implemented in PassiveNpc, AggressiveNpc, PlayerCharacter, and Npc.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inlinestaticprotected |
|
protected |
|
protected |
|
protected |
|
protected |