PlayerHand.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "PlayerHand.h"
  2. #include "Block.h"
  3. PlayerHandItemType::PlayerHandItemType()
  4. : ItemType( ID, new PlayerHandLevelUpRule(), 0 )
  5. {}
  6. void PlayerHandItemType::loadSuperItemSkill( ItemSkill* zSkill, Framework::StreamReader* zReader ) const
  7. {
  8. // TODO: load skill data
  9. }
  10. void PlayerHandItemType::saveSuperItemSkill( const ItemSkill* zSkill, Framework::StreamWriter* zWriter ) const
  11. {
  12. // TODO: store skill data
  13. }
  14. Item* PlayerHandItemType::createItem() const
  15. {
  16. return 0; // there is no player hand item
  17. }
  18. ItemSkill* PlayerHandItemType::createDefaultItemSkill() const
  19. {
  20. return new PlayerHandSkill();
  21. }
  22. PlayerHandLevelUpRule::PlayerHandLevelUpRule()
  23. : ItemSkillLevelUpRule()
  24. {}
  25. void PlayerHandLevelUpRule::applyOn( ItemSkill* zSkill )
  26. {
  27. // TODO: level up the skill
  28. }
  29. PlayerHandSkill::PlayerHandSkill()
  30. : ItemSkill( PlayerHandItemType::INSTANCE )
  31. {}
  32. void PlayerHandSkill::use( Entity* zActor, Item* zUsedItem, Block* zTarget )
  33. {
  34. if( zTarget && zTarget->getHardness() <= 1 )
  35. {
  36. zTarget->setHP( zTarget->getHP() - 1 / (zTarget->getHardness() + 1) );
  37. }
  38. // TODO: make damage on the block
  39. }
  40. void PlayerHandSkill::use( Entity* zActor, Item* zUsedItem, Entity* zTarget )
  41. {
  42. // TODO: make damage on the entity
  43. }