The random potion class
For the biggest class update, we'll turn our attention to the potion class. This class currently has a fixed sprite and doesn't give the player anything. With the humanoid class, we can generate a random type and essentially create two different enemies from a single class. We're going to use this same approach for the potions.
Creating a random potion
To start, let's define an enumerator in Util.h that denotes all potion types. We'll create one for each stat, as follows:
// Potions.
enum class POTION {
ATTACK,
DEFENSE,
STRENGTH,
DEXTERITY,
STAMINA,
COUNT
};To save a lot of typing, the potion class already has the member variables and the getter functions for each possible stat, we just need to use them. One thing that we will add is a variable to hold the potion type, and a function to return it. We'll need this information when picking the object up!
Let's declare the following in Potion.h:
public: /** * Gets the potion type. * @return The potion...