Item.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include "ItemType.h"
  3. #include "Reader.h"
  4. class ItemType;
  5. class BlockType;
  6. class Item : public virtual Framework::ReferenceCounter
  7. {
  8. protected:
  9. const ItemType* zType;
  10. const BlockType* zBlockType;
  11. float damage;
  12. float maxDamage;
  13. float durability;
  14. float maxDurability;
  15. bool eatable;
  16. bool placeable;
  17. bool equippable;
  18. bool solid;
  19. bool usable;
  20. int maxStackSize;
  21. Framework::Text name;
  22. Item( const ItemType* zType, const char* name );
  23. public:
  24. virtual void tick();
  25. const ItemType* zItemType() const;
  26. const BlockType* zPlacedBlockType() const;
  27. float getDamage() const;
  28. float getDurability() const;
  29. bool isUsable() const;
  30. bool isEatable() const;
  31. bool isPlaceable() const;
  32. bool isEquippable() const;
  33. bool isSolid() const;
  34. float getMaxDurability() const;
  35. int getMaxStackSize() const;
  36. float getMaxDamage() const;
  37. virtual bool canBeStackedWith( Item* zItem ) const;
  38. virtual void onPlaced();
  39. virtual void applyInventoryEffects( Entity* zTarget );
  40. virtual void removeInventoryEffects( Entity* zTarget );
  41. virtual void applyEquippedEffects( Entity* zTarget );
  42. virtual void removeEquippedEffects( Entity* zTarget );
  43. virtual void applyFoodEffects( Entity* zTarget );
  44. friend ItemType;
  45. };