Horizon Official Technical Documentation
Horizon::Zone::Traits::StatusATK Class Reference

#include <AttributesImpl.hpp>

+ Inheritance diagram for Horizon::Zone::Traits::StatusATK:
+ Collaboration diagram for Horizon::Zone::Traits::StatusATK:

Public Member Functions

 StatusATK (std::weak_ptr< Unit > unit)
 
 ~StatusATK ()
 
void on_observable_changed (Strength *)
 
void on_observable_changed (Dexterity *)
 
void on_observable_changed (Luck *)
 
void on_observable_changed (BaseLevel *)
 
int32_t compute ()
 
void set_base_level (BaseLevel *blvl)
 
void set_strength (Strength *str)
 
void set_dexterity (Dexterity *dex)
 
void set_luck (Luck *luk)
 
void set_weapon_type (item_weapon_type type)
 
- Public Member Functions inherited from Horizon::Zone::Traits::Attribute
 Attribute ()=default
 
 Attribute (std::weak_ptr< Unit > unit, status_point_type st_type, int32_t base=0, int32_t equip=0, int32_t status=0)
 
 Attribute (const Attribute &other)
 
 Attribute (Attribute &&other) noexcept
 
std::shared_ptr< Unitunit ()
 
void unit (std::shared_ptr< Unit > e)
 
virtual void set_base (int32_t val, bool notify=true)
 
virtual void add_base (int32_t val, bool notify=true)
 
virtual void sub_base (int32_t val, bool notify=true)
 
virtual int32_t get_base () const
 
virtual void set_equip (int32_t val, bool notify=true)
 
virtual void add_equip (int32_t val, bool notify=true)
 
virtual void sub_equip (int32_t val, bool notify=true)
 
virtual int32_t get_equip () const
 
virtual void set_status (int32_t val, bool notify=true)
 
virtual void add_status (int32_t val, bool notify=true)
 
virtual void sub_status (int32_t val, bool notify=true)
 
virtual int32_t get_status () const
 
virtual int32_t total () const
 
virtual int32_t compute ()
 
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+ (Attribute const &right) const
 
double operator/ (Attribute const &right)
 
double operator* (Attribute const &right)
 
int operator- (Attribute 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)
 
bool operator== (Attribute const &right)
 
bool operator!= (Attribute const &right)
 
bool operator> (Attribute const &right)
 
bool operator>= (Attribute const &right)
 
bool operator< (Attribute const &right)
 
bool operator<= (Attribute const &right)
 
Attribute operator= (Attribute &right)
 
Attribute operator= (Attribute &&right)
 
void add_permanent_change (s_attribute_change_values change, std::string source)
 
void remove_permanent_change (std::string source)
 
void add_temporary_change (s_attribute_change_values change, uint64_t duration, std::string source)
 
void remove_temporary_change (std::string source)
 
void add_periodic_change (s_attribute_change_values change, uint64_t duration, uint64_t interval, std::string source)
 
void remove_periodic_change (std::string source)
 
void update (uint64_t delta)
 
void apply (bool notify=true)
 
void reset ()
 
void notify ()
 
status_point_type get_type () const
 
bool needs_recalculation () const
 
void recalculate (bool flag)
 
bool is_compute_ready () const
 

Private Attributes

BaseLevel_blvl {nullptr}
 
Strength_str {nullptr}
 
Dexterity_dex {nullptr}
 
Luck_luk {nullptr}
 
item_weapon_type _weapon_type
 

Additional Inherited Members

- Protected Attributes inherited from Horizon::Zone::Traits::Attribute
status_point_type _status_point_type {status_point_type::STATUS_POINT_INVALID}
 
int32_t _base_val {0}
 
int32_t _equip_val {0}
 
int32_t _status_val {0}
 
bool _apply_periodic_changes {false}
 
bool _recalculate_flag {false}
 
bool _calculate_ready {false}
 

Constructor & Destructor Documentation

◆ StatusATK()

Horizon::Zone::Traits::StatusATK::StatusATK ( std::weak_ptr< Unit unit)
inline
1163 { }
@ STATUS_STATUS_ATK
Definition: UnitDefinitions.hpp:130
std::shared_ptr< Unit > unit()
Definition: Attribute.hpp:259

◆ ~StatusATK()

Horizon::Zone::Traits::StatusATK::~StatusATK ( )
inline
1164{ }

Member Function Documentation

◆ compute()

int32_t StatusATK::compute ( )
virtual

Reimplemented from Horizon::Zone::Traits::Attribute.

