ItemSkill.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. void ItemSkill::interact(Entity* zActor, Item* zUsedItem, Block* zTarget)
  19. {
  20. zTarget->interact(zUsedItem, zActor);
  21. }
  22. void ItemSkill::interact(Entity* zActor, Item* zUsedItem, Entity* zTarget)
  23. {
  24. 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. void BasicItemSkill::use(Entity* zActor, Item* zUsedItem, Block* zTarget) {}
  45. void BasicItemSkill::use(Entity* zActor, Item* zUsedItem, Entity* zTarget) {}
  46. void BasicItemSkill::interact(Entity* zActor, Item* zUsedItem, Block* zTarget)
  47. {}
  48. void BasicItemSkill::interact(Entity* zActor, Item* zUsedItem, Entity* zTarget)
  49. {}