ItemSkill.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include "Reader.h"
  3. #include <JSON.h>
  4. #include <ReferenceCounter.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. const ItemType* skillType;
  20. public:
  21. ItemSkill( const ItemType* zSkillType );
  22. virtual void use( Entity* zActor, Item* zUsedItem, Block* zTarget ) = 0;
  23. virtual void use( Entity* zActor, Item* zUsedItem, Entity* zTarget ) = 0;
  24. const ItemType* zSkillType();
  25. };
  26. class BasicItemSkill : public ItemSkill
  27. {
  28. protected:
  29. int level;
  30. float xp;
  31. float maxXP;
  32. float durabilityModifier;
  33. float speedModifier;
  34. float luckModifier;
  35. float staminaModifier;
  36. float hungerModifier;
  37. BasicItemSkill( const ItemType* zSkillType, float maxXp = 100.f, float durabilityModifier = 1.f, float speedModifier = 1.f, float luckModifier = 1.f, float staminaModifier = 1.f, float hungerModifier = 1.f, float xpIncrease = 1.1f );
  38. public:
  39. virtual void use( Entity* zActor, Item* zUsedItem, Block* zTarget ) override;
  40. virtual void use( Entity* zActor, Item* zUsedItem, Entity* zTarget ) override;
  41. friend ItemType;
  42. };