573{
574 int32_t blvl = 1, str = 1, dex = 1, luk = 1;
575
576 if (_blvl != nullptr)
577 blvl = _blvl->get_base();
578
579 if (_str != nullptr)
580 str = _str->total();
581
582 if (_dex != nullptr)
583 dex = _dex->total();
584
585 if (_luk != nullptr)
586 luk = _luk->total();
587
588 // Ranged: floor[(BaseLevel ÷ 4) + (Str ÷ 5) + Dex + (Luk ÷ 3)]
589 if (((1ULL << _weapon_type) & IT_WTM_RANGED) & ~(1ULL<<IT_WT_FIST))
590 set_base(dex + (blvl / 4) + (str / 5) + (luk / 3));
591 else // Melee: floor[(BaseLevel ÷ 4) + Str + (Dex ÷ 5) + (Luk ÷ 3)]
592 set_base(str + (blvl / 4) + (dex / 5) + (luk / 3));
593
594 return total();
595}
@ IT_WTM_RANGED
Definition: ItemDefinitions.hpp:139
@ IT_WT_FIST
Bare hands.
Definition: ItemDefinitions.hpp:100
virtual void set_base(int32_t val, bool notify=true)
Definition: Attribute.hpp:262
virtual int32_t get_base() const
Definition: Attribute.hpp:269
virtual int32_t total() const
Definition: Attribute.hpp:289
item_weapon_type _weapon_type
Definition: AttributesImpl.hpp:1184
BaseLevel * _blvl
Definition: AttributesImpl.hpp:1180
Strength * _str
Definition: AttributesImpl.hpp:1181
Dexterity * _dex
Definition: AttributesImpl.hpp:1182
Luck * _luk
Definition: AttributesImpl.hpp:1183

References IT_WT_FIST, IT_WTM_RANGED, and Horizon::Zone::Traits::s_attribute_change_values::set_base().

Referenced by on_observable_changed(), and set_weapon_type().

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

◆ on_observable_changed() [1/4]

void Horizon::Zone::Traits::StatusATK::on_observable_changed ( BaseLevel )
inline
1169{ if (is_compute_ready()) compute(); }
bool is_compute_ready() const
Definition: Attribute.hpp:412
int32_t compute()
Definition: Attribute.cpp:572

References compute(), and Horizon::Zone::Traits::Attribute::is_compute_ready().

+ Here is the call graph for this function:

◆ on_observable_changed() [2/4]

void Horizon::Zone::Traits::StatusATK::on_observable_changed ( Dexterity )
inline
1167{ if (is_compute_ready()) compute(); }

References compute(), and Horizon::Zone::Traits::Attribute::is_compute_ready().

+ Here is the call graph for this function:

◆ on_observable_changed() [3/4]

void Horizon::Zone::Traits::StatusATK::on_observable_changed ( Luck )
inline
1168{ if (is_compute_ready()) compute(); }

References compute(), and Horizon::Zone::Traits::Attribute::is_compute_ready().

+ Here is the call graph for this function:

◆ on_observable_changed() [4/4]

void Horizon::Zone::Traits::StatusATK::on_observable_changed ( Strength )
inline
1166{ if (is_compute_ready()) compute(); }

References compute(), and Horizon::Zone::Traits::Attribute::is_compute_ready().

+ Here is the call graph for this function:

◆ set_base_level()

void Horizon::Zone::Traits::StatusATK::set_base_level ( BaseLevel blvl)
inline
1173{ _blvl = blvl; }

References _blvl.

◆ set_dexterity()

void Horizon::Zone::Traits::StatusATK::set_dexterity ( Dexterity dex)
inline
1175{ _dex = dex; }

References _dex.

◆ set_luck()

void Horizon::Zone::Traits::StatusATK::set_luck ( Luck luk)
inline
1176{ _luk = luk; }

References _luk.

◆ set_strength()

void Horizon::Zone::Traits::StatusATK::set_strength ( Strength str)
inline
1174{ _str = str; }

References _str.

◆ set_weapon_type()

void Horizon::Zone::Traits::StatusATK::set_weapon_type ( item_weapon_type  type)
inline
1177{ _weapon_type = type; if (is_compute_ready()) compute(); }

References _weapon_type, compute(), and Horizon::Zone::Traits::Attribute::is_compute_ready().

+ Here is the call graph for this function:

Member Data Documentation

◆ _blvl

BaseLevel* Horizon::Zone::Traits::StatusATK::_blvl {nullptr}
private

Referenced by set_base_level().

◆ _dex

Dexterity* Horizon::Zone::Traits::StatusATK::_dex {nullptr}
private

Referenced by set_dexterity().

◆ _luk

Luck* Horizon::Zone::Traits::StatusATK::_luk {nullptr}
private

Referenced by set_luck().

◆ _str

Strength* Horizon::Zone::Traits::StatusATK::_str {nullptr}
private

Referenced by set_strength().

◆ _weapon_type

item_weapon_type Horizon::Zone::Traits::StatusATK::_weapon_type
private

Referenced by set_weapon_type().


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