1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
class Item{
private:
string name;
string desc;
int itemId;
public:
Item(int id, string itemname, string description) : itemId(id), name(itemname), desc(description) { }
typedef std::vector<Item*> Items;
string getName(){ return name; };
string getDesc(){ return desc; };
int getID(){ return itemId; };
void LookItem(){ cout << "You see: " << name << ", " << desc; };
};
typedef std::vector<Item *> Items;
class Weapon : public Item {
private:
string name;
string desc;
int itemId;
int special;
public:
Weapon(int id, string itemname, string description, int attack) : Item(itemId, name, desc), special(attack) { } //: Item(itemId, name, desc){ special = attack; };//itemId, Name, Descripton, Attack
string getName(){ return name; };
string getDesc(){ return desc; };
int getID(){ return itemId; };
int getspecial(){ return special; };
void LookItem(){ cout << "You see: " << name << ", " << desc; };
};
class Armor : public Weapon{
private:
string name;
string desc;
int itemId;
int special;
public:
Armor(int id, string itemname, string description, int def) : Weapon(itemId, name, desc, special) { } //itemId, Name, Descripton, Defense
string getName(){ return name; };
string getDesc(){ return desc; };
int getID(){ return itemId; };
int getspecial(){ return special; };
void LookItem(){ cout << "You see: " << name << ", " << desc; };
};
struct Consumable : public Armor{
private:
string name;
string desc;
int itemId;
int special;
public:
Consumable(int id, string itemname, string description, int recoveryamount) : Armor(itemId, name, desc, special) { }//itemId, Name, Descripton, Healing Power
string getName(){ return name; };
string getDesc(){ return desc; };
int getID(){ return itemId; };
int getspecial(){ return special; };
void LookItem(){ cout << "You see: " << name << ", " << desc; };
};
|