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

#include <AttributesImpl.hpp>

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

Public Member Functions

 BaseLevel (std::weak_ptr< Unit > unit, int32_t base=0)
 
 ~BaseLevel ()
 
void on_observable_changed (BaseExperience *wbexp)
 
void notify ()
 
void set_base (int32_t val, bool notify_client=true) override
 
void add_base (int32_t val, bool notify_client=true) override
 
void sub_base (int32_t val, bool notify_client=true) override
 
void set_equip (int32_t val, bool notify_client=true) override
 
void add_equip (int32_t val, bool notify_client=true) override
 
void sub_equip (int32_t val, bool notify_client=true) override
 
void set_status (int32_t val, bool notify_client=true) override
 
void add_status (int32_t val, bool notify_client=true) override
 
void sub_status (int32_t val, bool notify_client=true) override
 
- 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
 
- Public Member Functions inherited from ObservableStatus< BaseLevel *, StatusPoint *, MaxHP *, MaxSP *, NextBaseExperience *, StatusATK *, StatusMATK *, SoftDEF *, SoftMDEF *, HIT *, FLEE *, AttackSpeed *, BaseAttack * >
 ObservableStatus (HAS_OBSERVERS ... args)
 
 ~ObservableStatus ()
 
std::enable_if< I==sizeof...(Tp), void >::type notify (std::tuple< Tp... > &)
 
 notify (t)
 
 std::enable_if (_observers) -> on_observable_changed(_observable)
 
void notify_observers ()
 
void register_observable (BaseLevel * obs)
 
void register_observers (HAS_OBSERVERS... obs)
 

Additional Inherited Members

- Public Attributes inherited from ObservableStatus< BaseLevel *, StatusPoint *, MaxHP *, MaxSP *, NextBaseExperience *, StatusATK *, StatusMATK *, SoftDEF *, SoftMDEF *, HIT *, FLEE *, AttackSpeed *, BaseAttack * >
BaseLevel * _observable
 
std::tuple< HAS_OBSERVERS... > _observers
 
- 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

◆ BaseLevel()

Horizon::Zone::Traits::BaseLevel::BaseLevel ( std::weak_ptr< Unit unit,
int32_t  base = 0 
)
inline
95 : Attribute(unit, STATUS_BASELEVEL, base, 0, 0),
96 ObservableStatus(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)
97 { }
@ STATUS_BASELEVEL
Definition: UnitDefinitions.hpp:100
std::shared_ptr< Unit > unit()
Definition: Attribute.hpp:259

◆ ~BaseLevel()

Horizon::Zone::Traits::BaseLevel::~BaseLevel ( )
inline
98{ };

Member Function Documentation

◆ add_base()

void Horizon::Zone::Traits::BaseLevel::add_base ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

◆ add_equip()

void Horizon::Zone::Traits::BaseLevel::add_equip ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

◆ add_status()

void Horizon::Zone::Traits::BaseLevel::add_status ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

◆ notify()

void Horizon::Zone::Traits::BaseLevel::notify ( )

◆ on_observable_changed()

void BaseLevel::on_observable_changed ( BaseExperience wbexp)
398{
399 if (unit() == nullptr || bexp == nullptr)
400 return;
401
402 std::shared_ptr<const job_config_data> job = JobDB->get_job_by_id(unit()->job_id());
403 std::shared_ptr<const exp_group_data> bexpg = ExpDB->get_exp_group(job->base_exp_group, EXP_GROUP_TYPE_BASE);
404
405 if (get_base() >= bexpg->max_level)
406 return;
407
408 if (bexp->get_base() >= unit()->status()->next_base_experience()->get_base()) {
409 int carried_over = bexp->get_base() - unit()->status()->next_base_experience()->get_base();
410 add_base(1);
411 bexp->set_base(carried_over);
412 }
413}
#define ExpDB
Definition: ExpDB.hpp:93
#define JobDB
Definition: JobDB.hpp:87
virtual int32_t get_base() const
Definition: Attribute.hpp:269
void add_base(int32_t val, bool notify_client=true) override
Definition: AttributesImpl.hpp:109
@ EXP_GROUP_TYPE_BASE
Definition: ExpDB.hpp:51

References Horizon::Zone::EXP_GROUP_TYPE_BASE, ExpDB, Horizon::Zone::Traits::s_attribute_change_values::get_base(), Horizon::Zone::Traits::Attribute::get_base(), JobDB, Horizon::Zone::Traits::BaseExperience::set_base(), and Horizon::Zone::Traits::s_attribute_change_values::status.

+ Here is the call graph for this function:

◆ set_base()

void Horizon::Zone::Traits::BaseLevel::set_base ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

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

104 {
105 Attribute::set_base(val, notify_client);
106 this->notify_observers();
107 }
virtual void set_base(int32_t val, bool notify=true)
Definition: Attribute.hpp:262

References ObservableStatus< BaseLevel *, StatusPoint *, MaxHP *, MaxSP *, NextBaseExperience *, StatusATK *, StatusMATK *, SoftDEF *, SoftMDEF *, HIT *, FLEE *, AttackSpeed *, BaseAttack * >::notify_observers(), and Horizon::Zone::Traits::Attribute::set_base().

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

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

◆ set_equip()

void Horizon::Zone::Traits::BaseLevel::set_equip ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

◆ set_status()

void Horizon::Zone::Traits::BaseLevel::set_status ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

◆ sub_base()

void Horizon::Zone::Traits::BaseLevel::sub_base ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

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

116 {
117 Attribute::sub_base(val, notify_client);
118 this->notify_observers();
119 }
virtual void sub_base(int32_t val, bool notify=true)
Definition: Attribute.cpp:248

References ObservableStatus< BaseLevel *, StatusPoint *, MaxHP *, MaxSP *, NextBaseExperience *, StatusATK *, StatusMATK *, SoftDEF *, SoftMDEF *, HIT *, FLEE *, AttackSpeed *, BaseAttack * >::notify_observers(), and Horizon::Zone::Traits::Attribute::sub_base().

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

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

◆ sub_equip()

void Horizon::Zone::Traits::BaseLevel::sub_equip ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

◆ sub_status()

void Horizon::Zone::Traits::BaseLevel::sub_status ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

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