Parse Item sets from config. Fix constness of item set getter, and change AddSetBonus function to be statically used instead, makes more sense.
This commit is contained in:
+10
-6
@@ -67,9 +67,9 @@ enum class EquipSlot{
|
||||
|
||||
struct Stats:ItemAttributable{
|
||||
public:
|
||||
inline Stats&operator+=(const Stats&rhs){
|
||||
inline Stats&operator+=(Stats&rhs){
|
||||
for(ItemAttribute a=ItemAttribute(int(ItemAttribute::ENUM_START)+1);a<ItemAttribute::ENUM_END;a=ItemAttribute(int(a)+1)){
|
||||
A(a)+=rhs.A_Read(a);
|
||||
A(a)+=rhs.get_readOnly(a);
|
||||
}
|
||||
return *this;
|
||||
};
|
||||
@@ -83,13 +83,14 @@ public:
|
||||
const Stats&operator[](int level)const;
|
||||
};
|
||||
|
||||
//You cannot create instances of this class, access sets from ItemSet::sets and add the appropriate set bonuses.
|
||||
class ItemSet{
|
||||
friend class Item;
|
||||
friend class ItemInfo;
|
||||
static std::map<std::string,ItemSet>sets;
|
||||
std::array<Stats,8>setBonuses;
|
||||
public:
|
||||
//Specify the piece count(1-8) for a set bonus to be applied.
|
||||
void AddSetBonus(int pieceCount,const Stats&bonuses);
|
||||
static void AddSetBonus(std::string setName,int pieceCount,Stats&bonuses);
|
||||
//Gets a set bonus based on number of pieces (1-8)
|
||||
const Stats&operator[](int setPieces)const;
|
||||
};
|
||||
@@ -101,7 +102,6 @@ private:
|
||||
//The amount in the current item stack.
|
||||
uint32_t amt;
|
||||
uint8_t enhancementLevel;
|
||||
std::string set;
|
||||
ItemInfo*it;
|
||||
public:
|
||||
Item();
|
||||
@@ -113,7 +113,6 @@ public:
|
||||
EquipSlot GetEquipSlot();
|
||||
Decal*Decal();
|
||||
ItemScript&OnUseAction();
|
||||
const ItemSet&GetItemSet()const;
|
||||
float CastTime();
|
||||
float CooldownTime();
|
||||
bool IsBlank();
|
||||
@@ -178,6 +177,7 @@ class ItemInfo{
|
||||
EquipSlot slot;
|
||||
EnhancementInfo enhancement;
|
||||
Decal*img;
|
||||
std::string set;
|
||||
//Returns true if the item can be used, false otherwise
|
||||
std::string useFunc="";
|
||||
//Custom properties for this specific item's script.
|
||||
@@ -186,6 +186,7 @@ class ItemInfo{
|
||||
|
||||
private:
|
||||
static void InitializeScripts();
|
||||
static void InitializeSets();
|
||||
static std::map<std::string,EquipSlot>nameToEquipSlot;
|
||||
public:
|
||||
static void InitializeItems();
|
||||
@@ -201,6 +202,9 @@ public:
|
||||
float CastTime();
|
||||
float CooldownTime();
|
||||
EquipSlot Slot();
|
||||
bool HasItemSet();
|
||||
//NOTE: Not every item has a set! Verify with HasItemSet() first!
|
||||
const ItemSet&ItemSet()const;
|
||||
};
|
||||
|
||||
class ItemOverlay{
|
||||
|
||||
Reference in New Issue
Block a user