Horizon Official Technical Documentation
Horizon::Zone::Units::Mob Class Reference

#include <Mob.hpp>

+ Inheritance diagram for Horizon::Zone::Units::Mob:
+ Collaboration diagram for Horizon::Zone::Units::Mob:

Public Member Functions

 Mob (uint64_t uuid, unit_type type, unit_type_mask type_mask, std::shared_ptr< Map > map, MapCoords mcoords)
 
 ~Mob () override
 
bool initialize (std::shared_ptr< const monster_config_data > md)
 
virtual bool finalize () override
 
virtual void on_damage_received (std::shared_ptr< Unit > damage_dealer, int damage) override
 
virtual void on_killed (std::shared_ptr< Unit > killer, bool with_drops=false, bool with_exp=false) override
 
- Public Member Functions inherited from Horizon::Zone::Unit
 Unit (uint64_t uuid, unit_type type, unit_type_mask type_mask, std::shared_ptr< Map > map, MapCoords map_coords)
 
 Unit (uint64_t uuid, unit_type type, unit_type_mask type_mask)
 
virtual ~Unit ()
 
bool initialize ()
 
virtual bool finalize ()
 
bool is_initialized () const
 
bool is_finalized () const
 
void set_finalized (bool finalized)
 
MapCoords const & dest_coords () const
 Movement. More...
 
virtual bool walk_to_coordinates (int16_t x, int16_t y)
 
virtual bool walk_to_unit (std::shared_ptr< Unit > unit)
 
bool is_walking () const
 
virtual void stop_movement ()=0
 
bool stop_walking (bool cancel=false, bool notify=false)
 
uint64_t uuid () const
 Unit Data. More...
 
unit_uuid s_uuid () const
 
void set_uuid (uint64_t uuid)
 
uint32_t guid ()
 
uint16_t job_id () const
 
void set_job_id (uint16_t job_id)
 
unit_posture_type posture () const
 
void set_posture (unit_posture_type posture)
 
const std::string & name () const
 
void set_name (const std::string &name)
 
directions direction () const
 
void set_direction (directions dir)
 
std::shared_ptr< Horizon::Zone::Traits::Statusstatus ()
 
void set_status (std::shared_ptr< Horizon::Zone::Traits::Status > st)
 
void force_movement_stop_internal (bool stop=false)
 
std::shared_ptr< Mapmap ()
 Map & Map Container. More...
 
void set_map (std::shared_ptr< Map > map)
 
AStar::CoordinateList get_walk_path ()
 
unit_type type () const
 Unit applications. More...
 
unit_type_mask type_mask () const
 
bool is_of_type (int type_mask)
 
template<class T >
std::shared_ptr< T > downcast ()
 
MapCoords const & map_coords () const
 Grid applications. More...
 
void set_map_coords (MapCoords const &coords)
 
GridCoords const & grid_coords () const
 
void set_grid_coords (GridCoords const &coords)
 
bool is_in_range_of (std::shared_ptr< Unit > unit, uint8_t range=MAX_VIEW_RANGE)
 
void notify_nearby_players_of_existence (unit_viewport_notification_type notif_type)
 
void notify_nearby_players_of_spawn ()
 
void notify_nearby_players_of_movement (bool new_entry=false)
 
void notify_nearby_players_of_movement_stop (MapCoords stop_coords)
 
void notify_nearby_players_of_skill_use (grid_unit_skill_use_notification_type notification_type, s_unit_skill_use_notifier_config config)
 
void notify_nearby_players_of_basic_attack (s_grid_unit_basic_attack_config config)
 
void notify_nearby_players_of_item_drop (s_grid_notify_item_drop_entry entry)
 
std::shared_ptr< Unitget_nearby_unit (uint32_t guid)
 
uint64_t get_scheduler_task_id (unit_task_schedule_group group)
 
std::map< int16_t, std::shared_ptr< status_change_entry > > & get_status_effects ()
 
void apply_status_change_in_area (std::shared_ptr< Unit > target, s_grid_sc_apply_in_skill_area_config const &config, s_grid_apply_in_area_config const &aoe_config)
 
void remove_status_change_in_area (std::shared_ptr< Unit > target, int sc_type, s_grid_apply_in_area_config const &aoe_config)
 
void execute_skill_in_area (std::shared_ptr< Unit > target, std::shared_ptr< SkillExecution > skill_execution, s_grid_apply_in_area_config const &aoe_config)
 
void execute_skill_in_cell (std::shared_ptr< Unit > target, MapCoords cell, std::shared_ptr< SkillExecution > skill_execution, s_grid_apply_in_area_config const &aoe_config)
 
void use_skill_on_target (int16_t skill_lv, int16_t skill_id, int target_guid)
 
void use_skill_on_ground (int16_t skill_lv, int16_t skill_id, int16_t pos_x, int16_t pos_y)
 
void use_skill_on_ground (int16_t skill_lv, int16_t skill_id, int16_t pos_x, int16_t pos_y, std::string contents)
 
bool status_effect_start (int type, int total_time, int val1, int val2, int val3, int val4)
 Status Effects. More...
 
bool status_effect_end (int type)
 
virtual void on_status_effect_start (std::shared_ptr< status_change_entry > sce)=0
 
virtual void on_status_effect_end (std::shared_ptr< status_change_entry > sce)=0
 
virtual void on_status_effect_change (std::shared_ptr< status_change_entry > sce)=0
 
