Advertisement
Ember

items

Aug 2nd, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. class Item
  2. {
  3. public:
  4.     // Various item types
  5.     class Gold;
  6.     class Weapon;
  7.     class Equipment;
  8.  
  9. public:
  10.     // Item type identifier
  11.     enum Type
  12.     {
  13.         Gold = 0,
  14.         Weapon = 1,
  15.         Equipment = 2
  16.     };
  17.    
  18. public:
  19.     // Members
  20.     Type ItemType;
  21.  
  22. public:
  23.     // Methods
  24.     virtual Void Loot();
  25. };
  26.  
  27. class Item::Gold : public Item
  28. {
  29. public:
  30.     // Members
  31.     UInt Value;
  32.  
  33. public:
  34.     Void Loot(const Player& player) { Player.Gold += Value; };
  35. };
  36.  
  37. class Item::Weapon : public Item
  38. {
  39. public:
  40.     enum Type
  41.     {
  42.         Sword = 0,
  43.         Mace = 1
  44.     };
  45.  
  46. public:
  47.     // Members
  48.     Type WeaponType;
  49. };
  50.  
  51. class Item::Equipment : public Item
  52. {
  53. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement