aozhiwei b00d07ba26 1
2024-01-04 16:14:59 +08:00

63 lines
2.2 KiB
C++

#pragma once
#include "attrdefine.h"
#include "weakptr.h"
class Ability
{
public:
Ability(CreatureWeakPtr owner);
~Ability();
void IncImmuneTimes(int tag);
void DecImmuneTimes(int tag);
bool CanImmune(int tag);
bool CanImmune(const std::set<int>& tags);
void IncSwitch(int type);
void DecSwitch(int type);
int GetSwitchTimes(int type);
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);
AttrDirectHandle AddAttrDirect(int attr_id, float value);
void RemoveAttrDirect(AttrDirectHandle handle);
float GetAttrDirect(int attr_id);
void GMDelBaseAttr(int type, int attr_id, int idx);
void GMClearBaseAttr(int type);
void GMDelGrowAttr(int type, int attr_id, int idx);
void GMClearGrowAttr(int type);
std::vector<std::string> GMShowAttrs();
private:
void Clear();
void RecalcAttrAbs(int attr_id);
void RecalcAttrRate(int attr_id);
void RecalcAttrAddition(int attr_id);
void RecalcAttrRuduce(int attr_id);
void RecalcAttrDirect(int attr_id);
private:
CreatureWeakPtr owner_;
std::array<std::tuple<float, list_head>, kNHAT_End> attr_abs_ = {};
std::array<std::tuple<float, list_head>, kNHAT_End> attr_rate_ = {};
std::array<std::tuple<float, list_head>, kNHAT_End> attr_add_ = {};
std::array<std::tuple<float, list_head>, kNHAT_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_ = {};
std::array<std::tuple<float, list_head>, kNHAT_End> attr_direct_ = {};
std::array<int, kSwitchTimeEnd> switch_times_ = {};
std::map<int, int> immune_tags_;
friend class PBUtils;
};