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

#include <Combat.hpp>

Public Member Functions

 Damage (combat_damage_type_mask damage_type, std::shared_ptr< Unit > source, std::shared_ptr< Unit > target, int32_t skill_id=0, int32_t skill_lv=0)
 
 ~Damage ()=default
 
void add_right_damage (int64_t damage)
 
void sub_right_damage (int64_t damage)
 
int64_t get_right_damage ()
 
void set_right_damage (int64_t right_damage)
 
void add_left_damage (int64_t damage)
 
void sub_left_damage (int64_t damage)
 
int64_t get_left_damage ()
 
void set_left_damage (int64_t left_damage)
 
void add_defense (int64_t defense)
 
void sub_defense (int64_t defense)
 
int64_t get_defense ()
 
void set_defense (int64_t defense)
 
void set_hit_type (combat_damage_hit_type hit_type)
 
combat_damage_hit_type get_hit_type ()
 
int64_t total () const
 
int64_t calculate () const
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT operator+ (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT operator/ (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT operator* (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT operator- (TT right)
 
int operator+ (Damage const &right) const
 
double operator/ (Damage const &right)
 
double operator* (Damage const &right)
 
int operator- (Damage const &right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator== (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator!= (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator> (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator>= (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator< (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator<= (TT right)
 

Private Attributes

combat_damage_type_mask _damage_type { CBT_DMGMASK_NONE }
 
combat_damage_hit_type _hit_type { CBT_DMG_HIT_NORMAL }
 
std::weak_ptr< Unit_source
 
std::weak_ptr< Unit_target
 
int32_t _skill_id {0}
 
int32_t _skill_lv {0}
 
int64_t _right_damage {0}
 
int64_t _left_damage {0}
 
int64_t _defense {0}
 

Constructor & Destructor Documentation

◆ Damage()

Horizon::Zone::Damage::Damage ( combat_damage_type_mask  damage_type,
std::shared_ptr< Unit source,
std::shared_ptr< Unit target,
int32_t  skill_id = 0,
int32_t  skill_lv = 0 
)
inline
107 { }

◆ ~Damage()

Horizon::Zone::Damage::~Damage ( )
default

Member Function Documentation

◆ add_defense()

void Horizon::Zone::Damage::add_defense ( int64_t  defense)
inline
120{ _defense += defense; }
int64_t _defense
Definition: Combat.hpp:168

References _defense.

◆ add_left_damage()

void Horizon::Zone::Damage::add_left_damage ( int64_t  damage)
inline
115{ _left_damage += damage; }
int64_t _left_damage
Definition: Combat.hpp:167

References _left_damage.

◆ add_right_damage()

void Horizon::Zone::Damage::add_right_damage ( int64_t  damage)
inline
110{ _right_damage += damage; }
int64_t _right_damage
Definition: Combat.hpp:166

References _right_damage.

◆ calculate()

int64_t Horizon::Zone::Damage::calculate ( ) const
inline
130{ return _right_damage + _left_damage - _defense; }

References _defense, _left_damage, and _right_damage.

Referenced by total().

+ Here is the caller graph for this function:

◆ get_defense()

int64_t Horizon::Zone::Damage::get_defense ( )
inline
122{ return _defense; }

References _defense.

◆ get_hit_type()

combat_damage_hit_type Horizon::Zone::Damage::get_hit_type ( )
inline
126{ return _hit_type; }
combat_damage_hit_type _hit_type
Definition: Combat.hpp:161

References _hit_type.

◆ get_left_damage()

int64_t Horizon::Zone::Damage::get_left_damage ( )
inline
117{ return _left_damage; }

References _left_damage.

◆ get_right_damage()

int64_t Horizon::Zone::Damage::get_right_damage ( )
inline
112{ return _right_damage; }

References _right_damage.

◆ operator!=()

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool Horizon::Zone::Damage::operator!= ( TT  right)
inline
149{ return total() != right; }
int64_t total() const
Definition: Combat.hpp:128

References total().

+ Here is the call graph for this function:

◆ operator*() [1/2]

double Horizon::Zone::Damage::operator* ( Damage const &  right)
inline
143{ return right.total() * total(); }

References total().

+ Here is the call graph for this function:

◆ operator*() [2/2]

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT Horizon::Zone::Damage::operator* ( TT  right)
inline
137{ return total() * right; }

References total().

+ Here is the call graph for this function:

◆ operator+() [1/2]

int Horizon::Zone::Damage::operator+ ( Damage const &  right) const
inline
141{ return right.total() + total(); }

References total().

+ Here is the call graph for this function:

◆ operator+() [2/2]

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT Horizon::Zone::Damage::operator+ ( TT  right)
inline
133{ return total() + right; }

References total().

+ Here is the call graph for this function:

◆ operator-() [1/2]

int Horizon::Zone::Damage::operator- ( Damage const &  right)
inline
144{ return right.total() - total(); }

References total().

+ Here is the call graph for this function:

◆ operator-() [2/2]

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT Horizon::Zone::Damage::operator- ( TT  right)
inline
139{ return total() - right; }

References total().

+ Here is the call graph for this function:

◆ operator/() [1/2]

double Horizon::Zone::Damage::operator/ ( Damage const &  right)
inline
142{ return right.total() / total(); }

References total().

+ Here is the call graph for this function:

◆ operator/() [2/2]

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT Horizon::Zone::Damage::operator/ ( TT  right)
inline
135{ return total() / right; }

References total().

+ Here is the call graph for this function:

◆ operator<()

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool Horizon::Zone::Damage::operator< ( TT  right)
inline
155{ return total() < right; }

References total().

+ Here is the call graph for this function:

◆ operator<=()

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool Horizon::Zone::Damage::operator<= ( TT  right)
inline
157{ return total() <= right; }

References total().

+ Here is the call graph for this function:

◆ operator==()

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool Horizon::Zone::Damage::operator== ( TT  right)
inline
147{ return total() == right; }

References total().

+ Here is the call graph for this function:

◆ operator>()

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool Horizon::Zone::Damage::operator> ( TT  right)
inline
151{ return total() > right; }

References total().

+ Here is the call graph for this function:

◆ operator>=()

template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool Horizon::Zone::Damage::operator>= ( TT  right)
inline
153{ return total() >= right; }

References total().

+ Here is the call graph for this function:

◆ set_defense()

void Horizon::Zone::Damage::set_defense ( int64_t  defense)
inline
123{ _defense = defense; }

References _defense.

◆ set_hit_type()

void Horizon::Zone::Damage::set_hit_type ( combat_damage_hit_type  hit_type)
inline
125{ _hit_type = hit_type; }

References _hit_type.

◆ set_left_damage()

void Horizon::Zone::Damage::set_left_damage ( int64_t  left_damage)
inline
118{ _left_damage = left_damage; }

References _left_damage.

◆ set_right_damage()

void Horizon::Zone::Damage::set_right_damage ( int64_t  right_damage)
inline
113{ _right_damage = right_damage; }

References _right_damage.

◆ sub_defense()

void Horizon::Zone::Damage::sub_defense ( int64_t  defense)
inline
121{ _defense -= defense; }

References _defense.

◆ sub_left_damage()

void Horizon::Zone::Damage::sub_left_damage ( int64_t  damage)
inline
116{ _left_damage -= damage; }

References _left_damage.

◆ sub_right_damage()

void Horizon::Zone::Damage::sub_right_damage ( int64_t  damage)
inline
111{ _right_damage -= damage; }

References _right_damage.

◆ total()

int64_t Horizon::Zone::Damage::total ( ) const
inline
128{ return calculate(); }
int64_t calculate() const
Definition: Combat.hpp:130

References calculate().

Referenced by operator!=(), operator*(), operator+(), operator-(), operator/(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

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

Member Data Documentation

◆ _damage_type

combat_damage_type_mask Horizon::Zone::Damage::_damage_type { CBT_DMGMASK_NONE }
private

◆ _defense

int64_t Horizon::Zone::Damage::_defense {0}
private

◆ _hit_type

combat_damage_hit_type Horizon::Zone::Damage::_hit_type { CBT_DMG_HIT_NORMAL }
private

Referenced by get_hit_type(), and set_hit_type().

◆ _left_damage

int64_t Horizon::Zone::Damage::_left_damage {0}
private

◆ _right_damage

int64_t Horizon::Zone::Damage::_right_damage {0}
private

◆ _skill_id

int32_t Horizon::Zone::Damage::_skill_id {0}
private

◆ _skill_lv

int32_t Horizon::Zone::Damage::_skill_lv {0}
private

◆ _source

std::weak_ptr<Unit> Horizon::Zone::Damage::_source
private

◆ _target

std::weak_ptr<Unit> Horizon::Zone::Damage::_target
private

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