Assuming that I wanted to make a simple dos-based game and I wanted to create some mobs, I’ve come up with the following rough object that I would need, and it looks something like this:
class createMob{
private:
int healthMax;
int healthCurrent;
int manaMax;
int manaCurrent;
int experiencePoints;
public:
void setHealth();
int getHealth();
void setCurrentHealth();
int getCurrentHealth();
void setMaxMana();
int getMaxMana();
void setCurrentMana();
int getCurrentMana();
int getExperience();
//etc etc functions truncated for space
};
My question is how do I use this? Assume that I create a simple constructor to take in a hp / mp / experience for a mob called “green slime” (final fantasy theme going on here). My basic goal is to create a monster with x / y /z attributes and set them based on what happens in combat… What would be the easiest way to do this and then clean up efficiently afterwards?
If you have two mobs in a fight, the fight is going to take longer than one turn, so one fight turn is going to need the following global function:
Now this function can change properties of both mobs. Now if mobs are actually doing some actions to choose how the fight is going, you’ll need something different:
with the action being something like this:
Now the fight functions can use the interface of Mob class to do the changes.