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

#include <Combat.hpp>

Classes

class  AttributeOperation
 
class  CombatOperand
 
class  CombatOperation
 
class  CombatOperationValue
 
class  CombatStage
 
class  CombatValueDamage
 
class  CombatValueHealing
 
class  CombatValueInteger
 
struct  CompareCombatOperation
 
struct  CompareCombatStage
 
class  MeleeExecutionOperation
 
class  MeleeResultOperation
 
class  SkillExecutionOperation
 
class  SkillResultOperation
 
class  StatusOperation
 

Public Types

enum  combat_operation_value_type {
  COMBAT_OPERATION_VALUE_INTEGER , COMBAT_OPERATION_VALUE_DAMAGE , COMBAT_OPERATION_VALUE_HEALING , COMBAT_OPERATION_VALUE_STATUS ,
  COMBAT_OPERATION_VALUE_NONE
}
 

Public Member Functions

 CombatRegistry (std::shared_ptr< Unit > unit)
 
 ~CombatRegistry ()
 
std::shared_ptr< Unitget_unit ()
 
CombatStagecreate_combat_stage (int priority)
 
void queue_combat_stage (CombatStage *stage)
 
void process_queue ()
 

Private Attributes

std::weak_ptr< Unit_unit
 
std::priority_queue< CombatStage *, std::vector< CombatStage * >, CompareCombatStage_combat_stage_queue
 

Member Enumeration Documentation

◆ combat_operation_value_type

Enumerator
COMBAT_OPERATION_VALUE_INTEGER 
COMBAT_OPERATION_VALUE_DAMAGE 
COMBAT_OPERATION_VALUE_HEALING 
COMBAT_OPERATION_VALUE_STATUS 
COMBAT_OPERATION_VALUE_NONE 
175 {
181 };
@ COMBAT_OPERATION_VALUE_INTEGER
Definition: Combat.hpp:176
@ COMBAT_OPERATION_VALUE_DAMAGE
Definition: Combat.hpp:177
@ COMBAT_OPERATION_VALUE_HEALING
Definition: Combat.hpp:178
@ COMBAT_OPERATION_VALUE_STATUS
Definition: Combat.hpp:179
@ COMBAT_OPERATION_VALUE_NONE
Definition: Combat.hpp:180

Constructor & Destructor Documentation

◆ CombatRegistry()

CombatRegistry::CombatRegistry ( std::shared_ptr< Unit unit)
46: _unit(unit)
47{
48
49}
std::weak_ptr< Unit > _unit
Definition: Combat.hpp:648

◆ ~CombatRegistry()

CombatRegistry::~CombatRegistry ( )
52{
53
54}

Member Function Documentation

◆ create_combat_stage()

CombatStage * Horizon::Zone::CombatRegistry::create_combat_stage ( int  priority)
inline
641{ return new CombatStage(priority); }

Referenced by Horizon::Zone::CombatComponent::sync_data_types().

+ Here is the caller graph for this function:

◆ get_unit()

std::shared_ptr< Unit > Horizon::Zone::CombatRegistry::get_unit ( )
inline
639{ return _unit.lock(); }

References _unit.

◆ process_queue()

void CombatRegistry::process_queue ( )
601{
602 while (!_combat_stage_queue.empty()) {
603 CombatStage *combat_stage = _combat_stage_queue.top();
604 HLog(debug) << "Started combat stage: " << (void *) combat_stage << std::endl;
606 while (combat_stage->has_operations()) {
607 const CombatOperation *operation = combat_stage->get_next_operation();
608 combat_stage->pop_queue();
609 operation->execute();
610 delete operation;
611 }
612 HLog(debug) << "Ended combat stage: " << (void *) combat_stage << std::endl;
613 delete combat_stage;
614 };
615}
#define HLog(type)
Definition: Logger.hpp:122
std::priority_queue< CombatStage *, std::vector< CombatStage * >, CompareCombatStage > _combat_stage_queue
Definition: Combat.hpp:649

References _combat_stage_queue, Horizon::Zone::CombatRegistry::CombatOperation::execute(), Horizon::Zone::CombatRegistry::CombatStage::get_next_operation(), Horizon::Zone::CombatRegistry::CombatStage::has_operations(), HLog, and Horizon::Zone::CombatRegistry::CombatStage::pop_queue().

+ Here is the call graph for this function:

◆ queue_combat_stage()

void Horizon::Zone::CombatRegistry::queue_combat_stage ( CombatStage stage)
inline
643{ _combat_stage_queue.push(stage); }

References _combat_stage_queue.

Referenced by Horizon::Zone::CombatComponent::sync_data_types().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _combat_stage_queue

std::priority_queue<CombatStage *, std::vector<CombatStage *>, CompareCombatStage> Horizon::Zone::CombatRegistry::_combat_stage_queue
private

◆ _unit

std::weak_ptr<Unit> Horizon::Zone::CombatRegistry::_unit
private

Referenced by get_unit().


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