ItemSkill.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include <JSON.h>
  3. #include <ReferenceCounter.h>
  4. #include "Reader.h"
  5. class ItemType;
  6. class ItemSkill;
  7. class Block;
  8. class Entity;
  9. class Dimension;
  10. class Item;
  11. class ItemSkillLevelUpRule : public virtual Framework::ReferenceCounter
  12. {
  13. public:
  14. virtual void applyOn(ItemSkill* zSkill) = 0;
  15. };
  16. class ItemSkill : public virtual Framework::ReferenceCounter
  17. {
  18. private:
  19. float xp;
  20. float maxXP;
  21. float level;
  22. int itemTypeId;
  23. public:
  24. ItemSkill(float xp, float maxXp, float level);
  25. virtual void load(Framework::StreamReader* zReader);
  26. virtual void save(Framework::StreamWriter* zWriter);
  27. virtual bool use(Entity* zActor, Item* zUsedItem, Block* zTarget) = 0;
  28. virtual bool use(Entity* zActor, Item* zUsedItem, Entity* zTarget) = 0;
  29. virtual bool interact(Entity* zActor, Item* zUsedItem, Block* zTarget);
  30. virtual bool interact(Entity* zActor, Item* zUsedItem, Entity* zTarget);
  31. void setXp(float xp);
  32. float getXp() const;
  33. void setMaxXp(float maxXp);
  34. float getMaxXp() const;
  35. void setLevel(float level);
  36. float getLevel() const;
  37. void setItemTypeId(int itemTypeId);
  38. int getItemTypeId() const;
  39. };