123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #include "PlayerHand.h"
- #include "Block.h"
- #include "Entity.h"
- PlayerHandItemType::PlayerHandItemType()
- : ItemType(ItemTypeEnum::PLAYER_HAND,
- "PlayerHand",
- new PlayerHandLevelUpRule(),
- 0,
- ModelInfo("", "", 0))
- {}
- void PlayerHandItemType::loadSuperItemSkill(
- ItemSkill* zSkill, Framework::StreamReader* zReader) const
- {
- // TODO: load skill data
- }
- void PlayerHandItemType::saveSuperItemSkill(
- const ItemSkill* zSkill, Framework::StreamWriter* zWriter) const
- {
- // TODO: store skill data
- }
- Item* PlayerHandItemType::createItem() const
- {
- return 0; // there is no player hand item
- }
- ItemSkill* PlayerHandItemType::createDefaultItemSkill() const
- {
- return new PlayerHandSkill();
- }
- PlayerHandLevelUpRule::PlayerHandLevelUpRule()
- : ItemSkillLevelUpRule()
- {}
- void PlayerHandLevelUpRule::applyOn(ItemSkill* zSkill)
- {
- // TODO: level up the skill
- }
- PlayerHandSkill::PlayerHandSkill()
- : ItemSkill(ItemTypeEnum::PLAYER_HAND)
- {}
- void 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);
- }
- }
- }
- void PlayerHandSkill::use(Entity* zActor, Item* zUsedItem, Entity* zTarget)
- {
- // TODO: make damage on the entity
- }
|