Fix Equipment file comments to be on newlines. Parse item stat values based on provided stat values in config instead of hard-coding.
This commit is contained in:
+19
-13
@@ -41,6 +41,17 @@ All rights reserved.
|
||||
#define A(attr) get(attr)
|
||||
#define A_Read(attr) get_readOnly(attr)
|
||||
|
||||
namespace DisplayType{
|
||||
enum DisplayType{
|
||||
DISPLAY_AS_NUMBER=0,
|
||||
DISPLAY_AS_PERCENT=1,
|
||||
};
|
||||
}
|
||||
struct AttributeData{
|
||||
std::string name;
|
||||
DisplayType::DisplayType displayAsPercent;
|
||||
};
|
||||
|
||||
enum class ItemAttribute{
|
||||
/*////////////////////////////////////////////*/
|
||||
/*//////*/ENUM_START,/*///////////////////////*/
|
||||
@@ -65,20 +76,11 @@ enum class ItemAttribute{
|
||||
/*////////////////////////////////////////////*/
|
||||
};
|
||||
|
||||
namespace DisplayType{
|
||||
enum DisplayType{
|
||||
DISPLAY_AS_NUMBER=0,
|
||||
DISPLAY_AS_PERCENT=1,
|
||||
};
|
||||
}
|
||||
struct AttributeData{
|
||||
std::string name;
|
||||
DisplayType::DisplayType displayAsPercent;
|
||||
};
|
||||
|
||||
class ItemAttributable{
|
||||
friend class ItemInfo;
|
||||
std::map<ItemAttribute,int>attributes;
|
||||
private:
|
||||
inline static std::map<std::string,ItemAttribute>stringToAttribute;
|
||||
inline static std::map<ItemAttribute,AttributeData>data{
|
||||
{ItemAttribute::defense,{"Defense",DisplayType::DISPLAY_AS_NUMBER}},
|
||||
{ItemAttribute::health,{"Health",DisplayType::DISPLAY_AS_NUMBER}},
|
||||
@@ -88,12 +90,13 @@ private:
|
||||
{ItemAttribute::critPct,{"Crit Rate",DisplayType::DISPLAY_AS_PERCENT}},
|
||||
{ItemAttribute::critDmgPct,{"Crit Dmg",DisplayType::DISPLAY_AS_PERCENT}},
|
||||
{ItemAttribute::healthPct,{"Health %",DisplayType::DISPLAY_AS_PERCENT}}, //Percentage of health boost
|
||||
{ItemAttribute::healthPctRecoveryPer6sec,{"HP Recovery %",DisplayType::DISPLAY_AS_NUMBER}}, //Percentage of health recovered every 6 seconds.
|
||||
{ItemAttribute::healthPctRecoveryPer4sec,{"HP Recovery %",DisplayType::DISPLAY_AS_NUMBER}}, //Percentage of health recovered every 4 seconds.
|
||||
{ItemAttribute::healthPctRecoveryPer6sec,{"HP6 Recovery %",DisplayType::DISPLAY_AS_NUMBER}}, //Percentage of health recovered every 6 seconds.
|
||||
{ItemAttribute::healthPctRecoveryPer4sec,{"HP4 Recovery %",DisplayType::DISPLAY_AS_NUMBER}}, //Percentage of health recovered every 4 seconds.
|
||||
{ItemAttribute::damageReductionPct,{"Damage Reduction",DisplayType::DISPLAY_AS_PERCENT}}, //Percentage of damage reduced directly.
|
||||
{ItemAttribute::attackPct,{"Attack %",DisplayType::DISPLAY_AS_PERCENT}}, //Percentage of damage increased by.
|
||||
};
|
||||
public:
|
||||
|
||||
//Returns a copy of all the attributes to be passed to a new instance easily / to sync values between both.
|
||||
inline void copyTo(ItemAttributable&target){
|
||||
target.attributes=attributes;
|
||||
@@ -107,4 +110,7 @@ public:
|
||||
inline static AttributeData GetDisplayInfo(ItemAttribute a){
|
||||
return data[a];
|
||||
}
|
||||
inline static ItemAttribute GetAttributeFromString(std::string attrName){
|
||||
return stringToAttribute[attrName];
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user