Horizon Official Technical Documentation
Horizon::Zone::CombatRegistry::SkillExecutionOperation Class Reference

#include <Combat.hpp>

+ Inheritance diagram for Horizon::Zone::CombatRegistry::SkillExecutionOperation:
+ Collaboration diagram for Horizon::Zone::CombatRegistry::SkillExecutionOperation:

Classes

class  SkillExecutionOperand
 

Public Types

enum  skill_execution_operation_type { SKILL_EXECUTION_OPERATION_CAST = 0 , SKILL_EXECUTION_OPERATION_TARGET = 1 , SKILL_EXECUTION_OPERATION_GROUND }
 
- Public Types inherited from Horizon::Zone::CombatRegistry::CombatOperation
enum  combat_operation_type {
  COMBAT_OPERATION_ATTRIBUTE , COMBAT_OPERATION_APPEARANCE , COMBAT_OPERATION_STATUS , COMBAT_OPERATION_SKILL_EXECUTION ,
  COMBAT_OPERATION_MELEE_EXECUTION , COMBAT_OPERATION_SKILL_RESULT , COMBAT_OPERATION_MELEE_RESULT , COMBAT_OPERATION_MAX
}
 

Public Member Functions

 SkillExecutionOperation ()=delete
 
 SkillExecutionOperation (SkillExecutionOperand *operand, skill_execution_operation_type type)
 
 ~SkillExecutionOperation ()
 
void execute () const override
 
- Public Member Functions inherited from Horizon::Zone::CombatRegistry::CombatOperation
 CombatOperation ()=delete
 
 CombatOperation (const CombatOperation &right)=delete
 
 CombatOperation (CombatOperation &&right)=delete
 
 CombatOperation (CombatOperand *operand, int operation_type, int operation_sub_type, CombatOperationValue *value)
 
 CombatOperation (CombatOperand *operand, int operation_type, int operation_sub_type)
 
virtual ~CombatOperation ()
 
virtual CombatOperandget_operand () const
 
int get_operation_type () const
 
int get_operation_sub_type () const
 
virtual CombatOperationValueget_operation_value () const
 
int get_priority ()
 
void set_priority (int priority)
 
virtual void execute () const =0
 
void operator= (const CombatOperation &operation)=delete
 

Additional Inherited Members

- Protected Attributes inherited from Horizon::Zone::CombatRegistry::CombatOperation
CombatOperand_operand {nullptr}
 
int _operation_type { 0 }
 
int _operation_sub_type { 0 }
 
CombatOperationValue_operation_value {nullptr}
 
int _priority { 0 }
 

Member Enumeration Documentation

◆ skill_execution_operation_type

Enumerator
SKILL_EXECUTION_OPERATION_CAST 
SKILL_EXECUTION_OPERATION_TARGET 
SKILL_EXECUTION_OPERATION_GROUND 

Constructor & Destructor Documentation

◆ SkillExecutionOperation() [1/2]

Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperation ( )
delete

◆ SkillExecutionOperation() [2/2]

Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperation ( SkillExecutionOperand operand,
skill_execution_operation_type  type 
)
inline

◆ ~SkillExecutionOperation()

Horizon::Zone::CombatRegistry::SkillExecutionOperation::~SkillExecutionOperation ( )
inline
475{ }

Member Function Documentation

◆ execute()

void CombatRegistry::SkillExecutionOperation::execute ( ) const
overridevirtual

Implements Horizon::Zone::CombatRegistry::CombatOperation.

