1
0
cuberite-2a/src/Items/ItemPoisonousPotato.h
Alexander Harkness 2b9474f171
Remove switch statements from cItemFoodHandler (#4610)
* Remove switch statements from cItemFoodHandler

* Alpha-sort and add comment

* Relocate golden apple handler
2020-04-04 15:13:41 +00:00

37 lines
511 B
C++

#pragma once
#include "ItemFood.h"
class cItemPoisonousPotatoHandler :
public cItemFoodHandler
{
typedef cItemFoodHandler super;
public:
cItemPoisonousPotatoHandler()
: super(E_ITEM_POISONOUS_POTATO, FoodInfo(2, 1.2))
{
}
virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override
{
if (!super::EatItem(a_Player, a_Item))
{
return false;
}
if (GetRandomProvider().RandBool(0.6))
{
a_Player->AddEntityEffect(cEntityEffect::effPoison, 100, 0);
}
return true;
}
};