Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
FoodItem Class Reference

Represents an item that can be eaten. More...

#include <FoodItem.hpp>

Inheritance diagram for FoodItem:
Inheritance graph
Collaboration diagram for FoodItem:
Collaboration graph

Public Member Functions

 FoodItem (int id, std::string name, int healAmount, bool isStackable=false)
 
 FoodItem (const FoodItemStruct &foodItem)
 
int getHealAmount ()
 Returns the amount of hp eating this item restores. More...
 
bool use (Entity *user) override
 Eats the item. More...
 
- Public Member Functions inherited from Item
 Item (int id, std::string name, bool isStackable=false)
 
 Item (const GeneralItemStruct &generalItem)
 
const int & getId ()
 Get the type id of the item. More...
 
const int & getInstanceId ()
 Get the instance id of the item. More...
 
const unsigned int & getStackSize ()
 Get the stack size of the item. More...
 
const std::string & getName ()
 Get the name of the item. More...
 
const bool & IsStackable ()
 Get whether the item is stackable or not. More...
 

Private Attributes

int healAmountM
 

Additional Inherited Members

- Protected Attributes inherited from Item
int idM
 
int instanceIdM
 
const unsigned int stackSizeM = 1
 TODO: Implement amount functionality for stackable items. More...
 
std::string nameM
 
bool isStackableM
 
- Static Protected Attributes inherited from Item
static int nextInstanceIdM = 0
 

Detailed Description

Represents an item that can be eaten.

Constructor & Destructor Documentation

◆ FoodItem() [1/2]

FoodItem::FoodItem ( int  id,
std::string  name,
int  healAmount,
bool  isStackable = false 
)

◆ FoodItem() [2/2]

FoodItem::FoodItem ( const FoodItemStruct foodItem)

Member Function Documentation

◆ getHealAmount()

int FoodItem::getHealAmount ( )

Returns the amount of hp eating this item restores.

Returns
int

◆ use()

bool FoodItem::use ( Entity user)
overridevirtual

Eats the item.

Parameters
user
Returns
bool

Reimplemented from Item.

Here is the call graph for this function:

Member Data Documentation

◆ healAmountM

int FoodItem::healAmountM
private

The documentation for this class was generated from the following files: