Argentum Online - Cliente
|
|
1 #ifndef __STATS_COMPONENT_H
2 #define __STATS_COMPONENT_H
5 #include <unordered_map>
7 #include "../../../include/nlohmann/json.hpp"
8 #include "../ECS/component.h"
10 typedef std::unordered_map<std::string, unsigned int> StatValues;
18 StatValues max_stat_values;
19 StatValues current_stat_values;
21 std::string current_ability;
22 std::recursive_mutex m;
24 void _update_defense(nlohmann::json entity_info);
25 void _update_attack(nlohmann::json entity_info);
39 StatsComponent(
int max_hp,
int current_hp,
int max_mp,
int current_mp,
40 int max_xp,
int current_xp,
int level);
65 unsigned int new_value);
74 unsigned int new_value);
100 std::string get_ability_name();
void server_update(nlohmann::json entity_info)
Actualiza la componente segun la informacion de actualizacion del servidor.
Definition: stats_component.cpp:77
void init() override
Inicializa el componente con lo que necesite, es llamado en el momento de agregarlo a la entity.
Definition: stats_component.cpp:65
StatsComponent(int max_hp, int current_hp, int max_mp, int current_mp, int max_xp, int current_xp, int level)
Crea un objeto StatsComponent.
Definition: stats_component.cpp:7
void set_stat_max_value(const std::string &stat_name, unsigned int new_value)
Set the stat max value object.
Definition: stats_component.cpp:45
void update() override
Actualiza el componente.
Definition: stats_component.cpp:63
void set_stat_current_value(const std::string &stat_name, unsigned int new_value)
Setea el valor actual de un stat.
Definition: stats_component.cpp:54
Componente de stats de cualquier entidad.
Definition: stats_component.h:16
unsigned int get_stat_current_value(const std::string &stat_name)
Devuelve el valor actual de un stat.
Definition: stats_component.cpp:27
Componente agregable a entidades.
Definition: component.h:10
void set_level(int new_level)
Setea el nivel.
Definition: stats_component.cpp:67
unsigned int get_stat_max_value(const std::string &stat_name)
Devuelve el valor maximo de un stat.
Definition: stats_component.cpp:37
int get_level()
Devuelve el nivel.
Definition: stats_component.cpp:72