feat: eat to heal

This commit is contained in:
str1k3r committed 2026-09-27 10:26:56 -04:00
1 parent 7d592c43ca
commit 9bcb6f8a3d
7 files changed
+36 -21

No files matched your search

+29 -2
View File
@@ -24,9 +24,36 @@ void FoodData::eat(int food, float saturationModifier)
saturationLevel = min(saturationLevel + (float) food * saturationModifier * 2.0f, (float)foodLevel);
}
void FoodData::eat(FoodItem *item)
void FoodData::eat(FoodItem *item, shared_ptr<Player> player)
{
eat(item->getNutrition(), item->getSaturationModifier());
if(item->apple_gold)
{
player->heal(10);
}
else if(item->mushroomStew)
{
player->heal(5);
}
else if (item->porkChop_cooked)
{
player->heal(4);
}
else if(item->bread || item->fish_cooked)
{
player->heal(2.5);
}
else if(item->porkChop_raw)
{
player->heal(1.5);
}
else if(item->fish_raw)
{
player->heal(1);
}
else if(item->cookie)
{
player->heal(0.5);
}
}
void FoodData::tick(shared_ptr<Player> player)