3 #include "../action/AttackAction.hpp"
4 #include "../action/MoveAction.hpp"
5 #include "../action/RespawnAction.hpp"
6 #include "../item/Equipment.hpp"
7 #include "../item/Inventory.hpp"
8 #include "../skill/SkillSet.hpp"
9 #include "../world/Coordinates.hpp"
16 class Entity :
public std::enable_shared_from_this<Entity>
125 void setAction(std::shared_ptr<Action> action);
Base pure virtual Entity class. Different types of enities inherit this.
Definition: Entity.hpp:17
unsigned int getInstanceId()
Get the unique id of this entity.
Definition: Entity.cpp:34
void setLocation(Coordinates location)
Set the location of this entity.
Definition: Entity.cpp:49
bool isDisconnectedM
Definition: Entity.hpp:207
virtual void respawn()=0
Pure virtual function that child classes need to implement. Performs entity's respawning.
SkillSet & getSkillSet()
Get the SkillSet of this entity.
Definition: Entity.cpp:175
int baseDamageM
Definition: Entity.hpp:204
Inventory & getInventory()
Get the Inventory object of this entity.
Definition: Entity.cpp:76
Entity(GameWorld *pGameWorld, std::string name, int baseAccuracy, int baseDamage, SpawnCoordinateBounds spawnCoordinateBounds, unsigned int id=0, Coordinates location=Coordinates())
Definition: Entity.cpp:7
GameWorld * getGameWorld()
Get pointer to the GameWorld that this entity resides in.
Definition: Entity.cpp:102
SkillSet skillSetM
Definition: Entity.hpp:202
int getHp()
Get the current hp of this entity.
Definition: Entity.cpp:66
std::chrono::milliseconds getMoveSpeed()
Get the movement speed of this entity.
Definition: Entity.cpp:97
Coordinates getRespawnLocation()
Returns a random location within the spawn bounds.
Definition: Entity.cpp:54
int getRange()
Get tha attack range of this entity.
Definition: Entity.cpp:86
int hpM
Definition: Entity.hpp:194
virtual void attack(Entity &target)
Perform an attack on target entity.
Definition: Entity.cpp:135
void changeHp(int amount)
Change the hp of this entity by amount.
Definition: Entity.cpp:107
Coordinates & getLocation()
Get the current location of this entity.
Definition: Entity.cpp:44
int getAttackSpeed()
Get the attack speed of this entity in milliseconds.
Definition: Entity.cpp:91
virtual void update()=0
Pure virtual function that child classes need to implement. Updates the entity on server tick.
Inventory inventoryM
Definition: Entity.hpp:198
bool isDisconnected()
Returns whether entity is disconnected, only relevant for players.
Definition: Entity.cpp:180
std::shared_ptr< Action > currentActionM
Definition: Entity.hpp:190
bool move(Coordinates location)
Move to a neighboring tile.
Definition: Entity.cpp:125
void pickUpItem(int itemId, Coordinates itemLocation)
Pick up an item.
Definition: Entity.cpp:154
int getMaxHp()
Get the maximum hp of this entity.
Definition: Entity.cpp:71
unsigned int instanceIdM
Definition: Entity.hpp:181
std::shared_ptr< Action > & getCurrentAction()
Get the current action of this entity.
Definition: Entity.cpp:61
void setDisconnected()
Sets entity as disconnected, only relevant for players.
Definition: Entity.cpp:185
unsigned int idM
Definition: Entity.hpp:180
std::chrono::milliseconds moveSpeedM
Definition: Entity.hpp:211
void dropItem(int itemId)
Drop an item.
Definition: Entity.cpp:166
SpawnCoordinateBounds spawnCoordinateBoundsM
Definition: Entity.hpp:188
int maxHpM
Definition: Entity.hpp:192
GameWorld * pGameWorldM
Definition: Entity.hpp:196
std::chrono::milliseconds respawnTimeM
Definition: Entity.hpp:209
std::string getName()
Get the name of this entity.
Definition: Entity.cpp:39
Equipment & getEquipment()
Get the Equipment object of this entity.
Definition: Entity.cpp:81
int baseAccuracyM
Definition: Entity.hpp:205
Coordinates locationM
Definition: Entity.hpp:186
unsigned int getId()
Get the type id of this entity.
Definition: Entity.cpp:29
static int nextInstanceIdM
Definition: Entity.hpp:182
void setAction(std::shared_ptr< Action > action)
Set the current action to parameter action.
Definition: Entity.cpp:120
std::string nameM
Definition: Entity.hpp:184
Equipment equipmentM
Definition: Entity.hpp:200
Class for representing the items an entity has equipped.
Definition: Equipment.hpp:14
GameWorld class. It contains all the player, npc, object and item instances.
Definition: GameWorld.hpp:16
Represents the items that an entity can carry.
Definition: Inventory.hpp:12
Contains all the skills that a character has.
Definition: SkillSet.hpp:20
Struct for coordinates.
Definition: Coordinates.hpp:7
Contains the spawn coordinate bounds for a character.
Definition: CharacterReader.hpp:10