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

#include <AttributesImpl.hpp>

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

Public Member Functions

 SoftMDEF (std::weak_ptr< Unit > unit)
 
 ~SoftMDEF ()
 
void on_observable_changed (Intelligence *)
 
void on_observable_changed (Dexterity *)
 
void on_observable_changed (Vitality *)
 
void on_observable_changed (BaseLevel *)
 
int32_t compute ()
 
void set_base_level (BaseLevel *blvl)
 
void set_intelligence (Intelligence *int_)
 
void set_dexterity (Dexterity *dex)
 
void set_vitality (Vitality *vit)
 
- 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}
 
Intelligence_int {nullptr}
 
Dexterity_dex {nullptr}
 
Vitality_vit {nullptr}
 

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

◆ SoftMDEF()

Horizon::Zone::Traits::SoftMDEF::SoftMDEF ( std::weak_ptr< Unit unit)
inline
1308 { }
@ STATUS_SOFT_MDEF
Definition: UnitDefinitions.hpp:136
std::shared_ptr< Unit > unit()
Definition: Attribute.hpp:259

◆ ~SoftMDEF()

Horizon::Zone::Traits::SoftMDEF::~SoftMDEF ( )
inline
1309{ }

Member Function Documentation

◆ compute()

int32_t SoftMDEF::compute ( )
virtual

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

693{
694 int32_t blvl = 1, int_ = 1, dex = 1, vit = 1;
695
696 if (_blvl != nullptr)
697 blvl = _blvl->get_base();
698
699 if (_int != nullptr)
700 int_ = _int->total();
701
702 if (_dex != nullptr)
703 dex = _dex->total();
704
705 if (_vit != nullptr)
706 vit = _vit->total();
707
708 // INT + VIT ÷ 5 + DEX ÷ 5 + BaseLv ÷ 4
709 set_base(int_ + (vit / 5) + (dex / 5) + (blvl / 4));
710
711 return total();
712}
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
BaseLevel * _blvl
Definition: AttributesImpl.hpp:1324
Vitality * _vit
Definition: AttributesImpl.hpp:1327
Dexterity * _dex
Definition: AttributesImpl.hpp:1326
Intelligence * _int
Definition: AttributesImpl.hpp:1325

References Horizon::Zone::Traits::s_attribute_change_values::set_base().

Referenced by on_observable_changed().

+ 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::SoftMDEF::on_observable_changed ( BaseLevel )
inline
1314{ if (is_compute_ready()) compute(); }
bool is_compute_ready() const
Definition: Attribute.hpp:412
int32_t compute()
Definition: Attribute.cpp:692

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::SoftMDEF::on_observable_changed ( Dexterity )
inline
1312{ 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::SoftMDEF::on_observable_changed ( Intelligence )
inline
1311{ 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::SoftMDEF::on_observable_changed ( Vitality )
inline
1313{ 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::SoftMDEF::set_base_level ( BaseLevel blvl)
inline
1318{ _blvl = blvl; }

References _blvl.

◆ set_dexterity()

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

References _dex.

◆ set_intelligence()

void Horizon::Zone::Traits::SoftMDEF::set_intelligence ( Intelligence int_)
inline
1319{ _int = int_; }

References _int.

◆ set_vitality()

void Horizon::Zone::Traits::SoftMDEF::set_vitality ( Vitality vit)
inline
1321{ _vit = vit; }

References _vit.

Member Data Documentation

◆ _blvl

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

Referenced by set_base_level().

◆ _dex

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

Referenced by set_dexterity().

◆ _int

Intelligence* Horizon::Zone::Traits::SoftMDEF::_int {nullptr}
private

Referenced by set_intelligence().

◆ _vit

Vitality* Horizon::Zone::Traits::SoftMDEF::_vit {nullptr}
private

Referenced by set_vitality().


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