ItemSkill.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "ItemSkill.h"
  2. #include "Block.h"
  3. #include "Entity.h"
  4. #include "ItemType.h"
  5. #include "StaticRegistry.h"
  6. ItemSkill::ItemSkill(int itemTypeId)
  7. : Framework::ReferenceCounter(),
  8. itemTypeId(itemTypeId)
  9. {}
  10. const ItemType* ItemSkill::zSkillType()
  11. {
  12. return StaticRegistry<ItemType>::INSTANCE.zElement(itemTypeId);
  13. }
  14. int ItemSkill::getTypeId()
  15. {
  16. return itemTypeId;
  17. }
  18. bool ItemSkill::interact(Entity* zActor, Item* zUsedItem, Block* zTarget)
  19. {
  20. return zTarget->interact(zUsedItem, zActor);
  21. }
  22. bool ItemSkill::interact(Entity* zActor, Item* zUsedItem, Entity* zTarget)
  23. {
  24. return zTarget->interact(zUsedItem, zActor);
  25. }
  26. BasicItemSkill::BasicItemSkill(int itemTypeId,
  27. float maxXP,
  28. float durabilityModifier,
  29. float speedModifier,
  30. float luckModifier,
  31. float staminaModifier,
  32. float hungerModifier,
  33. float xpIncrease)
  34. : ItemSkill(itemTypeId),
  35. level(1),
  36. xp(0),
  37. maxXP(maxXP),
  38. durabilityModifier(durabilityModifier),
  39. speedModifier(speedModifier),
  40. luckModifier(luckModifier),
  41. staminaModifier(staminaModifier),
  42. hungerModifier(hungerModifier)
  43. {}
  44. bool BasicItemSkill::use(Entity* zActor, Item* zUsedItem, Block* zTarget)
  45. {
  46. return false;
  47. }
  48. bool BasicItemSkill::use(Entity* zActor, Item* zUsedItem, Entity* zTarget)
  49. {
  50. return false;
  51. }
  52. bool BasicItemSkill::interact(Entity* zActor, Item* zUsedItem, Block* zTarget)
  53. {
  54. return false;
  55. }
  56. bool BasicItemSkill::interact(Entity* zActor, Item* zUsedItem, Entity* zTarget)
  57. {
  58. return false;
  59. }