std::shared_ptr< AStar::CoordinateListpath_to (std::shared_ptr< Unit > e)
 
int distance_from (std::shared_ptr< Unit > e)
 
virtual bool attack (std::shared_ptr< Unit > target, bool continuous=false)
 
virtual bool stop_attacking ()
 
bool target_is_attackable (std::shared_ptr< Unit > target)
 
void set_attacking (bool attacking)
 
bool is_attacking ()
 
void on_attack_end ()
 
bool is_dead ()
 
virtual void on_damage_received (std::shared_ptr< Unit > damage_dealer, int damage)
 
virtual void on_killed (std::shared_ptr< Unit > killer, bool with_drops=false, bool with_exp=false)
 
std::shared_ptr< Combatcombat ()
 Combat. More...
 
void set_combat (std::shared_ptr< Combat > combat)
 
void update (uint64_t tick)
 Extremely time-sensitive functions. More...
 
std::shared_ptr< CombatRegistrycombat_registry ()
 
bool has_damage_walk_delay ()
 Walk Delay. More...
 
void set_damage_walk_delay (bool delay)
 
void set_lockon_after_walk_completed (uint64_t target_guid, bool continuous=false)
 Lockon after walk completed. More...
 
void clear_lockon_after_walk_completed ()
 
uint64_t lockon_after_walk_completed_target_guid ()
 

Additional Inherited Members

- Protected Member Functions inherited from Horizon::Zone::Unit
bool schedule_walk ()
 
void walk ()
 
virtual void on_pathfinding_failure ()=0
 
virtual void on_movement_begin (int32_t time)=0
 
virtual void on_movement_step ()=0
 
virtual void on_movement_end ()=0
 

Constructor & Destructor Documentation

◆ Mob()

Mob::Mob ( uint64_t  uuid,
unit_type  type,
unit_type_mask  type_mask,
std::shared_ptr< Map map,
MapCoords  mcoords 
)
41: Unit(uuid, type, type_mask, map, mcoords)
42{
43 //
44}
std::shared_ptr< Map > map()
Map & Map Container.
Definition: Unit.hpp:165
Unit(uint64_t uuid, unit_type type, unit_type_mask type_mask, std::shared_ptr< Map > map, MapCoords map_coords)
Definition: Unit.cpp:45
uint64_t uuid() const
Unit Data.
Definition: Unit.hpp:140
unit_type_mask type_mask() const
Definition: Unit.hpp:174
unit_type type() const
Unit applications.
Definition: Unit.hpp:173

◆ ~Mob()

Mob::~Mob ( )
override
47{
48}

Member Function Documentation

◆ finalize()

bool Mob::finalize ( )
overridevirtual

Reimplemented from Horizon::Zone::Unit.

Reimplemented in Horizon::Zone::Units::Monster.

64{
65 if (!Unit::finalize())
66 return false;
67
68 return true;
69}
virtual bool finalize()
Definition: Unit.cpp:86

References Horizon::Zone::Unit::finalize().

Referenced by Horizon::Zone::Units::Monster::finalize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initialize()

bool Mob::initialize ( std::shared_ptr< const monster_config_data md)
51{
52 if (Unit::initialize() == false)
53 return false;
54
55 if (status()->initialize(shared_from_this()->downcast<Mob>(), md) == false) {
56 HLog(error) << "Status::initialize: failed to initialize status for creature with monster id " << md->monster_id << ".";
57 return false;
58 }
59
60 return true;
61}
#define HLog(type)
Definition: Logger.hpp:122
bool initialize()
Definition: Unit.cpp:72
std::shared_ptr< Horizon::Zone::Traits::Status > status()
Definition: Unit.hpp:158

References HLog, Horizon::Zone::Unit::initialize(), and Horizon::Zone::Unit::status().

+ Here is the call graph for this function:

◆ on_damage_received()

void Mob::on_damage_received ( std::shared_ptr< Unit damage_dealer,
int  damage 
)
overridevirtual

Reimplemented from Horizon::Zone::Unit.

Reimplemented in Horizon::Zone::Units::Monster.

72{
73 Unit::on_damage_received(damage_dealer, damage);
74}
virtual void on_damage_received(std::shared_ptr< Unit > damage_dealer, int damage)
Definition: Unit.cpp:466

References Horizon::Zone::Unit::on_damage_received().

Referenced by Horizon::Zone::Units::Monster::on_damage_received().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_killed()

void Mob::on_killed ( std::shared_ptr< Unit killer,
bool  with_drops = false,
bool  with_exp = false 
)
overridevirtual

Reimplemented from Horizon::Zone::Unit.

Reimplemented in Horizon::Zone::Units::Monster.

77{
78 Unit::on_killed(killer, with_drops, with_exp);
79
80 if (killer->type() == UNIT_PLAYER) {
81 killer->downcast<Player>()->remove_unit_from_viewport(shared_from_this(), EVP_NOTIFY_DEAD);
82 }
83}
@ UNIT_PLAYER
Definition: UnitDefinitions.hpp:45
@ EVP_NOTIFY_DEAD
Definition: UnitDefinitions.hpp:839
virtual void on_killed(std::shared_ptr< Unit > killer, bool with_drops=false, bool with_exp=false)
Definition: Unit.cpp:476
Definition: Player.hpp:62

References EVP_NOTIFY_DEAD, Horizon::Zone::Unit::on_killed(), and UNIT_PLAYER.

Referenced by Horizon::Zone::Units::Monster::on_killed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: