Item.h 1.2 KB

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