61 lines
2.1 KiB
C++
61 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include "attrdefine.h"
|
|
#include "weakptr.h"
|
|
|
|
typedef std::weak_ptr<struct AttrAdditionPtr> AttrAdditionHandle;
|
|
typedef std::weak_ptr<struct AttrRuducePtr> AttrRuduceHandle;
|
|
typedef std::weak_ptr<struct AttrAbsPtr> AttrAbsHandle;
|
|
typedef std::weak_ptr<struct AttrRatePtr> AttrRateHandle;
|
|
|
|
class Ability
|
|
{
|
|
public:
|
|
Ability(CreatureWeakPtr owner);
|
|
|
|
void IncImmuneTimes(int tag);
|
|
void DecImmuneTimes(int tag);
|
|
bool CanImmune(int tag);
|
|
bool CanImmune(const std::set<int>& tags);
|
|
void IncDisableShotTimes();
|
|
void DecDisableShotTimes();
|
|
int GetDisableShotTimes();
|
|
void IncDisableUseSkillTimes();
|
|
void DecDisableUseSkillTimes();
|
|
int GetDisableUseSkillTimes();
|
|
|
|
AttrAbsHandle AddAttrAbs(int attr_id, float value);
|
|
void RemoveAttrAbs(AttrAbsHandle handle);
|
|
AttrRateHandle AddAttrRate(int attr_id, float value);
|
|
void RemoveAttrRate(AttrRateHandle handle);
|
|
float GetAttrAbs(int attr_id);
|
|
float GetAttrRate(int attr_id);
|
|
|
|
AttrAdditionHandle AddAttrAddition(int attr_id, float rate);
|
|
void RemoveAttrAddition(AttrAdditionHandle handler);
|
|
AttrRuduceHandle AddAttrRuduce(int attr_id, float rate);
|
|
void RemoveAttrRuduce(AttrRuduceHandle handler);
|
|
float GetAttrAddition(int attr_id);
|
|
float GetAttrRuduce(int attr_id);
|
|
private:
|
|
void Clear();
|
|
void RecalcAttrAbs(int attr_id);
|
|
void RecalcAttrRate(int attr_id);
|
|
void RecalcAttrAddition(int attr_id);
|
|
void RecalcAttrRuduce(int attr_id);
|
|
private:
|
|
CreatureWeakPtr owner_;
|
|
std::array<std::tuple<float, list_head>, kHAT_End> attr_abs_ = {};
|
|
std::array<std::tuple<float, list_head>, kHAT_End> attr_rate_ = {};
|
|
std::array<std::tuple<float, list_head>, kHAT_End> attr_add_ = {};
|
|
std::array<std::tuple<float, list_head>, kHAT_End> attr_dec_ = {};
|
|
std::array<std::tuple<float, list_head>, kHVAT_End - kHVAT_Begin> vattr_add_ = {};
|
|
std::array<std::tuple<float, list_head>, kHVAT_End - kHVAT_Begin> vattr_dec_ = {};
|
|
|
|
int disable_shot_times_ = 0;
|
|
int disable_useskill_times_ = 0;
|
|
std::map<int, int> immune_tags_;
|
|
|
|
friend class PBUtils;
|
|
};
|