diff options
author | Mattes D <github@xoft.cz> | 2014-08-01 17:43:18 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-08-01 17:43:18 +0200 |
commit | d2744713bb69ca7c6211fe9b7bdf6fcadd2cadc8 (patch) | |
tree | 20fd08c3d16c6e21bfec17b3252b8cd48c923e59 /src/Items/ItemGoldenApple.h | |
parent | Merge pull request #1269 from Howaner/BlockEntitys (diff) | |
parent | Compile fix. (diff) | |
download | cuberite-d2744713bb69ca7c6211fe9b7bdf6fcadd2cadc8.tar cuberite-d2744713bb69ca7c6211fe9b7bdf6fcadd2cadc8.tar.gz cuberite-d2744713bb69ca7c6211fe9b7bdf6fcadd2cadc8.tar.bz2 cuberite-d2744713bb69ca7c6211fe9b7bdf6fcadd2cadc8.tar.lz cuberite-d2744713bb69ca7c6211fe9b7bdf6fcadd2cadc8.tar.xz cuberite-d2744713bb69ca7c6211fe9b7bdf6fcadd2cadc8.tar.zst cuberite-d2744713bb69ca7c6211fe9b7bdf6fcadd2cadc8.zip |
Diffstat (limited to 'src/Items/ItemGoldenApple.h')
-rw-r--r-- | src/Items/ItemGoldenApple.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/Items/ItemGoldenApple.h b/src/Items/ItemGoldenApple.h new file mode 100644 index 000000000..4e1096e65 --- /dev/null +++ b/src/Items/ItemGoldenApple.h @@ -0,0 +1,58 @@ +#pragma once + +#include "ItemFood.h" + + + + + +class cItemGoldenAppleHandler : + public cItemFoodHandler +{ + typedef cItemFoodHandler super; + +public: + cItemGoldenAppleHandler() + : super(E_ITEM_GOLDEN_APPLE) + { + } + + + virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override + { + // Feed the player: + FoodInfo Info = GetFoodInfo(); + a_Player->Feed(Info.FoodLevel, Info.Saturation); + + // Add the effects: + a_Player->AddEntityEffect(cEntityEffect::effAbsorption, 2400, 0); + a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 100, 1); + + // When the apple is a 'notch apple', give extra effects: + if (a_Item->m_ItemDamage > 0) + { + a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 600, 4); + a_Player->AddEntityEffect(cEntityEffect::effResistance, 6000, 0); + a_Player->AddEntityEffect(cEntityEffect::effFireResistance, 6000, 0); + } + + return true; + } + + + virtual FoodInfo GetFoodInfo(void) override + { + return FoodInfo(4, 9.6); + } + + + virtual bool GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance) override + { + return false; + } + +}; + + + + |