123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include "PlayerHand.h"
- #include "Block.h"
- #include "Entity.h"
- PlayerHandItemType::PlayerHandItemType()
- : ItemType("PlayerHand", 0, 0)
- {}
- Item* PlayerHandItemType::createItem() const
- {
- return 0; // there is no player hand item
- }
- ItemSkill* PlayerHandItemType::createDefaultItemSkill() const
- {
- return new PlayerHandSkill();
- }
- void PlayerHandItemType::levelUpItemSkill(ItemSkill* zSkill) const {}
- PlayerHandSkill::PlayerHandSkill()
- : ItemSkill(0.f, 1.f, 1.f)
- {}
- bool PlayerHandSkill::use(Entity* zActor, Item* zUsedItem, Block* zTarget)
- {
- if (zActor->getStamina() > 0.001f)
- {
- if (zTarget && zTarget->getHardness() <= 1)
- {
- zActor->setStamina(zActor->getStamina() - 0.001f);
- zTarget->setHP(zTarget->getHP() - 1 / (zTarget->getHardness() + 1));
- }
- else
- {
- zActor->setStamina(zActor->getStamina() - 0.001f);
- zActor->setHP(zActor->getCurrentHP() - 0.01f);
- }
- }
- return false; // item was not changed
- }
- bool PlayerHandSkill::use(Entity* zActor, Item* zUsedItem, Entity* zTarget)
- {
- // TODO: make damage on the entity
- return false; // item was not changed
- }
|