448{
451 std::shared_ptr<Unit> source = operand->get_source();
452 std::shared_ptr<Unit> target = operand->get_target();
453
454 switch(get_operation_sub_type())
455 {
457 {
458 s_unit_skill_use_notifier_config notifier_config;
459 notifier_config.skill_id = config.skill_id;
460 notifier_config.cast_time = config.cast_time;
461 notifier_config.element = config.element;
462 notifier_config.source_guid = source->guid();
463 notifier_config.target_guid = target->guid();
464 notifier_config.target_x = target->map_coords().x();
465 notifier_config.target_y = target->map_coords().y();
466 source->notify_nearby_players_of_skill_use(grid_unit_skill_use_notification_type::GRID_UNIT_SKILL_USE_NOTIFY_CASTTIME, notifier_config);
467
468 if (source->is_walking())
469 source->stop_walking(true, true);
470
471 HLog(debug) << "Casting skill: " << config.skd->name << " on target: " << target->guid() << "." << std::endl;
472 source->map()->container()->getScheduler().Schedule(
473 Milliseconds(config.cast_time),
474 source->get_scheduler_task_id(UNIT_SCHEDULE_SKILL_CAST),
475 [this, config, target] (TaskContext context)
476 {
477 config.cast_end_function(config.skill_cast_data, config.skd);
478 HLog(debug) << "Cast complete for skill: " << config.skd->name << " on target: " << target->guid() << "." << std::endl;
479 }
480 );
481 }
482 break;
484 {
485 HLog(debug) << "Started skill execution on target: " << target->guid() << " with skill: " << config.skd->name << "." << std::endl;
486 config.skill_execution->execute(target->guid());
487 HLog(debug) << "Finished skill execution on target: " << target->guid() << " with skill: " << config.skd->name << "." << std::endl;
488 }
489 break;
491 {
492 if (config.contents.size() > 0)
493 config.skill_execution->execute(config.pos_x, config.pos_y, config.contents);
494 else
495 config.skill_execution->execute(config.pos_x, config.pos_y);
496 }
497 break;
498 }
499}
@ GRID_UNIT_SKILL_USE_NOTIFY_CASTTIME
Definition: GridDefinitions.hpp:89
#define HLog(type)
Definition: Logger.hpp:122
std::chrono::milliseconds Milliseconds
Definition: TaskScheduler.hpp:31
@ UNIT_SCHEDULE_SKILL_CAST
Definition: Unit.hpp:60
std::shared_ptr< Unit > get_target()
Definition: Combat.hpp:263
std::shared_ptr< Unit > get_source()
Definition: Combat.hpp:262
int get_operation_sub_type() const
Definition: Combat.hpp:319
virtual CombatOperand * get_operand() const
Definition: Combat.hpp:317
s_skill_execution_operation_config & get_config()
Definition: Combat.hpp:461
Definition: TaskScheduler.hpp:487
Definition: GridNotifiers.hpp:364
int target_guid
Definition: GridNotifiers.hpp:365
int source_guid
Definition: GridNotifiers.hpp:365
int target_x
Definition: GridNotifiers.hpp:369
int element
Definition: GridNotifiers.hpp:370
int cast_time
Definition: GridNotifiers.hpp:370
int skill_id
Definition: GridNotifiers.hpp:365
int target_y
Definition: GridNotifiers.hpp:369

References s_unit_skill_use_notifier_config::cast_time, Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperand::s_skill_execution_operation_config::cast_time, Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperand::s_skill_execution_operation_config::contents, s_unit_skill_use_notifier_config::element, Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperand::s_skill_execution_operation_config::element, Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperand::get_config(), Horizon::Zone::CombatRegistry::CombatOperand::get_source(), Horizon::Zone::CombatRegistry::CombatOperand::get_target(), GRID_UNIT_SKILL_USE_NOTIFY_CASTTIME, HLog, Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperand::s_skill_execution_operation_config::pos_x, Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperand::s_skill_execution_operation_config::pos_y, Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperand::s_skill_execution_operation_config::skd, Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperand::s_skill_execution_operation_config::skill_execution, s_unit_skill_use_notifier_config::skill_id, Horizon::Zone::CombatRegistry::SkillExecutionOperation::SkillExecutionOperand::s_skill_execution_operation_config::skill_id, s_unit_skill_use_notifier_config::source_guid, s_unit_skill_use_notifier_config::target_guid, s_unit_skill_use_notifier_config::target_x, s_unit_skill_use_notifier_config::target_y, and UNIT_SCHEDULE_SKILL_CAST.

+ Here is the call graph for this function:

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